SystemC 3.0.0
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
64namespace sc_dt
65{
66
67// classes defined in this module
68class 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
77// ----------------------------------------------------------------------------
78// CLASS : sc_length_param
79//
80// Length parameter type.
81// ----------------------------------------------------------------------------
82
84{
85public:
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
107private:
108
109 int m_len;
110};
111
112} // namespace sc_dt
113
114// ----------------------------------------------------------------------------
115// TYPEDEF : sc_length_context
116//
117// Context type for the length parameter type.
118// ----------------------------------------------------------------------------
119
120// extern template instantiations
121namespace sc_core {
122SC_API_TEMPLATE_DECL_ sc_phash<void*, const sc_dt::sc_length_param*>;
123} // namespace sc_core
124
125namespace sc_dt {
126
130
131
132// IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
133
134inline
136{
138}
139
140inline
141sc_length_param::sc_length_param( int len_ ) : m_len(len_)
142{
143 SC_CHECK_WL_( len_ );
144}
145
146inline
148 : m_len( a.m_len )
149{}
150
151inline
153 : m_len( SC_DEFAULT_WL_ )
154{}
155
156
157inline
160{
161 if( &a != this )
162 {
163 m_len = a.m_len;
164 }
165 return *this;
166}
167
168
169inline
170bool
172{
173 return ( a.m_len == b.m_len );
174}
175
176inline
177bool
179{
180 return ( a.m_len != b.m_len );
181}
182
183
184inline
185int
187{
188 return m_len;
189}
190
191inline
192void
194{
195 SC_CHECK_WL_( len_ );
196 m_len = len_;
197}
198
199
200inline
201::std::ostream&
202operator << ( ::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!
#define SC_CHECK_WL_(wl)
Definition: sc_fxdefs.h:268
#define SC_API_TEMPLATE_DECL_
Definition: sc_cmnhdr.h:157
#define SC_API
Definition: sc_cmnhdr.h:148
const int SC_DEFAULT_WL_
Definition: sc_fxdefs.h:201
bool operator==(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:285
sc_context< sc_length_param > sc_length_context
bool operator!=(const sc_bit &a, const sc_bit &b)
Definition: sc_bit.h:288
inline::std::ostream & operator<<(::std::ostream &os, const sc_bit &a)
Definition: sc_bit.h:388
uint64 const sc_uint_base int b
Definition: sc_fxval.h:955
template class SC_API sc_context< sc_length_param >
template class SC_API sc_global< sc_length_param >
static const T & default_value()
Definition: sc_context.h:300
sc_length_param & operator=(const sc_length_param &)
const std::string to_string() const
void dump(::std::ostream &=::std::cout) const
void print(::std::ostream &=::std::cout) const