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

#include <Cloning.hpp>

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

Public Types

typedef Permutable Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

Pointer operator() (const Pointer &inSource, const ObjectFactorySharedPtr &inFactory, const ViewSharedPtr &inView) throw (Error)
 
void visit (Permutable &inPermutable) throw (Error)
 
 Copier ()
 
 ~Copier () throw ()
 
virtual void visit (_Tp &client)=0 throw (Error)
 

Private Attributes

ObjectFactorySharedPtr mFactory
 
Pointer mReturnVal
 
ViewSharedPtr mView
 

Detailed Description

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

Definition at line 2285 of file Cloning.hpp.

Member Typedef Documentation

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

Definition at line 2288 of file Cloning.hpp.

Definition at line 2287 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 2349 of file Cloning.hpp.

torc::generic::_impl::Copier< class Permutable >::~Copier ( )
throw (
)
inline

Definition at line 2352 of file Cloning.hpp.

2352  {
2353  }

Member Function Documentation

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

Definition at line 2290 of file Cloning.hpp.

2291  {
2292  mFactory = inFactory;
2293  mView = inView;
2294  inSource->accept(*this);
2295  return mReturnVal;
2296  }
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 Permutable >::visit ( Permutable inPermutable)
throw (Error
)
inline

Definition at line 2298 of file Cloning.hpp.

2298  {
2299  try {
2300  PermutableSharedPtr permutablePtr;
2301  mFactory->create(permutablePtr);
2302  permutablePtr->setPermutableType(inPermutable.getPermutableType());
2303  permutablePtr->setIsNonPermutable(inPermutable.getIsNonPermutable());
2304 
2305  std::vector<PortSharedPtr> outPorts;
2306  inPermutable.getPorts(outPorts);
2307  std::vector<PortSharedPtr>::iterator portIt = outPorts.begin();
2308  for(; portIt != outPorts.end(); ++portIt) {
2309  PortSharedPtr actualPort = *portIt;
2310  PortSharedPtr port = actualPort;
2311  std::vector < std::string > nestedNames;
2312  while(port) {
2313  if(eCompositionTypeVectorBit != port->getCompositionType())
2314  nestedNames.push_back(port->getName());
2315  port = port->getParentCollection();
2316  }
2317  std::string portName = *nestedNames.rbegin();
2318  PortSharedPtr targetPort = mView->findPort(portName);
2319  if(nestedNames.size() > 1) {
2320  findLeafConnectable(nestedNames, targetPort);
2321  }
2322  std::vector < size_t > indices;
2323  if(eCompositionTypeVectorBit == actualPort->getCompositionType()) {
2324  targetPort = targetPort->get(IndexFinder<Port, VectorPortBit>()(actualPort));
2325  indices = IndexFinder<Port, VectorNetBit>()(actualPort);
2326  }
2327  if(!indices.empty()) {
2328  targetPort = targetPort->get(indices);
2329  }
2330  permutablePtr->addPort(targetPort);
2331  }
2332 
2333  std::vector<PermutableSharedPtr> outPermutables;
2334  inPermutable.getChildren(outPermutables);
2335  for(std::vector<PermutableSharedPtr>::iterator it = outPermutables.begin();
2336  it != outPermutables.end(); ++it) {
2337  PermutableSharedPtr childPermutable = clonePermutable(*it, mFactory, mView);
2338  permutablePtr->addChildPermutable(childPermutable);
2339  }
2340 
2341  mReturnVal = permutablePtr;
2342  } catch(Error& e) {
2343  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
2344  throw;
2345  }
2346 
2347  }
void findLeafConnectable(std::vector< std::string > &nestedNames, boost::shared_ptr< _Connectable > &conn)
boost::shared_ptr< Permutable > PermutableSharedPtr
boost::shared_ptr< _Tp > clonePermutable(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory, const ViewSharedPtr &inView)
Definition: Cloning.hpp:84
std::string string
boost::shared_ptr< Port > PortSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 2356 of file Cloning.hpp.

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

Definition at line 2357 of file Cloning.hpp.

Definition at line 2358 of file Cloning.hpp.


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