torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::_impl::Copier< class Simulate > Class Template Referenceabstract

#include <Cloning.hpp>

+ Inheritance diagram for torc::generic::_impl::Copier< class Simulate >:
+ Collaboration diagram for torc::generic::_impl::Copier< class Simulate >:

Public Types

typedef Simulate Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

Pointer operator() (const Pointer &inSource, const ObjectFactorySharedPtr &inFactory) throw (Error)
 
void visit (Simulate &inSimulate) throw (Error)
 
 Copier ()
 
 ~Copier () throw ()
 
virtual void visit (_Tp &client)=0 throw (Error)
 

Private Attributes

ObjectFactorySharedPtr mFactory
 
Pointer mReturnVal
 

Detailed Description

template<>
class torc::generic::_impl::Copier< class Simulate >

Definition at line 2498 of file Cloning.hpp.

Member Typedef Documentation

typedef boost::shared_ptr<Type> torc::generic::_impl::Copier< class Simulate >::Pointer

Definition at line 2501 of file Cloning.hpp.

Definition at line 2500 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 2583 of file Cloning.hpp.

2583  : Type::Visitor(), mFactory(), mReturnVal() {
2584  }
torc::generic::_impl::Copier< class Simulate >::~Copier ( )
throw (
)
inline

Definition at line 2586 of file Cloning.hpp.

2586  {
2587  }

Member Function Documentation

Pointer torc::generic::_impl::Copier< class Simulate >::operator() ( const Pointer inSource,
const ObjectFactorySharedPtr inFactory 
)
throw (Error
)
inline

Definition at line 2503 of file Cloning.hpp.

2504  {
2505  mFactory = inFactory;
2506  inSource->accept(*this);
2507  return mReturnVal;
2508  }
template<typename _Tp >
virtual void torc::generic::VisitorType< _Tp >::visit ( _Tp &  client)
throw (Error
)
pure virtualinherited

Visit the target object. This will typically be a derived leaf type.

Parameters
[in,out]clientA reference to the target object
Exceptions
ErrorException generated by any of the functions called from inside visit()

+ Here is the caller graph for this function:

void torc::generic::_impl::Copier< class Simulate >::visit ( Simulate inSimulate)
throw (Error
)
inline

Definition at line 2510 of file Cloning.hpp.

2510  {
2511  try {
2512  SimulateSharedPtr simulatePtr;
2513  mFactory->create(simulatePtr);
2514  simulatePtr->setComments(inSimulate.getComments());
2515 
2516  std::list < std::string > userData;
2517  inSimulate.getUserData(userData);
2518  simulatePtr->setUserData(userData);
2519 
2520  simulatePtr->setName(inSimulate.getName());
2521  simulatePtr->setOriginalName(inSimulate.getOriginalName());
2522 
2523  std::vector<PortListAliasSharedPtr> outPortListAliases;
2524  inSimulate.getPortListAliases(outPortListAliases);
2525  for(std::vector<PortListAliasSharedPtr>::iterator it = outPortListAliases.begin();
2526  it != outPortListAliases.end(); ++it) {
2527  PortListAliasSharedPtr newPortListAlias;
2528  mFactory->create(newPortListAlias);
2529  newPortListAlias->setName((*it)->getName());
2530  PortListSharedPtr clonedPortList = clone((*it)->getPortList(), mFactory);
2531  newPortListAlias->setPortList(clonedPortList);
2532  simulatePtr->addPortListAlias(newPortListAlias);
2533  }
2534 
2535  std::vector<WaveValueSharedPtr> outWaveValues;
2536  inSimulate.getWaveValues(outWaveValues);
2537  for(std::vector<WaveValueSharedPtr>::iterator it = outWaveValues.begin();
2538  it != outWaveValues.end(); ++it) {
2539  WaveValueSharedPtr newWaveValue;
2540  mFactory->create(newWaveValue);
2541  newWaveValue->setName((*it)->getName());
2542  newWaveValue->setDeltaTimeDuration((*it)->getDeltaTimeDuration());
2543  if(NULL != (*it)->getLogicWaveform()) {
2544  LogicElementSharedPtr clonedLogicElem = clone((*it)->getLogicWaveform(),
2545  mFactory);
2546  newWaveValue->setLogicWaveform(clonedLogicElem);
2547  }
2548  simulatePtr->addWaveValue(newWaveValue);
2549  }
2550 
2551  std::vector<ApplySharedPtr> outAllApply;
2552  inSimulate.getAllApply(outAllApply);
2553  for(std::vector<ApplySharedPtr>::iterator it = outAllApply.begin();
2554  it != outAllApply.end(); ++it) {
2555  ApplySharedPtr newApply;
2556  mFactory->create(newApply);
2557  newApply->setComments((*it)->getComments());
2558 
2559  std::list < std::string > userData;
2560  (*it)->getUserData(userData);
2561  newApply->setUserData(userData);
2562 
2563  newApply->setNoOfCycle((*it)->getNoOfCycle());
2564  newApply->setCycleDuration((*it)->getCycleDuration());
2565 
2566  std::list<LogicalResponseSharedPtr> outLogicResponces;
2567  (*it)->getLogicResponses(outLogicResponces);
2568  for(std::list<LogicalResponseSharedPtr>::iterator it = outLogicResponces.begin();
2569  it != outLogicResponces.end(); ++it) {
2570  LogicalResponseSharedPtr clonedLogicalResponse = clone((*it), mFactory);
2571  newApply->addLogicResponse(clonedLogicalResponse);
2572  }
2573  simulatePtr->addApply(newApply);
2574  }
2575 
2576  mReturnVal = simulatePtr;
2577  } catch(Error& e) {
2578  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2579  throw;
2580  }
2581  }
boost::shared_ptr< WaveValue > WaveValueSharedPtr
boost::shared_ptr< LogicElement > LogicElementSharedPtr
boost::shared_ptr< Simulate > SimulateSharedPtr
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< LogicalResponse > LogicalResponseSharedPtr
boost::shared_ptr< PortList > PortListSharedPtr
boost::shared_ptr< Apply > ApplySharedPtr
boost::shared_ptr< PortListAlias > PortListAliasSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 2590 of file Cloning.hpp.

Pointer torc::generic::_impl::Copier< class Simulate >::mReturnVal
private

Definition at line 2591 of file Cloning.hpp.


The documentation for this class was generated from the following file: