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

#include <Cloning.hpp>

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

Public Types

typedef Event Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

Pointer operator() (const Pointer &inSource, const ObjectFactorySharedPtr &inFactory) throw (Error)
 
void visit (Event &inEvent) 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 Event >

Definition at line 2780 of file Cloning.hpp.

Member Typedef Documentation

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

Definition at line 2783 of file Cloning.hpp.

Definition at line 2782 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 2847 of file Cloning.hpp.

2847  : Type::Visitor(), mFactory(), mReturnVal() {
2848  }
torc::generic::_impl::Copier< class Event >::~Copier ( )
throw (
)
inline

Definition at line 2850 of file Cloning.hpp.

2850  {
2851  }

Member Function Documentation

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

Definition at line 2785 of file Cloning.hpp.

2786  {
2787  mFactory = inFactory;
2788  inSource->accept(*this);
2789  return mReturnVal;
2790  }
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 Event >::visit ( Event inEvent)
throw (Error
)
inline

Definition at line 2792 of file Cloning.hpp.

2792  {
2793  try {
2794  EventSharedPtr eventPtr;
2795  mFactory->create(eventPtr);
2796  eventPtr->setType(inEvent.getType());
2797  if(Event::eTypeOffsetEvent == inEvent.getType()) {
2798  eventPtr->setOffsetTime(inEvent.getOffsetTime());
2799  }
2800 
2801  std::list<PortElement> outPortElements;
2802  inEvent.getPortElements(outPortElements);
2803  std::list<PortElement>::iterator portElem = outPortElements.begin();
2804  std::list<PortElement>::iterator end = outPortElements.end();
2805  for(; portElem != end; ++portElem) {
2806  switch((*portElem).getType()) {
2808  PortSharedPtr newPort = clone((*portElem).getPort(), mFactory);
2809  eventPtr->addPort(newPort);
2810  break;
2811  }
2813  PortReferenceSharedPtr clonedRef = clone((*portElem).getPortReference(),
2814  mFactory);
2815  eventPtr->addPortReference(clonedRef);
2816  break;
2817  }
2818  }
2819  }
2820 
2821  if(NULL != inEvent.getPortList()) {
2822  PortListSharedPtr clonedPortList = clone(inEvent.getPortList(), mFactory);
2823  eventPtr->setPortList(clonedPortList);
2824  }
2825 
2826  std::list<NetSharedPtr> outNets;
2827  inEvent.getNets(outNets);
2828  std::list<NetSharedPtr>::iterator netIt = outNets.begin();
2829 
2830  for(; netIt != outNets.end(); ++netIt) {
2831  NetSharedPtr netPtr = clone(*netIt, mFactory);
2832  eventPtr->addNet(netPtr);
2833  }
2834 
2835  if(NULL != inEvent.getTransition()) {
2836  LogicElementSharedPtr clonedLogicElem = clone(inEvent.getTransition(), mFactory);
2837  eventPtr->setTransition(clonedLogicElem);
2838  }
2839 
2840  mReturnVal = eventPtr;
2841  } catch(Error& e) {
2842  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2843  throw;
2844  }
2845  }
boost::shared_ptr< LogicElement > LogicElementSharedPtr
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< Net > NetSharedPtr
boost::shared_ptr< PortReference > PortReferenceSharedPtr
boost::shared_ptr< PortList > PortListSharedPtr
boost::shared_ptr< Event > EventSharedPtr
boost::shared_ptr< Port > PortSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 2854 of file Cloning.hpp.

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

Definition at line 2855 of file Cloning.hpp.


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