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

#include <Cloning.hpp>

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

Public Types

typedef Root Type
 
typedef boost::shared_ptr< TypePointer
 

Public Member Functions

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

Definition at line 124 of file Cloning.hpp.

Member Typedef Documentation

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

Definition at line 127 of file Cloning.hpp.

Definition at line 126 of file Cloning.hpp.

Constructor & Destructor Documentation

Definition at line 178 of file Cloning.hpp.

178  : Type::Visitor(), mFactory(), mReturnVal() {
179  }
torc::generic::_impl::Copier< class Root >::~Copier ( )
throw (
)
inline

Definition at line 181 of file Cloning.hpp.

181  {
182  }

Member Function Documentation

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

Definition at line 129 of file Cloning.hpp.

130  {
131  mFactory = inFactory;
132  inSource->accept(*this);
133  return mReturnVal;
134  }
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 Root >::visit ( Root inRoot)
throw (Error
)
inline

Definition at line 136 of file Cloning.hpp.

136  {
137  try {
138  RootSharedPtr rootPtr;
139  mFactory->create(rootPtr);
140 
141  rootPtr->setComments(inRoot.getComments());
142  rootPtr->setName(inRoot.getName());
143  rootPtr->setOriginalName(inRoot.getOriginalName());
144  rootPtr->setLevel(inRoot.getLevel());
145  rootPtr->setVersion(inRoot.getVersion());
146 
147  std::vector<StatusSharedPtr> outStatus;
148  inRoot.getStatuses(outStatus);
149  for(std::vector<StatusSharedPtr>::iterator it = outStatus.begin();
150  it != outStatus.end(); ++it) {
151  StatusSharedPtr clonedStatus = clone(*it, mFactory);
152  rootPtr->addStatus(clonedStatus);
153  }
154 
155  std::vector<LibrarySharedPtr> libraries;
156  inRoot.getLibraries(libraries);
157  std::vector<LibrarySharedPtr>::iterator libIt = libraries.begin();
158  for(; libIt != libraries.end(); ++libIt) {
159  LibrarySharedPtr newLib = clone(*libIt, mFactory);
160  rootPtr->addLibrary(newLib);
161  }
162 
163  std::vector<DesignSharedPtr> outDesigns;
164  inRoot.getDesigns(outDesigns);
165  for(std::vector<DesignSharedPtr>::iterator it = outDesigns.begin();
166  it != outDesigns.end(); ++it) {
167  DesignSharedPtr newDesign = clone(*it, mFactory);
168  rootPtr->addDesign(newDesign);
169  }
170 
171  mReturnVal = rootPtr;
172  } catch(Error& e) {
173  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
174  throw;
175  }
176  }
boost::shared_ptr< Design > DesignSharedPtr
boost::shared_ptr< _Tp > clone(const boost::shared_ptr< _Tp > &inPointer, const ObjectFactorySharedPtr &inFactory)
Definition: Cloning.hpp:63
boost::shared_ptr< Library > LibrarySharedPtr
boost::shared_ptr< Status > StatusSharedPtr
boost::shared_ptr< Root > RootSharedPtr

+ Here is the call graph for this function:

Field Documentation

Definition at line 185 of file Cloning.hpp.

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

Definition at line 186 of file Cloning.hpp.


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