SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_fxcast_switch.h
Go to the documentation of this file.
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 
20 /*****************************************************************************
21 
22  sc_fxcast_switch.h -
23 
24  Original Author: Martin Janssen, Synopsys, Inc.
25 
26  *****************************************************************************/
27 
28 /*****************************************************************************
29 
30  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
31  changes you are making here.
32 
33  Name, Affiliation, Date:
34  Description of Modification:
35 
36  *****************************************************************************/
37 
38 // $Log: sc_fxcast_switch.h,v $
39 // Revision 1.2 2011/08/24 22:05:43 acg
40 // Torsten Maehne: initialization changes to remove warnings.
41 //
42 // Revision 1.1.1.1 2006/12/15 20:20:04 acg
43 // SystemC 2.3
44 //
45 // Revision 1.3 2006/01/13 18:53:57 acg
46 // Andy Goodrich: added $Log command so that CVS comments are reproduced in
47 // the source.
48 //
49 
50 #ifndef SC_FXCAST_SWITCH_H
51 #define SC_FXCAST_SWITCH_H
52 
53 
55 
56 
57 namespace sc_dt
58 {
59 
60 // classes defined in this module
61 class sc_fxcast_switch;
62 
63 
71 {
72 
73 public:
74 
79 
80  sc_fxcast_switch& operator = ( const sc_fxcast_switch& );
81 
82  friend bool operator == ( const sc_fxcast_switch&,
83  const sc_fxcast_switch& );
84  friend bool operator != ( const sc_fxcast_switch&,
85  const sc_fxcast_switch& );
86 
87  const std::string to_string() const;
88 
89  void print( ::std::ostream& = ::std::cout ) const;
90  void dump( ::std::ostream& = ::std::cout ) const;
91 
92 private:
93 
94  sc_switch m_sw;
95 
96 };
97 
98 } // namespace sc_dt
99 
106 // extern template instantiations
107 namespace sc_core {
108 SC_API_TEMPLATE_DECL_ sc_phash<void*, const sc_dt::sc_fxcast_switch*>;
109 } // namespace sc_core
110 
111 namespace sc_dt {
112 
115 typedef sc_context<sc_fxcast_switch> sc_fxcast_context;
116 
117 
118 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
119 
120 inline
122 : m_sw()
123 {
125 }
126 
127 inline
129 : m_sw( sw_ )
130 {}
131 
132 inline
134 : m_sw( a.m_sw )
135 {}
136 
137 inline
139 : m_sw( SC_DEFAULT_CAST_SWITCH_ )
140 {}
141 
142 
143 inline
146 {
147  if( &a != this )
148  {
149  m_sw = a.m_sw;
150  }
151  return *this;
152 }
153 
154 
155 inline
156 bool
158 {
159  return ( a.m_sw == b.m_sw );
160 }
161 
162 
163 inline
164 bool
166 {
167  return ( a.m_sw != b.m_sw );
168 }
169 
170 
171 inline
172 ::std::ostream&
173 operator << ( ::std::ostream& os, const sc_fxcast_switch& a )
174 {
175  a.print( os );
176  return os;
177 }
178 
179 } // namespace sc_dt
180 
181 
182 #endif
183 
184 // Taf!
friend bool operator==(const sc_fxcast_switch &, const sc_fxcast_switch &)
sc_fxcast_switch & operator=(const sc_fxcast_switch &)
bool operator==(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:289
sc_switch
Enumeration of switch states.
Definition: sc_fxdefs.h:148
void print(::std::ostream &=::std::cout) const
Empty class that is used for its type only.
Definition: sc_context.h:89
static const T & default_value()
Definition: sc_context.h:300
Fixed-point cast switch class.
Template context class; co-routine safe.
Definition: sc_context.h:80
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1005
bool operator!=(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:292
Template global variable class; singleton; co-routine safe.
Definition: sc_context.h:79
SC_API const std::string to_string(sc_enc)
const sc_switch SC_DEFAULT_CAST_SWITCH_
Definition: sc_fxdefs.h:215
friend bool operator!=(const sc_fxcast_switch &, const sc_fxcast_switch &)
sc_context< sc_fxcast_switch > sc_fxcast_context
#define SC_API_TEMPLATE_DECL_
Definition: sc_cmnhdr.h:177
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
Definition: sc_bit.h:390
#define SC_API
Definition: sc_cmnhdr.h:168