convenience_socket_bases.h revision 13513
1/*****************************************************************************
2
3  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
4  more contributor license agreements.  See the NOTICE file distributed
5  with this work for additional information regarding copyright ownership.
6  Accellera licenses this file to you under the Apache License, Version 2.0
7  (the "License"); you may not use this file except in compliance with the
8  License.  You may obtain a copy of the License at
9
10    http://www.apache.org/licenses/LICENSE-2.0
11
12  Unless required by applicable law or agreed to in writing, software
13  distributed under the License is distributed on an "AS IS" BASIS,
14  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15  implied.  See the License for the specific language governing
16  permissions and limitations under the License.
17
18 *****************************************************************************/
19#ifndef __SYSTEMC_EXT_TLM_UTILS_CONVENIENCE_SOCKET_BASES_H__
20#define __SYSTEMC_EXT_TLM_UTILS_CONVENIENCE_SOCKET_BASES_H__
21
22#include <systemc>
23
24namespace sc_core
25{
26
27class sc_object;
28
29} // namespace sc_core
30
31namespace tlm_utils
32{
33
34// Implementation-defined base class helper for convenience sockets.
35class convenience_socket_base
36{
37  public:
38    void display_warning(const char *msg) const;
39    void display_error(const char *msg) const;
40
41  protected:
42    virtual ~convenience_socket_base() {}
43
44  private:
45    virtual const char *get_report_type() const = 0;
46    virtual const sc_core::sc_object *get_socket() const = 0;
47};
48
49// Implementation-defined base class helper for simple sockets.
50class simple_socket_base : public convenience_socket_base
51{
52    virtual const char *get_report_type() const;
53
54  protected:
55    void elaboration_check(const char *action) const;
56};
57
58// Implementation-defined base class helper for passthrough sockets.
59class passthrough_socket_base : public convenience_socket_base
60{
61    virtual const char *get_report_type() const;
62};
63
64// Implementation-defined base class helper for multi sockets.
65class multi_socket_base : public convenience_socket_base
66{
67    virtual const char *get_report_type() const;
68};
69
70// Implementation-defined base class for callback helpers.
71class convenience_socket_cb_holder
72{
73  public:
74    void display_warning(const char *msg) const;
75    void display_error(const char *msg) const;
76
77  protected:
78    explicit convenience_socket_cb_holder(convenience_socket_base *owner) :
79        m_owner(owner)
80    {}
81
82  private:
83    convenience_socket_base *m_owner;
84};
85
86} // namespace tlm_utils
87
88#endif /* __SYSTEMC_EXT_TLM_UTILS_CONVENIENCE_SOCKET_BASES_H__ */
89