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_fxcast_switch.h - 00021 00022 Original Author: Martin Janssen, Synopsys, Inc. 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_FXCAST_SWITCH_H 00037 #define SC_FXCAST_SWITCH_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_fxcast_switch; 00048 00049 00050 // ---------------------------------------------------------------------------- 00051 // CLASS : sc_fxcast_switch 00052 // 00053 // Fixed-point cast switch class. 00054 // ---------------------------------------------------------------------------- 00055 00056 class sc_fxcast_switch 00057 { 00058 00059 public: 00060 00061 sc_fxcast_switch(); 00062 sc_fxcast_switch( sc_switch ); 00063 sc_fxcast_switch( const sc_fxcast_switch& ); 00064 explicit sc_fxcast_switch( sc_without_context ); 00065 00066 sc_fxcast_switch& operator = ( const sc_fxcast_switch& ); 00067 00068 friend bool operator == ( const sc_fxcast_switch&, 00069 const sc_fxcast_switch& ); 00070 friend bool operator != ( const sc_fxcast_switch&, 00071 const sc_fxcast_switch& ); 00072 00073 const sc_string to_string() const; 00074 00075 void print( ostream& = cout ) const; 00076 void dump( ostream& = cout ) const; 00077 00078 private: 00079 00080 sc_switch m_sw; 00081 00082 }; 00083 00084 00085 // ---------------------------------------------------------------------------- 00086 // TYPEDEF : sc_fxcast_context 00087 // 00088 // Context type for the fixed-point cast switch parameter. 00089 // ---------------------------------------------------------------------------- 00090 00091 typedef sc_context<sc_fxcast_switch> sc_fxcast_context; 00092 00093 00094 // IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII 00095 00096 inline 00097 sc_fxcast_switch::sc_fxcast_switch() 00098 { 00099 *this = sc_fxcast_context::default_value(); 00100 } 00101 00102 inline 00103 sc_fxcast_switch::sc_fxcast_switch( sc_switch sw_ ) 00104 : m_sw( sw_ ) 00105 {} 00106 00107 inline 00108 sc_fxcast_switch::sc_fxcast_switch( const sc_fxcast_switch& a ) 00109 : m_sw( a.m_sw ) 00110 {} 00111 00112 inline 00113 sc_fxcast_switch::sc_fxcast_switch( sc_without_context ) 00114 : m_sw( SC_DEFAULT_CAST_SWITCH_ ) 00115 {} 00116 00117 00118 inline 00119 sc_fxcast_switch& 00120 sc_fxcast_switch::operator = ( const sc_fxcast_switch& a ) 00121 { 00122 if( &a != this ) 00123 { 00124 m_sw = a.m_sw; 00125 } 00126 return *this; 00127 } 00128 00129 00130 inline 00131 bool 00132 operator == ( const sc_fxcast_switch& a, const sc_fxcast_switch& b ) 00133 { 00134 return ( a.m_sw == b.m_sw ); 00135 } 00136 00137 00138 inline 00139 bool 00140 operator != ( const sc_fxcast_switch& a, const sc_fxcast_switch& b ) 00141 { 00142 return ( a.m_sw != b.m_sw ); 00143 } 00144 00145 00146 inline 00147 ostream& 00148 operator << ( ostream& os, const sc_fxcast_switch& a ) 00149 { 00150 a.print( os ); 00151 return os; 00152 } 00153 00154 } // namespace sc_dt 00155 00156 00157 #endif 00158 00159 // Taf!
1.2.18