convenience_socket_bases.h revision 13511
113511Sgabeblack@google.com/*****************************************************************************
213511Sgabeblack@google.com
313511Sgabeblack@google.com  Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
413511Sgabeblack@google.com  more contributor license agreements.  See the NOTICE file distributed
513511Sgabeblack@google.com  with this work for additional information regarding copyright ownership.
613511Sgabeblack@google.com  Accellera licenses this file to you under the Apache License, Version 2.0
713511Sgabeblack@google.com  (the "License"); you may not use this file except in compliance with the
813511Sgabeblack@google.com  License.  You may obtain a copy of the License at
913511Sgabeblack@google.com
1013511Sgabeblack@google.com    http://www.apache.org/licenses/LICENSE-2.0
1113511Sgabeblack@google.com
1213511Sgabeblack@google.com  Unless required by applicable law or agreed to in writing, software
1313511Sgabeblack@google.com  distributed under the License is distributed on an "AS IS" BASIS,
1413511Sgabeblack@google.com  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
1513511Sgabeblack@google.com  implied.  See the License for the specific language governing
1613511Sgabeblack@google.com  permissions and limitations under the License.
1713511Sgabeblack@google.com
1813511Sgabeblack@google.com *****************************************************************************/
1913511Sgabeblack@google.com#ifndef TLM_UTILS_CONVENIENCE_SOCKET_BASES_H_INCLUDED_
2013511Sgabeblack@google.com#define TLM_UTILS_CONVENIENCE_SOCKET_BASES_H_INCLUDED_
2113511Sgabeblack@google.com
2213511Sgabeblack@google.com#include <sysc/kernel/sc_cmnhdr.h>
2313511Sgabeblack@google.com
2413511Sgabeblack@google.comnamespace sc_core { class SC_API sc_object; }
2513511Sgabeblack@google.com
2613511Sgabeblack@google.comnamespace tlm_utils {
2713511Sgabeblack@google.com
2813511Sgabeblack@google.com// implementation-defined base class helper for convenience sockets
2913511Sgabeblack@google.comclass SC_API convenience_socket_base
3013511Sgabeblack@google.com{
3113511Sgabeblack@google.compublic:
3213511Sgabeblack@google.com  void display_warning(const char* msg) const;
3313511Sgabeblack@google.com  void display_error(const char* msg) const;
3413511Sgabeblack@google.comprotected:
3513511Sgabeblack@google.com  virtual ~convenience_socket_base(){}
3613511Sgabeblack@google.comprivate:
3713511Sgabeblack@google.com  virtual const char* get_report_type() const = 0;
3813511Sgabeblack@google.com  virtual const sc_core::sc_object* get_socket() const = 0;
3913511Sgabeblack@google.com};
4013511Sgabeblack@google.com
4113511Sgabeblack@google.com// implementation-defined base class helper for simple sockets
4213511Sgabeblack@google.comclass SC_API simple_socket_base : public convenience_socket_base
4313511Sgabeblack@google.com{
4413511Sgabeblack@google.com  virtual const char* get_report_type() const;
4513511Sgabeblack@google.comprotected:
4613511Sgabeblack@google.com  void elaboration_check(const char* action) const;
4713511Sgabeblack@google.com};
4813511Sgabeblack@google.com
4913511Sgabeblack@google.com// implementation-defined base class helper for passthrough sockets
5013511Sgabeblack@google.comclass SC_API passthrough_socket_base : public convenience_socket_base
5113511Sgabeblack@google.com{
5213511Sgabeblack@google.com  virtual const char* get_report_type() const;
5313511Sgabeblack@google.com};
5413511Sgabeblack@google.com
5513511Sgabeblack@google.com// implementation-defined base class helper for multi sockets
5613511Sgabeblack@google.comclass SC_API multi_socket_base : public convenience_socket_base
5713511Sgabeblack@google.com{
5813511Sgabeblack@google.com  virtual const char* get_report_type() const;
5913511Sgabeblack@google.com};
6013511Sgabeblack@google.com
6113511Sgabeblack@google.com// implementation-defined base class for callback helpers
6213511Sgabeblack@google.comclass SC_API convenience_socket_cb_holder
6313511Sgabeblack@google.com{
6413511Sgabeblack@google.compublic:
6513511Sgabeblack@google.com  void display_warning(const char* msg) const;
6613511Sgabeblack@google.com  void display_error(const char* msg) const;
6713511Sgabeblack@google.com
6813511Sgabeblack@google.comprotected:
6913511Sgabeblack@google.com  explicit convenience_socket_cb_holder(convenience_socket_base* owner)
7013511Sgabeblack@google.com    : m_owner(owner) {}
7113511Sgabeblack@google.com
7213511Sgabeblack@google.comprivate:
7313511Sgabeblack@google.com  convenience_socket_base* m_owner;
7413511Sgabeblack@google.com};
7513511Sgabeblack@google.com
7613511Sgabeblack@google.com} // namespace tlm_utils
7713511Sgabeblack@google.com#endif // TLM_UTILS_CONVENIENCE_SOCKET_BASES_H_INCLUDED_
78