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

#include <Cloning.hpp>

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

Public Types

typedef Cell Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

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

Definition at line 333 of file Cloning.hpp.

Member Typedef Documentation

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

Definition at line 336 of file Cloning.hpp.

Definition at line 335 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 396 of file Cloning.hpp.

396  : Type::Visitor(), mFactory(), mReturnVal() {
397  }
torc::generic::_impl::Copier< class Cell >::~Copier ( )
throw (
)
inline

Definition at line 399 of file Cloning.hpp.

399  {
400  }

Member Function Documentation

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

Definition at line 338 of file Cloning.hpp.

339  {
340  mFactory = inFactory;
341  inSource->accept(*this);
342  return mReturnVal;
343  }
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 Cell >::visit ( Cell inCell)
throw (Error
)
inline

Definition at line 345 of file Cloning.hpp.

345  {
346  try {
347  CellSharedPtr cellPtr;
348  mFactory->create(cellPtr);
349  cellPtr->setComments(inCell.getComments());
350 
351  std::list < std::string > userData;
352  inCell.getUserData(userData);
353  cellPtr->setUserData(userData);
354 
355  std::vector<StatusSharedPtr> outStatus;
356  inCell.getStatuses(outStatus);
357  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin();
358  it != outStatus.end(); ++it) {
359  StatusSharedPtr clonedStatus = clone(*it, mFactory);
360  cellPtr->addStatus(clonedStatus);
361  }
362 
363  cellPtr->setIsExtern(inCell.getIsExtern());
364  cellPtr->setName(inCell.getName());
365  cellPtr->setParent(inCell.getParent());
366 
367  std::map<std::string, PropertySharedPtr> outProperties;
368  std::vector<PropertySharedPtr> properties;
369  inCell.getProperties(outProperties);
370  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
371  it != outProperties.end(); ++it) {
372  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
373  properties.push_back(clonedProperty);
374  }
375  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
376  it != properties.end(); ++it) {
377  cellPtr->setProperty((*it)->getName(), *it);
378  }
379 
380  cellPtr->setType(inCell.getType());
381  cellPtr->setOriginalName(inCell.getOriginalName());
382  std::vector<ViewSharedPtr> outViews;
383  inCell.getViews(outViews);
384  std::vector<ViewSharedPtr>::iterator viewIt = outViews.begin();
385  for(; viewIt != outViews.end(); ++viewIt) {
386  ViewSharedPtr newView = clone(*viewIt, mFactory);
387  cellPtr->addView(newView);
388  }
389  mReturnVal = cellPtr;
390  } catch(Error& e) {
391  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
392  throw;
393  }
394  }
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< View > ViewSharedPtr
boost::shared_ptr< Cell > CellSharedPtr
boost::shared_ptr< Property > PropertySharedPtr
boost::shared_ptr< Status > StatusSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 403 of file Cloning.hpp.

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

Definition at line 404 of file Cloning.hpp.


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