torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
torc::generic::InterfaceJoinedInfo Class Reference

Represents the Interface joining information. More...

#include <InterfaceJoinedInfo.hpp>

+ Inheritance diagram for torc::generic::InterfaceJoinedInfo:
+ Collaboration diagram for torc::generic::InterfaceJoinedInfo:

Data Structures

class  Factory
 

Public Types

enum  JoinedType { eJoinedTypeJoin = 0, eJoinedTypeWeak, eJoinedTypeMust }
 
enum  RelationType { eRelationTypeParent = 0, eRelationTypeChild }
 
typedef VisitorType
< InterfaceJoinedInfo
Visitor
 
typedef InterfaceJoinedInfo Type
 
typedef boost::shared_ptr< TypePointer
 
typedef boost::weak_ptr< TypeWeakPointer
 

Public Member Functions

virtual void accept (BaseVisitor &visitor) throw (Error)
 Receive a visitor to this class. The visit method of the visitor is called and a reference to this object is passed as a parameter. It has to be noted however, that a dynamic_cast is performed inside this method. If the cast fails, an appropriate exception is thrown by this method. This situation can arise when the passed Visitor object does not inherit from the appropriate visitor specialization. See Visitor documentation for more details. More...
 
const JoinedType getJoinedType () const
 
void setJoinedType (const JoinedType &inSource)
 
void addPort (const PortSharedPtr &inPort) throw (Error)
 
void getPorts (std::list< PortSharedPtr > &outPorts) const
 
void setPorts (const std::list< PortSharedPtr > &inSource)
 
void addPortList (const PortListSharedPtr &inPortList)
 
void getPortLists (std::list< PortListSharedPtr > &outPortLists) const
 
void setPortLists (const std::list< PortListSharedPtr > &inSource)
 
void getChildren (std::vector< InterfaceJoinedInfoSharedPtr > &outJoinedInfos) const
 
void setChildren (const std::vector< InterfaceJoinedInfoSharedPtr > &inSource)
 
bool addChildJoinedInfo (const InterfaceJoinedInfoSharedPtr &inChildJoinInfo)
 
template<typename _Action >
void applyOnAllChildren (const _Action &action) throw (Error)
 
const RelationType getRelationType () const
 
void setRelationType (const RelationType &inSource)
 
size_t getSize () const
 
virtual ~InterfaceJoinedInfo () throw ()
 
void setWeakThis (const WeakPointer &inWeakThis)
 
Pointer getSharedThis () const
 

Protected Member Functions

 InterfaceJoinedInfo ()
 

Private Attributes

JoinedType mJoinedType
 
RelationType mRelationType
 
std::list< PortSharedPtrmJoinedPorts
 
std::list< PortListSharedPtrmJoinedPortLists
 
std::vector
< InterfaceJoinedInfoSharedPtr
mChildren
 

Friends

class FactoryType< InterfaceJoinedInfo >
 

Detailed Description

Represents the Interface joining information.

The InterfaceJoinedInfo class is used to hold interface joining information. Joining information specify which ports (scalar port, array of ports, bundle of ports) or port lists are shorted together.

Definition at line 43 of file InterfaceJoinedInfo.hpp.

Member Typedef Documentation

typedef boost::shared_ptr<Type> torc::generic::SelfReferencing< InterfaceJoinedInfo >::Pointer
inherited

Definition at line 36 of file SelfReferencing.hpp.

Convenience class to visit an interface joining information.

Definition at line 67 of file InterfaceJoinedInfo.hpp.

typedef boost::weak_ptr<Type> torc::generic::SelfReferencing< InterfaceJoinedInfo >::WeakPointer
inherited

Definition at line 37 of file SelfReferencing.hpp.

Member Enumeration Documentation

Constructor & Destructor Documentation

torc::generic::InterfaceJoinedInfo::~InterfaceJoinedInfo ( )
throw (
)
virtual

Definition at line 249 of file InterfaceJoinedInfo.cpp.

249 {}
torc::generic::InterfaceJoinedInfo::InterfaceJoinedInfo ( )
protected

Definition at line 246 of file InterfaceJoinedInfo.cpp.

246  : Visitable(), SelfReferencing<InterfaceJoinedInfo>(),
std::list< PortSharedPtr > mJoinedPorts
std::list< PortListSharedPtr > mJoinedPortLists
std::vector< InterfaceJoinedInfoSharedPtr > mChildren

Member Function Documentation

void torc::generic::InterfaceJoinedInfo::accept ( BaseVisitor visitor)
throw (Error
)
virtual

Receive a visitor to this class. The visit method of the visitor is called and a reference to this object is passed as a parameter. It has to be noted however, that a dynamic_cast is performed inside this method. If the cast fails, an appropriate exception is thrown by this method. This situation can arise when the passed Visitor object does not inherit from the appropriate visitor specialization. See Visitor documentation for more details.

Parameters
[in,out]visitorA reference to the visitor object
Exceptions
ErrorVisitor type inappropriate for visiting this object or any other error thrown by the Visitor::throw() method.

Implements torc::generic::Visitable.

Definition at line 167 of file InterfaceJoinedInfo.cpp.

167  {
168  try {
169  runVisitor(*this, visitor);
170  } catch(Error& e) {
171  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
172  throw;
173  }
174 }
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78

+ Here is the call graph for this function:

bool torc::generic::InterfaceJoinedInfo::addChildJoinedInfo ( const InterfaceJoinedInfoSharedPtr inChildJoinInfo)

Add a joined info to parent joined info

Parameters
[in]inChildJoinInfoChild interface joined info to be added to parent

Definition at line 153 of file InterfaceJoinedInfo.cpp.

153  {
154  if(!inChildJoinInfo) {
155  Error e(eMessageIdErrorPointerToItemDoesNotExist, __FUNCTION__, __FILE__, __LINE__);
156  e.saveContextData("Pointer to the joined info object does not exist", inChildJoinInfo);
157  throw e;
158  }
159  if(inChildJoinInfo) {
160  mChildren.push_back(inChildJoinInfo);
161  return true;
162  } else {
163  return false;
164  }
165 }
std::vector< InterfaceJoinedInfoSharedPtr > mChildren

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::generic::InterfaceJoinedInfo::addPort ( const PortSharedPtr inPort)
throw (Error
)

Add a port to the list of ports. Empty pointer is ignored.

Parameters
[in]inPortPointer to port to be added.
Exceptions
ErrorCould not add port, because Port name is empty

Definition at line 67 of file InterfaceJoinedInfo.cpp.

67  {
68  if(!inPort) {
69  return;
70  }
71  std::string name = inPort->getName();
72  if(name.empty()) {
73  Error e(eMessageIdErrorEmptyItemName, __FUNCTION__, __FILE__, __LINE__);
74  e.saveContextData("Port name", name);
75  throw e;
76  }
77  mJoinedPorts.push_back(inPort);
78 }
std::list< PortSharedPtr > mJoinedPorts
std::string string

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void torc::generic::InterfaceJoinedInfo::addPortList ( const PortListSharedPtr inPortList)

Add a portList to the list of portLists. Empty pointer is ignored.

Parameters
[in]inPortListPointer to portList to be added.

Definition at line 85 of file InterfaceJoinedInfo.cpp.

85  {
86  if(!inPortList) {
87  return;
88  }
89  mJoinedPortLists.push_back(inPortList);
90 }
std::list< PortListSharedPtr > mJoinedPortLists

+ Here is the caller graph for this function:

template<typename _Action >
void torc::generic::InterfaceJoinedInfo::applyOnAllChildren ( const _Action &  action)
throw (Error
)
inline

Apply action on all children

Parameters
[in]actionAction to be applied

Definition at line 268 of file InterfaceJoinedInfo.hpp.

269  {
270  try {
271  std::vector<InterfaceJoinedInfoSharedPtr>::iterator it = mChildren.begin();
272  for(; it != mChildren.end(); ++it) {
273  action(*it);
274  }
275  } catch(Error& e) {
276  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
277  throw;
278  }
279 }
std::vector< InterfaceJoinedInfoSharedPtr > mChildren

+ Here is the call graph for this function:

void torc::generic::InterfaceJoinedInfo::getChildren ( std::vector< InterfaceJoinedInfoSharedPtr > &  outJoinedInfos) const
inline

Get the nested interface joined info.

Parameters
[out]outJoinedInfosVector of interface joined info to be appended to

Definition at line 259 of file InterfaceJoinedInfo.hpp.

260  {
261  outJoinedInfos.insert(outJoinedInfos.end(), mChildren.begin(), mChildren.end());
262 }
std::vector< InterfaceJoinedInfoSharedPtr > mChildren

+ Here is the caller graph for this function:

const InterfaceJoinedInfo::JoinedType torc::generic::InterfaceJoinedInfo::getJoinedType ( ) const
inline

Get the interface joining type

Returns
Interface joining type

Definition at line 232 of file InterfaceJoinedInfo.hpp.

232  {
233  return mJoinedType;
234 }
void torc::generic::InterfaceJoinedInfo::getPortLists ( std::list< PortListSharedPtr > &  outPortLists) const
inline

Get the list of joined portLists of an interface

Returns
outPortLists List of joined portLists to be appended to

Get the list of joined portLists of an interface

Returns
outPorts List of joined portLists to be appended to

Definition at line 250 of file InterfaceJoinedInfo.hpp.

250  {
251  outPortLists.insert(outPortLists.end(), mJoinedPortLists.begin(), mJoinedPortLists.end());
252 }
std::list< PortListSharedPtr > mJoinedPortLists

+ Here is the caller graph for this function:

void torc::generic::InterfaceJoinedInfo::getPorts ( std::list< PortSharedPtr > &  outPorts) const
inline

Get the list of pointers to the joined ports of an interface

Returns
outPorts List of ports to be appended to

Definition at line 241 of file InterfaceJoinedInfo.hpp.

241  {
242  outPorts.insert(outPorts.end(), mJoinedPorts.begin(), mJoinedPorts.end());
243 }
std::list< PortSharedPtr > mJoinedPorts

+ Here is the caller graph for this function:

const InterfaceJoinedInfo::RelationType torc::generic::InterfaceJoinedInfo::getRelationType ( ) const
inline

Get the relation type.

Returns
RelationType

Definition at line 286 of file InterfaceJoinedInfo.hpp.

286  {
287  return mRelationType;
288 }

+ Here is the caller graph for this function:

Pointer torc::generic::SelfReferencing< InterfaceJoinedInfo >::getSharedThis ( ) const
inlineinherited

Get a shared pointer to this object. A valid pointer is returned if weakThis was set. Otherwise this returns a NULL pointer. For Vector types, the second scenario is an exception condition and should be treated as such.

Returns
A shared pointer to this object

Get a shared pointer to this object. A valid pointer is returned if weakThis was set. Otherwise this returns a NULL pointer. For Vector types, the second scenario is an exception condition and should be treated as such.

Parameters
[out]ptrSet to a shared pointer to this object
size_t torc::generic::InterfaceJoinedInfo::getSize ( void  ) const

Get the total number of bits of the composition

Returns
Number of bits

Definition at line 189 of file InterfaceJoinedInfo.cpp.

189  {
190  size_t size = 0;
191  size_t pSize = 0;
192  size_t cSize = 0;
194 
195  std::vector<InterfaceJoinedInfoSharedPtr> outJoinedInfos;
196  getChildren(outJoinedInfos);
197  std::vector<InterfaceJoinedInfoSharedPtr>::iterator joinedInfoIt = outJoinedInfos.begin();
198 
199  std::list<PortSharedPtr> outPorts;
200  getPorts(outPorts);
201  std::list<PortSharedPtr>::iterator portIt = outPorts.begin();
202 
203  std::list<PortListSharedPtr> outPortLists;
204  getPortLists(outPortLists);
205  std::list<PortListSharedPtr>::iterator portListIt = outPortLists.begin();
206 
208  if(!outPorts.empty()) {
209  pSize = (*portIt)->getSize();
210  } else if(!outPortLists.empty()) {
211  pSize = (*portListIt)->getSize();
212  } else if(!outJoinedInfos.empty()) {
213  for(; joinedInfoIt != outJoinedInfos.end(); joinedInfoIt++) {
214  pSize += (*joinedInfoIt)->getSize();
215  for(; portIt != outPorts.end(); portIt++) {
216  pSize += (*portIt)->getSize();
217  }
218  for(; portListIt != outPortLists.end(); portListIt++) {
219  pSize += (*portListIt)->getSize();
220  }
221  }
222  } else {
223  pSize = 0;
224  }
225  } else {
226  if(!outPorts.empty()) {
227  for(; portIt != outPorts.end(); portIt++) {
228  cSize += (*portIt)->getSize();
229  }
230  }
231  if(!outPortLists.empty()) {
232  for(; portListIt != outPortLists.end(); portListIt++) {
233  cSize += (*portListIt)->getSize();
234  }
235  }
236  if(!outJoinedInfos.empty()) {
237  for(; joinedInfoIt != outJoinedInfos.end(); joinedInfoIt++) {
238  cSize += (*joinedInfoIt)->getSize();
239  }
240  }
241  }
242  size = pSize + cSize;
243  return size;
244 }
void getPortLists(std::list< PortListSharedPtr > &outPortLists) const
void getChildren(std::vector< InterfaceJoinedInfoSharedPtr > &outJoinedInfos) const
const RelationType getRelationType() const
void getPorts(std::list< PortSharedPtr > &outPorts) const

+ Here is the call graph for this function:

void torc::generic::InterfaceJoinedInfo::setChildren ( const std::vector< InterfaceJoinedInfoSharedPtr > &  inSource)

Set the nested joining information

Parameters
[in]inSourceVector containing joining informations
Exceptions
ErrorCould not add child joined info because pointer to the joined info does not exist

Definition at line 135 of file InterfaceJoinedInfo.cpp.

135  {
136  std::vector<InterfaceJoinedInfoSharedPtr>::const_iterator entry = inSource.begin();
137  std::vector<InterfaceJoinedInfoSharedPtr>::const_iterator end = inSource.end();
138  for(; entry != end; ++entry) {
139  try {
140  addChildJoinedInfo(*entry);
141  } catch(Error& e) {
142  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
143  throw;
144  }
145  }
146 }
bool addChildJoinedInfo(const InterfaceJoinedInfoSharedPtr &inChildJoinInfo)

+ Here is the call graph for this function:

void torc::generic::InterfaceJoinedInfo::setJoinedType ( const JoinedType value)

Set the interface joining type

Parameters
[in]inSourceInterface joining type

Definition at line 57 of file InterfaceJoinedInfo.cpp.

57  {
58  mJoinedType = value;
59 }
void torc::generic::InterfaceJoinedInfo::setPortLists ( const std::list< PortListSharedPtr > &  inSource)

Set the list of joined portLists of an interface

Parameters
[in]inSourceList of portLists to be joined to an interface

Definition at line 115 of file InterfaceJoinedInfo.cpp.

115  {
116  std::list<PortListSharedPtr>::const_iterator portList = inSource.begin();
117  std::list<PortListSharedPtr>::const_iterator end = inSource.end();
118  for(; portList != end; ++portList) {
119  try {
120  addPortList(*portList);
121  } catch(Error& e) {
122  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
123  throw;
124  }
125  }
126 }
void addPortList(const PortListSharedPtr &inPortList)

+ Here is the call graph for this function:

void torc::generic::InterfaceJoinedInfo::setPorts ( const std::list< PortSharedPtr > &  inSource)

Set the list of joined ports of an interface

Parameters
[in]inSourceList of ports to be joined to an interface

Definition at line 97 of file InterfaceJoinedInfo.cpp.

97  {
98  std::list<PortSharedPtr>::const_iterator port = inSource.begin();
99  std::list<PortSharedPtr>::const_iterator end = inSource.end();
100  for(; port != end; ++port) {
101  try {
102  addPort(*port);
103  } catch(Error& e) {
104  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
105  throw;
106  }
107  }
108 }
void addPort(const PortSharedPtr &inPort)

+ Here is the call graph for this function:

void torc::generic::InterfaceJoinedInfo::setRelationType ( const RelationType inSource)

Set the relation type.

Parameters
[in]inSourceRelationType

Definition at line 181 of file InterfaceJoinedInfo.cpp.

181  {
182  mRelationType = inSource;
183 }
void torc::generic::SelfReferencing< InterfaceJoinedInfo >::setWeakThis ( const WeakPointer inWeakThis)
inlineinherited

Set a weak pointer to this object. This will be used later to get a shared pointer to this object from within other member methods if required. This should be called by the Factory creating the object.

Parameters
[in]weakThisA weak pointer to this object

Friends And Related Function Documentation

friend class FactoryType< InterfaceJoinedInfo >
friend

Definition at line 44 of file InterfaceJoinedInfo.hpp.

Field Documentation

std::vector<InterfaceJoinedInfoSharedPtr> torc::generic::InterfaceJoinedInfo::mChildren
private

Definition at line 223 of file InterfaceJoinedInfo.hpp.

std::list<PortListSharedPtr> torc::generic::InterfaceJoinedInfo::mJoinedPortLists
private

Definition at line 222 of file InterfaceJoinedInfo.hpp.

std::list<PortSharedPtr> torc::generic::InterfaceJoinedInfo::mJoinedPorts
private

Definition at line 221 of file InterfaceJoinedInfo.hpp.

JoinedType torc::generic::InterfaceJoinedInfo::mJoinedType
private

Definition at line 219 of file InterfaceJoinedInfo.hpp.

RelationType torc::generic::InterfaceJoinedInfo::mRelationType
private

Definition at line 220 of file InterfaceJoinedInfo.hpp.


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