00001 /***************************************************************************** 00002 00003 The following code is derived, directly or indirectly, from the SystemC 00004 source code Copyright (c) 1996-2004 by all Contributors. 00005 All Rights reserved. 00006 00007 The contents of this file are subject to the restrictions and limitations 00008 set forth in the SystemC Open Source License Version 2.3 (the "License"); 00009 You may not use this file except in compliance with such restrictions and 00010 limitations. You may obtain instructions on how to receive a copy of the 00011 License at http://www.systemc.org/. Software distributed by Contributors 00012 under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 00013 ANY KIND, either express or implied. See the License for the specific 00014 language governing rights and limitations under the License. 00015 00016 *****************************************************************************/ 00017 00018 /***************************************************************************** 00019 00020 sc_length_param.h - 00021 00022 Original Author: Martin Janssen, Synopsys, Inc., 2002-03-19 00023 00024 *****************************************************************************/ 00025 00026 /***************************************************************************** 00027 00028 MODIFICATION LOG - modifiers, enter your name, affiliation, date and 00029 changes you are making here. 00030 00031 Name, Affiliation, Date: 00032 Description of Modification: 00033 00034 *****************************************************************************/ 00035 00036 #ifndef SC_LENGTH_PARAM_H 00037 #define SC_LENGTH_PARAM_H 00038 00039 00040 #include "systemc/datatypes/fx/sc_context.h" 00041 00042 00043 namespace sc_dt 00044 { 00045 00046 // classes defined in this module 00047 class sc_length_param; 00048 00049 00050 // ---------------------------------------------------------------------------- 00051 // CLASS : sc_length_param 00052 // 00053 // Length parameter type. 00054 // ---------------------------------------------------------------------------- 00055 00056 class sc_length_param 00057 { 00058 public: 00059 00060 sc_length_param(); 00061 sc_length_param( int ); 00062 sc_length_param( const sc_length_param& ); 00063 explicit sc_length_param( sc_without_context ); 00064 00065 sc_length_param& operator = ( const sc_length_param& ); 00066 00067 friend bool operator == ( const sc_length_param&, 00068 const sc_length_param& ); 00069 friend bool operator != ( const sc_length_param&, 00070 const sc_length_param& ); 00071 00072 int len() const; 00073 void len( int ); 00074 00075 const sc_string to_string() const; 00076 00077 void print( ostream& = cout ) const; 00078 void dump( ostream& = cout ) const; 00079 00080 private: 00081 00082 int m_len; 00083 }; 00084 00085 00086 // ---------------------------------------------------------------------------- 00087 // TYPEDEF : sc_length_context 00088 // 00089 // Context type for the length parameter type. 00090 // ---------------------------------------------------------------------------- 00091 00092 typedef sc_context<sc_length_param> sc_length_context; 00093 00094 00095 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 00096 00097 inline 00098 sc_length_param::sc_length_param() 00099 { 00100 *this = sc_length_context::default_value(); 00101 } 00102 00103 inline 00104 sc_length_param::sc_length_param( int len_ ) 00105 { 00106 SC_CHECK_WL_( len_ ); 00107 m_len = len_; 00108 } 00109 00110 inline 00111 sc_length_param::sc_length_param( const sc_length_param& a ) 00112 : m_len( a.m_len ) 00113 {} 00114 00115 inline 00116 sc_length_param::sc_length_param( sc_without_context ) 00117 : m_len( SC_DEFAULT_WL_ ) 00118 {} 00119 00120 00121 inline 00122 sc_length_param& 00123 sc_length_param::operator = ( const sc_length_param& a ) 00124 { 00125 if( &a != this ) 00126 { 00127 m_len = a.m_len; 00128 } 00129 return *this; 00130 } 00131 00132 00133 inline 00134 bool 00135 operator == ( const sc_length_param& a, const sc_length_param& b ) 00136 { 00137 return ( a.m_len == b.m_len ); 00138 } 00139 00140 inline 00141 bool 00142 operator != ( const sc_length_param& a, const sc_length_param& b ) 00143 { 00144 return ( a.m_len != b.m_len ); 00145 } 00146 00147 00148 inline 00149 int 00150 sc_length_param::len() const 00151 { 00152 return m_len; 00153 } 00154 00155 inline 00156 void 00157 sc_length_param::len( int len_ ) 00158 { 00159 SC_CHECK_WL_( len_ ); 00160 m_len = len_; 00161 } 00162 00163 00164 inline 00165 ostream& 00166 operator << ( ostream& os, const sc_length_param& a ) 00167 { 00168 a.print( os ); 00169 return os; 00170 } 00171 00172 } // namespace sc_dt 00173 00174 00175 #endif 00176 00177 // Taf!
1.2.18