SystemC  Recoding Infrastructure for SystemC v0.6.3 derived from Accellera SystemC 2.3.1
Accellera SystemC proof-of-concept library
sc_length_param.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3  The following code is derived, directly or indirectly, from the SystemC
4  source code Copyright (c) 1996-2014 by all Contributors.
5  All Rights reserved.
6 
7  The contents of this file are subject to the restrictions and limitations
8  set forth in the SystemC Open Source License (the "License");
9  You may not use this file except in compliance with such restrictions and
10  limitations. You may obtain instructions on how to receive a copy of the
11  License at http://www.accellera.org/. Software distributed by Contributors
12  under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF
13  ANY KIND, either express or implied. See the License for the specific
14  language governing rights and limitations under the License.
15 
16  *****************************************************************************/
17 
18 /*****************************************************************************
19 
20  sc_length_param.h -
21 
22  Original Author: Martin Janssen, Synopsys, Inc., 2002-03-19
23 
24  *****************************************************************************/
25 
26 /*****************************************************************************
27 
28  MODIFICATION LOG - modifiers, enter your name, affiliation, date and
29  changes you are making here.
30 
31  Name, Affiliation, Date:
32  Description of Modification:
33 
34  *****************************************************************************/
35 
36 // $Log: sc_length_param.h,v $
37 // Revision 1.3 2011/08/24 22:05:46 acg
38 // Torsten Maehne: initialization changes to remove warnings.
39 //
40 // Revision 1.2 2011/02/18 20:19:15 acg
41 // Andy Goodrich: updating Copyright notice.
42 //
43 // Revision 1.1.1.1 2006/12/15 20:20:05 acg
44 // SystemC 2.3
45 //
46 // Revision 1.4 2006/05/08 17:50:01 acg
47 // Andy Goodrich: Added David Long's declarations for friend operators,
48 // functions, and methods, to keep the Microsoft compiler happy.
49 //
50 // Revision 1.3 2006/01/13 18:49:32 acg
51 // Added $Log command so that CVS check in comments are reproduced in the
52 // source.
53 //
54 
55 #ifndef SC_LENGTH_PARAM_H
56 #define SC_LENGTH_PARAM_H
57 
58 
60 
61 
62 namespace sc_dt
63 {
64 
65 // classes defined in this module
66 class sc_length_param;
67 
68 // friend operator declarations
69  bool operator == ( const sc_length_param&,
70  const sc_length_param& );
71  bool operator != ( const sc_length_param&,
72  const sc_length_param& );
73 
74 
75 // ----------------------------------------------------------------------------
76 // CLASS : sc_length_param
77 //
78 // Length parameter type.
79 // ----------------------------------------------------------------------------
80 
82 {
83 public:
84 
86  sc_length_param( int );
89 
91 
92  friend bool operator == ( const sc_length_param&,
93  const sc_length_param& );
94  friend bool operator != ( const sc_length_param&,
95  const sc_length_param& );
96 
97  int len() const;
98  void len( int );
99 
100  const std::string to_string() const;
101 
102  void print( ::std::ostream& = ::std::cout ) const;
103  void dump( ::std::ostream& = ::std::cout ) const;
104 
105 private:
106 
107  int m_len;
108 };
109 
110 
111 // ----------------------------------------------------------------------------
112 // TYPEDEF : sc_length_context
113 //
114 // Context type for the length parameter type.
115 // ----------------------------------------------------------------------------
116 
118 
119 
120 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
121 
122 inline
124 {
126 }
127 
128 inline
129 sc_length_param::sc_length_param( int len_ ) : m_len(len_)
130 {
131  SC_CHECK_WL_( len_ );
132 }
133 
134 inline
136  : m_len( a.m_len )
137 {}
138 
139 inline
141  : m_len( SC_DEFAULT_WL_ )
142 {}
143 
144 
145 inline
148 {
149  if( &a != this )
150  {
151  m_len = a.m_len;
152  }
153  return *this;
154 }
155 
156 
157 inline
158 bool
160 {
161  return ( a.m_len == b.m_len );
162 }
163 
164 inline
165 bool
167 {
168  return ( a.m_len != b.m_len );
169 }
170 
171 
172 inline
173 int
175 {
176  return m_len;
177 }
178 
179 inline
180 void
182 {
183  SC_CHECK_WL_( len_ );
184  m_len = len_;
185 }
186 
187 
188 inline
189 ::std::ostream&
190 operator << ( ::std::ostream& os, const sc_length_param& a )
191 {
192  a.print( os );
193  return os;
194 }
195 
196 } // namespace sc_dt
197 
198 
199 #endif
200 
201 // Taf!
friend bool operator!=(const sc_length_param &, const sc_length_param &)
sc_length_param & operator=(const sc_length_param &)
void print(::std::ostream &=::std::cout) const
void dump(::std::ostream &=::std::cout) const
const int SC_DEFAULT_WL_
Definition: sc_fxdefs.h:198
static const T & default_value()
Definition: sc_context.h:296
uint64 const sc_uint_base int b
Definition: sc_fxval.h:1003
bool operator!=(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:286
bool operator==(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:283
#define SC_CHECK_WL_(wl)
Definition: sc_fxdefs.h:264
friend bool operator==(const sc_length_param &, const sc_length_param &)
const std::string to_string() const
sc_context< sc_length_param > sc_length_context
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
Definition: sc_bit.h:386