torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::PortRefCreator< _ReturnType > Class Template Referenceabstract

Create port reference. More...

#include <PortRefCreator.hpp>

+ Inheritance diagram for torc::generic::PortRefCreator< _ReturnType >:
+ Collaboration diagram for torc::generic::PortRefCreator< _ReturnType >:

Public Member Functions

void visit (ScalarPort &port) throw (Error)
 
void visit (VectorPort &port) throw (Error)
 
void visit (PortBundle &port) throw (Error)
 
_ReturnType getReturnValue () const
 
 PortRefCreator (const ObjectFactorySharedPtr &inFactory, const InstanceSharedPtr &inInstance, const PortBundleReferenceSharedPtr &inBundle=PortBundleReferenceSharedPtr())
 
 ~PortRefCreator () throw ()
 
virtual void visit (_Tp &client)=0 throw (Error)
 

Private Member Functions

void setupCreatedPort (const PortSharedPtr &port, const PortReferenceSharedPtr &inPortRef) throw (Error)
 

Private Attributes

ObjectFactorySharedPtr mFactory
 
InstanceSharedPtr mInstance
 
PortBundleReferenceSharedPtr mBundle
 
_ReturnType mReturnValue
 

Detailed Description

template<typename _ReturnType>
class torc::generic::PortRefCreator< _ReturnType >

Create port reference.

The PortRefCreator class is used to create scalar, vector and bundle port reference

Definition at line 37 of file PortRefCreator.hpp.

Constructor & Destructor Documentation

template<typename _ReturnType >
torc::generic::PortRefCreator< _ReturnType >::PortRefCreator ( const ObjectFactorySharedPtr inFactory,
const InstanceSharedPtr inInstance,
const PortBundleReferenceSharedPtr inBundle = PortBundleReferenceSharedPtr() 
)

Definition at line 110 of file PortRefCreator.hpp.

112  :
113  mFactory(inFactory), mInstance(inInstance), mBundle(inBundle), mReturnValue() {}
ObjectFactorySharedPtr mFactory
PortBundleReferenceSharedPtr mBundle
template<typename _ReturnType >
torc::generic::PortRefCreator< _ReturnType >::~PortRefCreator ( )
throw (
)

Definition at line 115 of file PortRefCreator.hpp.

115 {}

Member Function Documentation

template<typename _ReturnType >
_ReturnType torc::generic::PortRefCreator< _ReturnType >::getReturnValue ( ) const
inline

Definition at line 105 of file PortRefCreator.hpp.

106  {
107  return mReturnValue;
108 }

+ Here is the caller graph for this function:

template<typename _ReturnType >
void torc::generic::PortRefCreator< _ReturnType >::setupCreatedPort ( const PortSharedPtr port,
const PortReferenceSharedPtr inPortRef 
)
throw (Error
)
private

Definition at line 117 of file PortRefCreator.hpp.

118  {
119  try {
120  inPortRef->bindToMasterPort(port);
121  if(mBundle) {
122  inPortRef->setParentCollection(mBundle);
123  mBundle->addChild(inPortRef);
124  } else {
125  inPortRef->setParent(mInstance);
126  mInstance->addPortReference(inPortRef);
127  }
128  } catch(Error& e) {
129  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
130  throw;
131  }
132 }
PortBundleReferenceSharedPtr mBundle

+ Here is the call graph for this function:

template<typename _ReturnType >
void torc::generic::PortRefCreator< _ReturnType >::visit ( ScalarPort port)
throw (Error
)

Definition at line 62 of file PortRefCreator.hpp.

63  {
64  try {
65  ScalarPortReferenceSharedPtr scalarPortRef;
66  mFactory->create(scalarPortRef);
67  setupCreatedPort(port.getSharedThis(), scalarPortRef);
68  } catch(Error& e) {
69  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
70  throw;
71  }
72 }
void setupCreatedPort(const PortSharedPtr &port, const PortReferenceSharedPtr &inPortRef)
boost::shared_ptr< ScalarPortReference > ScalarPortReferenceSharedPtr
ObjectFactorySharedPtr mFactory

+ Here is the call graph for this function:

template<typename _ReturnType >
void torc::generic::PortRefCreator< _ReturnType >::visit ( VectorPort port)
throw (Error
)

Definition at line 74 of file PortRefCreator.hpp.

75  {
76  try {
77  VectorPortReferenceSharedPtr vectorPortRef;
78  mFactory->create(vectorPortRef);
79  std::vector < size_t > limits;
80  port.getLimits(limits);
81  vectorPortRef->constructChildren(mFactory, limits);
82  setupCreatedPort(port.getSharedThis(), vectorPortRef);
83  } catch(Error& e) {
84  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
85  throw;
86  }
87 }
void setupCreatedPort(const PortSharedPtr &port, const PortReferenceSharedPtr &inPortRef)
ObjectFactorySharedPtr mFactory
boost::shared_ptr< VectorPortReference > VectorPortReferenceSharedPtr

+ Here is the call graph for this function:

template<typename _ReturnType >
void torc::generic::PortRefCreator< _ReturnType >::visit ( PortBundle port)
throw (Error
)

Definition at line 89 of file PortRefCreator.hpp.

90  {
91  try {
92  PortBundleReferenceSharedPtr portBundleRef;
93  mFactory->create(portBundleRef);
94  PortRefCreator<PortReferenceSharedPtr> creator(mFactory, mInstance, portBundleRef);
95  VisitorApplier<PortRefCreator<PortReferenceSharedPtr> > applier(creator);
96  port.applyOnAllChildren(applier);
97  setupCreatedPort(port.getSharedThis(), portBundleRef);
98  mReturnValue = portBundleRef;
99  } catch(Error& e) {
100  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
101  throw;
102  }
103 }
void setupCreatedPort(const PortSharedPtr &port, const PortReferenceSharedPtr &inPortRef)
ObjectFactorySharedPtr mFactory
boost::shared_ptr< PortBundleReference > PortBundleReferenceSharedPtr

+ Here is the call graph for this function:

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:

Field Documentation

template<typename _ReturnType>
PortBundleReferenceSharedPtr torc::generic::PortRefCreator< _ReturnType >::mBundle
private

Definition at line 58 of file PortRefCreator.hpp.

template<typename _ReturnType>
ObjectFactorySharedPtr torc::generic::PortRefCreator< _ReturnType >::mFactory
private

Definition at line 56 of file PortRefCreator.hpp.

template<typename _ReturnType>
InstanceSharedPtr torc::generic::PortRefCreator< _ReturnType >::mInstance
private

Definition at line 57 of file PortRefCreator.hpp.

template<typename _ReturnType>
_ReturnType torc::generic::PortRefCreator< _ReturnType >::mReturnValue
private

Definition at line 59 of file PortRefCreator.hpp.


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