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

#include <Cloning.hpp>

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

Public Types

typedef Status Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

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

Definition at line 408 of file Cloning.hpp.

Member Typedef Documentation

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

Definition at line 411 of file Cloning.hpp.

Definition at line 410 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 472 of file Cloning.hpp.

472  : Type::Visitor(), mFactory(), mReturnVal() {
473  }
torc::generic::_impl::Copier< class Status >::~Copier ( )
throw (
)
inline

Definition at line 475 of file Cloning.hpp.

475  {
476  }

Member Function Documentation

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

Definition at line 413 of file Cloning.hpp.

414  {
415  mFactory = inFactory;
416  inSource->accept(*this);
417  return mReturnVal;
418  }
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 Status >::visit ( Status inStatus)
throw (Error
)
inline

Definition at line 420 of file Cloning.hpp.

420  {
421  try {
422  StatusSharedPtr statusPtr;
423  mFactory->create(statusPtr);
424  statusPtr->setComments(inStatus.getComments());
425 
426  std::list < std::string > userData;
427  inStatus.getUserData(userData);
428  statusPtr->setUserData(userData);
429 
430  std::vector<WrittenSharedPtr> outWrittens;
431  inStatus.getWrittens(outWrittens);
432  for(std::vector<WrittenSharedPtr>::iterator it = outWrittens.begin();
433  it != outWrittens.end(); ++it) {
434  WrittenSharedPtr written = *it;
435  WrittenSharedPtr newWritten;
436  mFactory->create(newWritten);
437  newWritten->setComments(written->getComments());
438 
439  std::list < std::string > userData;
440  written->getUserData(userData);
441  newWritten->setUserData(userData);
442 
443  std::map<std::string, PropertySharedPtr> outProperties;
444  std::vector<PropertySharedPtr> properties;
445  written->getProperties(outProperties);
446  for(std::map<std::string, PropertySharedPtr>::iterator it = outProperties.begin();
447  it != outProperties.end(); ++it) {
448  PropertySharedPtr clonedProperty = clone((*it).second, mFactory);
449  properties.push_back(clonedProperty);
450  }
451  for(std::vector<PropertySharedPtr>::iterator it = properties.begin();
452  it != properties.end(); ++it) {
453  newWritten->setProperty((*it)->getName(), *it);
454  }
455 
456  newWritten->setTimeStamp(written->getTimeStamp());
457  newWritten->setAuthorName(written->getAuthorName());
458  newWritten->setProgramName(written->getProgramName());
459  newWritten->setProgramVersion(written->getProgramVersion());
460  newWritten->setDataOriginLocationName(written->getDataOriginLocationName());
461  newWritten->setDataOriginVersion(written->getDataOriginVersion());
462  statusPtr->addWritten(newWritten);
463  }
464 
465  mReturnVal = statusPtr;
466  } catch(Error& e) {
467  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
468  throw;
469  }
470  }
boost::shared_ptr< Written > WrittenSharedPtr
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< Property > PropertySharedPtr
boost::shared_ptr< Status > StatusSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 479 of file Cloning.hpp.

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

Definition at line 480 of file Cloning.hpp.


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