SystemC  2.3.2
Accellera SystemC proof-of-concept library
sc_length_param.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_length_param.h -
23 
24  Original Author: Martin Janssen, Synopsys, Inc., 2002-03-19
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_length_param.h,v $
39 // Revision 1.3 2011/08/24 22:05:46 acg
40 // Torsten Maehne: initialization changes to remove warnings.
41 //
42 // Revision 1.2 2011/02/18 20:19:15 acg
43 // Andy Goodrich: updating Copyright notice.
44 //
45 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
46 // SystemC 2.3
47 //
48 // Revision 1.4 2006/05/08 17:50:01 acg
49 // Andy Goodrich: Added David Long's declarations for friend operators,
50 // functions, and methods, to keep the Microsoft compiler happy.
51 //
52 // Revision 1.3 2006/01/13 18:49:32 acg
53 // Added $Log command so that CVS check in comments are reproduced in the
54 // source.
55 //
56 
57 #ifndef SC_LENGTH_PARAM_H
58 #define SC_LENGTH_PARAM_H
59 
60 
62 
63 
64 namespace sc_dt
65 {
66 
67 // classes defined in this module
68 class sc_length_param;
69 
70 // friend operator declarations
71  SC_API bool operator == ( const sc_length_param&,
72  const sc_length_param& );
73  SC_API bool operator != ( const sc_length_param&,
74  const sc_length_param& );
75 
76 
84 {
85 public:
86 
88  sc_length_param( int );
91 
92  sc_length_param& operator = ( const sc_length_param& );
93 
94  friend SC_API bool operator == ( const sc_length_param&,
95  const sc_length_param& );
96  friend SC_API bool operator != ( const sc_length_param&,
97  const sc_length_param& );
98 
99  int len() const;
100  void len( int );
101 
102  const std::string to_string() const;
103 
104  void print( ::std::ostream& = ::std::cout ) const;
105  void dump( ::std::ostream& = ::std::cout ) const;
106 
107 private:
108 
109  int m_len;
110 };
111 
112 } // namespace sc_dt
113 
120 // extern template instantiations
121 namespace sc_core {
122 SC_API_TEMPLATE_DECL_ sc_phash<void*, const sc_dt::sc_length_param*>;
123 } // namespace sc_core
124 
125 namespace sc_dt {
126 
129 typedef sc_context<sc_length_param> sc_length_context;
130 
131 
132 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
133 
134 inline
136 {
138 }
139 
140 inline
141 sc_length_param::sc_length_param( int len_ ) : m_len(len_)
142 {
143  SC_CHECK_WL_( len_ );
144 }
145 
146 inline
148  : m_len( a.m_len )
149 {}
150 
151 inline
153  : m_len( SC_DEFAULT_WL_ )
154 {}
155 
156 
157 inline
160 {
161  if( &a != this )
162  {
163  m_len = a.m_len;
164  }
165  return *this;
166 }
167 
168 
169 inline
170 bool
172 {
173  return ( a.m_len == b.m_len );
174 }
175 
176 inline
177 bool
179 {
180  return ( a.m_len != b.m_len );
181 }
182 
183 
184 inline
185 int
187 {
188  return m_len;
189 }
190 
191 inline
192 void
194 {
195  SC_CHECK_WL_( len_ );
196  m_len = len_;
197 }
198 
199 
200 inline
201 ::std::ostream&
202 operator << ( ::std::ostream& os, const sc_length_param& a )
203 {
204  a.print( os );
205  return os;
206 }
207 
208 } // namespace sc_dt
209 
210 
211 #endif
212 
213 // Taf!
friend SC_API bool operator!=(const sc_length_param &, const sc_length_param &)
bool operator==(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:289
Empty class that is used for its type only.
Definition: sc_context.h:89
static const T & default_value()
Definition: sc_context.h:300
Template context class; co-routine safe.
Definition: sc_context.h:80
const int SC_DEFAULT_WL_
Definition: sc_fxdefs.h:201
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1005
sc_length_param & operator=(const sc_length_param &)
bool operator!=(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:292
sc_context< sc_length_param > sc_length_context
Template global variable class; singleton; co-routine safe.
Definition: sc_context.h:79
#define SC_CHECK_WL_(wl)
Definition: sc_fxdefs.h:271
SC_API const std::string to_string(sc_enc)
void print(::std::ostream &=::std::cout) const
Length parameter type.
#define SC_API_TEMPLATE_DECL_
Definition: sc_cmnhdr.h:177
friend SC_API bool operator==(const sc_length_param &, const sc_length_param &)
inline ::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
Definition: sc_bit.h:390
#define SC_API
Definition: sc_cmnhdr.h:168