00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "torc/generic/om/LogicValueAttributes.hpp"
00017 #include <iostream>
00018
00019 namespace torc {
00020
00021 namespace generic {
00022
00023
00024
00025
00026
00027
00028
00029 void
00030 LogicValueAttributes::setStrongLogicValue(const LogicValueSharedPtr & inSource) throw() {
00031 mStrong = inSource;
00032 }
00033
00034
00035
00036
00037
00038
00039
00040 void
00041 LogicValueAttributes::setWeakLogicValue(const LogicValueSharedPtr & inSource) throw() {
00042 mWeak = inSource;
00043 }
00044
00045
00046
00047
00048
00049
00050 void
00051 LogicValueAttributes::setVoltageMap(const Value::MiNoMax & value) throw() {
00052 mVoltageMap = value;
00053 mIsVoltageMapSet = true;
00054 }
00055
00056
00057
00058
00059
00060
00061 void
00062 LogicValueAttributes::setCurrentMap(const Value::MiNoMax & value) throw() {
00063 mCurrentMap = value;
00064 mIsCurrentMapSet = true;
00065 }
00066
00067
00068
00069
00070
00071
00072 void
00073 LogicValueAttributes::setBooleanMap(const Value::Boolean & value) throw() {
00074 mBooleanMap = value;
00075 mIsBooleanMapSet = true;
00076 }
00077
00078
00079
00080
00081
00082
00083 void
00084 LogicValueAttributes::setCompoundLogicValues(
00085 const std::list< LogicValueSharedPtr > & inSource) throw(Error) {
00086 std::list< LogicValueSharedPtr >::const_iterator it = inSource.begin();
00087 for(; it != inSource.end(); it++ )
00088 {
00089 try
00090 {
00091 mCompounds.push_back( *it );
00092 }
00093 catch( Error &e )
00094 {
00095 e.setCurrentLocation(
00096 __FUNCTION__, __FILE__, __LINE__ );
00097 throw;
00098 }
00099 }
00100 }
00101
00102
00103
00104
00105
00106
00107 void
00108 LogicValueAttributes::setDominatedLogicValues(
00109 const std::list< LogicValueSharedPtr > & inSource) throw(Error) {
00110 std::list< LogicValueSharedPtr >::const_iterator it = inSource.begin();
00111 for(; it != inSource.end(); it++ )
00112 {
00113 try
00114 {
00115 mDominates.push_back( *it );
00116 }
00117 catch( Error &e )
00118 {
00119 e.setCurrentLocation(
00120 __FUNCTION__, __FILE__, __LINE__ );
00121 throw;
00122 }
00123 }
00124 }
00125
00126
00127
00128
00129
00130
00131 void
00132 LogicValueAttributes::setIsIsolated(const bool & inSource) throw() {
00133 mIsIsolated = inSource;
00134 }
00135
00136
00137
00138
00139
00140
00141 void
00142 LogicValueAttributes::setLogicMaps(const std::list< LogicMap* > & inSource) throw() {
00143 std::list< LogicMap* >::const_iterator it = inSource.begin();
00144 for(; it != inSource.end(); it++ )
00145 {
00146 try
00147 {
00148 mLogicMaps.push_back( *it );
00149 }
00150 catch( Error &e )
00151 {
00152 e.setCurrentLocation(
00153 __FUNCTION__, __FILE__, __LINE__ );
00154 throw;
00155 }
00156 }
00157 }
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167 void
00168 LogicValueAttributes::addLogicMap(LogicMap* & inLogicMap) throw(Error) {
00169 if( !inLogicMap )
00170 {
00171 return;
00172 }
00173 mLogicMaps.push_back( inLogicMap );
00174 }
00175
00176
00177
00178
00179
00180
00181 void
00182 LogicValueAttributes::setResolvedLogicValues(
00183 const std::list< LogicValueSharedPtr > & inSource) throw() {
00184 std::list< LogicValueSharedPtr >::const_iterator it = inSource.begin();
00185 for(; it != inSource.end(); it++ )
00186 {
00187 try
00188 {
00189 mResolves.push_back( *it );
00190 }
00191 catch( Error &e )
00192 {
00193 e.setCurrentLocation(
00194 __FUNCTION__, __FILE__, __LINE__ );
00195 throw;
00196 }
00197 }
00198 }
00199
00200 LogicValueAttributes::LogicValueAttributes()
00201 : mVoltageMap(),
00202 mIsVoltageMapSet( false ),
00203 mCurrentMap(),
00204 mIsCurrentMapSet( false ),
00205 mBooleanMap(),
00206 mIsBooleanMapSet( false ),
00207 mCompounds(),
00208 mWeak(),
00209 mStrong(),
00210 mDominates(),
00211 mLogicMaps(),
00212 mIsIsolated( false ),
00213 mResolves()
00214 {
00215 }
00216
00217 LogicValueAttributes::~LogicValueAttributes() throw() {
00218 std::list< LogicMap *>::iterator it = mLogicMaps.begin();
00219 for(; it != mLogicMaps.end(); it++ )
00220 {
00221 if(*it)
00222 {
00223 delete *it;
00224 *it = NULL;
00225 }
00226 }
00227 }
00228
00229 LogicValueAttributes::LogicValueAttributes(const LogicValueAttributes & source)
00230 : mVoltageMap( source.mVoltageMap ),
00231 mIsVoltageMapSet( source.mIsVoltageMapSet ),
00232 mCurrentMap( source.mCurrentMap ),
00233 mIsCurrentMapSet( source.mIsCurrentMapSet ),
00234 mBooleanMap( source.mBooleanMap ),
00235 mIsBooleanMapSet( source.mIsBooleanMapSet ),
00236 mCompounds( source.mCompounds ),
00237 mWeak( source.mWeak ),
00238 mStrong( source.mStrong ),
00239 mDominates( source.mDominates ),
00240 mLogicMaps( source.mLogicMaps ),
00241 mIsIsolated( source.mIsIsolated ),
00242 mResolves( source.mResolves )
00243 {
00244 }
00245
00246 LogicValueAttributes &
00247 LogicValueAttributes::operator=(
00248 const LogicValueAttributes & source) throw() {
00249 if( this != &source )
00250 {
00251 mVoltageMap = source.mVoltageMap;
00252 mIsVoltageMapSet = source.mIsVoltageMapSet;
00253 mCurrentMap = source.mCurrentMap;
00254 mIsCurrentMapSet = source.mIsCurrentMapSet;
00255 mBooleanMap = source.mBooleanMap;
00256 mIsBooleanMapSet = source.mIsBooleanMapSet;
00257 mCompounds = source.mCompounds;
00258 mWeak = source.mWeak;
00259 mStrong = source.mStrong;
00260 mDominates = source.mDominates;
00261 mLogicMaps = source.mLogicMaps;
00262 mIsIsolated = source.mIsIsolated;
00263 mResolves = source.mResolves;
00264 }
00265 return *this;
00266 }
00267
00268 }
00269
00270 }