00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "torc/generic/om/Apply.hpp"
00017 #include "torc/generic/om/LogicalResponse.hpp"
00018 #include "torc/generic/om/Simulate.hpp"
00019
00020 namespace torc {
00021
00022 namespace generic {
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 ApplySharedPtr
00036 Apply::Factory::newApplyPtr( const int32_t & inNoOfCycle,
00037 const Value & inCycleDuration,
00038 const std::list< LogicalResponseSharedPtr > & inLogicResponces,
00039 const SimulateSharedPtr & inSimulate ) throw(Error) {
00040 try
00041 {
00042 ApplySharedPtr newApply;
00043 create( newApply );
00044 newApply->setNoOfCycle( inNoOfCycle );
00045 newApply->setCycleDuration( inCycleDuration );
00046 newApply->setLogicResponses( inLogicResponces );
00047 if( inSimulate )
00048 {
00049 inSimulate->addApply( newApply );
00050 }
00051 return newApply;
00052 }
00053 catch( Error &e )
00054 {
00055 e.setCurrentLocation(
00056 __FUNCTION__, __FILE__, __LINE__ );
00057 throw;
00058 }
00059 }
00060
00061 void
00062 Apply::accept(BaseVisitor & inoutVisitor) throw(Error) {
00063 try
00064 {
00065 runVisitor( *this, inoutVisitor );
00066 }
00067 catch( Error &e )
00068 {
00069 e.setCurrentLocation(
00070 __FUNCTION__, __FILE__, __LINE__ );
00071 throw;
00072 }
00073 }
00074
00075
00076
00077
00078
00079 void
00080 Apply::setNoOfCycle( const int32_t & inValue ) throw() {
00081 mNoOfCycle = inValue;
00082 }
00083
00084
00085
00086
00087
00088 void
00089 Apply::setCycleDuration(const Value & value) throw() {
00090 mCycleDuration = value;
00091 }
00092
00093
00094
00095
00096
00097
00098 void
00099 Apply::setLogicResponses(
00100 const std::list< LogicalResponseSharedPtr > & inLogicResponces ) throw() {
00101 std::list< LogicalResponseSharedPtr >::const_iterator
00102 logicalResponse = inLogicResponces.begin();
00103 std::list< LogicalResponseSharedPtr >::const_iterator end = inLogicResponces.end();
00104 for( ; logicalResponse != end; logicalResponse++ )
00105 {
00106 try
00107 {
00108 addLogicResponse( *logicalResponse );
00109 }
00110 catch( Error &e )
00111 {
00112 e.setCurrentLocation(
00113 __FUNCTION__, __FILE__, __LINE__ );
00114 throw;
00115 }
00116 }
00117 }
00118
00119
00120
00121
00122
00123
00124 void
00125 Apply::addLogicResponse(
00126 const LogicalResponseSharedPtr & inLogicResponce ) throw() {
00127 try
00128 {
00129 mLogicResponses.push_back( inLogicResponce );
00130 }
00131 catch( Error &e )
00132 {
00133 e.setCurrentLocation(
00134 __FUNCTION__, __FILE__, __LINE__ );
00135 throw;
00136 }
00137 }
00138
00139 Apply::Apply()
00140 : Commentable(),
00141 Visitable(),
00142 SelfReferencing<Apply>(),
00143 UserDataContainer(),
00144 mNoOfCycle(0),
00145 mCycleDuration(),
00146 mLogicResponses() {
00147 }
00148
00149 Apply::~Apply() throw() {
00150 }
00151
00152 }
00153
00154 }