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

This class is to model simulate construct which is a named collection of simulation stimulus and responses statements and is used in the interface and contents of views. More...

#include <Simulate.hpp>

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

Data Structures

class  Factory
 

Public Types

typedef VisitorType< SimulateVisitor
 
typedef std::string Name
 
typedef Simulate Type
 
typedef boost::shared_ptr< TypePointer
 
typedef boost::weak_ptr< TypeWeakPointer
 

Public Member Functions

virtual void accept (BaseVisitor &inoutVisitor) throw (Error)
 
void addPortListAlias (const PortListAliasSharedPtr &inPortListAlias) throw (Error)
 
PortListAliasSharedPtr findPortListAlias (const std::string &inName)
 
void getPortListAliases (std::vector< PortListAliasSharedPtr > &outPortListAliases) const
 
void setPortListAliases (const std::vector< PortListAliasSharedPtr > &inPortListAliases) throw (Error)
 
void getAllApply (std::vector< ApplySharedPtr > &outAllApply) const
 
void setAllApply (const std::vector< ApplySharedPtr > &inAllApply) throw (Error)
 
void addApply (const ApplySharedPtr &inSource) throw (Error)
 
void getWaveValues (std::vector< WaveValueSharedPtr > &outWaveValues) const
 
void setWaveValues (const std::vector< WaveValueSharedPtr > &inWaveValues) throw (Error)
 
void addWaveValue (const WaveValueSharedPtr &inSource) throw (Error)
 
WaveValueSharedPtr findWaveValue (const std::string &inName)
 
template<typename _Action >
void applyOnAllPortListAlias (const _Action &action) throw (Error)
 
template<typename _Action >
void applyOnAllWaveValues (const _Action &action) throw (Error)
 
 ~Simulate () throw ()
 
virtual const std::string getName () const
 
void setName (const std::string &inSource) throw (Error)
 
virtual Name getOriginalName () const
 
virtual void setOriginalName (const Name &inSource)
 
void addComment (const std::string &comment)
 
const std::vector< std::string > & getComments () const
 
void setComments (const std::vector< std::string > &inSource)
 
void setWeakThis (const WeakPointer &inWeakThis)
 
Pointer getSharedThis () const
 
void getUserData (std::list< std::string > &outUserData) const
 
void setUserData (const std::list< std::string > &inSource)
 
void addUserData (const std::string &inSource)
 

Protected Member Functions

 Simulate ()
 

Private Member Functions

 Simulate (const Simulate &source)
 
Simulateoperator= (const Simulate &source)
 

Private Attributes

SymTab< std::string,
PortListAliasSharedPtr
mPortListAliasSymTab
 
SymTab< std::string,
WaveValueSharedPtr
mWaveValueSymTab
 
std::vector< ApplySharedPtrmAllApply
 

Friends

class FactoryType< Simulate >
 

Detailed Description

This class is to model simulate construct which is a named collection of simulation stimulus and responses statements and is used in the interface and contents of views.

Definition at line 46 of file Simulate.hpp.

Member Typedef Documentation

typedef std::string torc::generic::Renamable::Name
inherited

Definition at line 40 of file generic/Renamable.hpp.

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

Definition at line 36 of file SelfReferencing.hpp.

Definition at line 35 of file SelfReferencing.hpp.

Convenience class to visit a simulate

Definition at line 54 of file Simulate.hpp.

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

Definition at line 37 of file SelfReferencing.hpp.

Constructor & Destructor Documentation

torc::generic::Simulate::~Simulate ( )
throw (
)

Definition at line 233 of file Simulate.cpp.

233 {}
torc::generic::Simulate::Simulate ( )
protected

Definition at line 229 of file Simulate.cpp.

230  SelfReferencing<Simulate>(), UserDataContainer(), mPortListAliasSymTab(), mWaveValueSymTab(),
231  mAllApply() {}
SymTab< std::string, PortListAliasSharedPtr > mPortListAliasSymTab
Definition: Simulate.hpp:203
std::vector< ApplySharedPtr > mAllApply
Definition: Simulate.hpp:205
SymTab< std::string, WaveValueSharedPtr > mWaveValueSymTab
Definition: Simulate.hpp:204
torc::generic::Simulate::Simulate ( const Simulate source)
private

Member Function Documentation

void torc::generic::Simulate::accept ( BaseVisitor inoutVisitor)
throw (Error
)
virtual

Implements torc::generic::Visitable.

Definition at line 67 of file Simulate.cpp.

67  {
68  try {
69  runVisitor(*this, inoutVisitor);
70  } catch(Error& e) {
71  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
72  throw;
73  }
74 }
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78

+ Here is the call graph for this function:

void torc::generic::Simulate::addApply ( const ApplySharedPtr inSource)
throw (Error
)

Add an apply objects to the vector of apply objects.

Parameters
[in]inSourcePointer to Apply object

Add an apply to the vector of Apply objects.

Parameters
[in]inSourcePointer to Apply object to be appended to

Definition at line 143 of file Simulate.cpp.

143  {
144  try {
145  mAllApply.push_back(inSource);
146  } catch(Error& e) {
147  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
148  throw;
149  }
150 }
std::vector< ApplySharedPtr > mAllApply
Definition: Simulate.hpp:205

+ Here is the call graph for this function:

void torc::generic::Commentable::addComment ( const std::string &  comment)
inherited

Add a comment to the object

Parameters
[in]commentThe comment to add to an existing list of comments

Definition at line 36 of file Commentable.cpp.

36  {
37  mComments.push_back(comment);
38 }
std::vector< std::string > mComments
Definition: Commentable.hpp:77
void torc::generic::Simulate::addPortListAlias ( const PortListAliasSharedPtr inPortListAlias)
throw (Error
)

Add a port list alias to the symbol table of port list alias. If an empty pointer is supplied, it returns without doing anything.

Parameters
[in]inPortListAliasA pointer to a port list alias object.
Exceptions
ErrorPortListAlias could not be added, empty PortListAlias name
ErrorPortListAlias already exists in simulate

Definition at line 85 of file Simulate.cpp.

85  {
86  if(!inPortListAlias) {
87  return;
88  }
89  std::string name = inPortListAlias->getName();
90  if(name.empty()) {
91  Error e(eMessageIdErrorEmptyItemName, __FUNCTION__, __FILE__, __LINE__);
92  e.saveContextData("Empty port list alias name ", name);
93  throw e;
94  }
95  if(false == mPortListAliasSymTab.set(name, inPortListAlias)) {
96  Error e(eMessageIdErrorItemAlreadyExists, __FUNCTION__, __FILE__, __LINE__);
97  e.saveContextData("Port list alias name", name);
98  throw e;
99  }
100 }
bool set(const KeyType &inKey, const ValueType &inValue)
Definition: SymTab.hpp:132
std::string string
SymTab< std::string, PortListAliasSharedPtr > mPortListAliasSymTab
Definition: Simulate.hpp:203

+ Here is the call graph for this function:

void torc::generic::UserDataContainer::addUserData ( const std::string &  inSource)
inherited

Add an user data to the list of user data

Parameters
[in]inSourceAn user data as string

Definition at line 34 of file UserDataContainer.cpp.

34  {
35  mUserData.push_back(inSource);
36 }
std::list< std::string > mUserData
void torc::generic::Simulate::addWaveValue ( const WaveValueSharedPtr inSource)
throw (Error
)

Add a wave value to the symbol table of wave values.

Parameters
[in]inSourcePointer to WaveValue to be appended to
Exceptions
ErrorWaveValue could not be added, empty WaveValue name
ErrorWaveValue already exists in simulate

A dd a wave value to the symbol table of wave values.

Parameters
[in]inSourcePointer to WaveValue to be appended to
Exceptions
ErrorWaveValue could not be added, empty WaveValue name
ErrorWaveValue already exists in simulate

Definition at line 194 of file Simulate.cpp.

194  {
195  if(!inSource) {
196  return;
197  }
198  std::string name = inSource->getName();
199  if(name.empty()) {
200  Error e(eMessageIdErrorEmptyItemName, __FUNCTION__, __FILE__, __LINE__);
201  e.saveContextData("Empty WaveValue name ", name);
202  throw e;
203  }
204  if(false == mWaveValueSymTab.set(name, inSource)) {
205  Error e(eMessageIdErrorItemAlreadyExists, __FUNCTION__, __FILE__, __LINE__);
206  e.saveContextData("WaveValue name", name);
207  throw e;
208  }
209 }
bool set(const KeyType &inKey, const ValueType &inValue)
Definition: SymTab.hpp:132
std::string string
SymTab< std::string, WaveValueSharedPtr > mWaveValueSymTab
Definition: Simulate.hpp:204

+ Here is the call graph for this function:

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

Apply action on all PortListAlias.

Parameters
[in]actionAction to be applied

Definition at line 242 of file Simulate.hpp.

243  {
244  try {
246  } catch(Error& e) {
247  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
248  throw;
249  }
250 }
void applyOnAll(const _Action &action)
Definition: SymTab.hpp:192
SymTab< std::string, PortListAliasSharedPtr > mPortListAliasSymTab
Definition: Simulate.hpp:203

+ Here is the call graph for this function:

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

Apply action on all WaveValues.

Parameters
[in]actionAction to be applied

Definition at line 257 of file Simulate.hpp.

258  {
259  try {
261  } catch(Error& e) {
262  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
263  throw;
264  }
265 }
void applyOnAll(const _Action &action)
Definition: SymTab.hpp:192
SymTab< std::string, WaveValueSharedPtr > mWaveValueSymTab
Definition: Simulate.hpp:204

+ Here is the call graph for this function:

PortListAliasSharedPtr torc::generic::Simulate::findPortListAlias ( const std::string &  inName)

Find a PortListAlias by name, in the symbol table of port list alias.

Parameters
[in]inNameString specifying the name of the PortListAlias.
Returns
A pointer to the PortListAlias if found, an empty pointer otherwise.

Definition at line 127 of file Simulate.cpp.

127  {
128  if(inName.empty()) {
129  Error e(eMessageIdErrorEmptyItemName, __FUNCTION__, __FILE__, __LINE__);
130  e.saveContextData("Empty PortListAlias name", inName);
131  throw e;
132  }
133  PortListAliasSharedPtr portListAlias;
134  mPortListAliasSymTab.get(inName, portListAlias);
135  return portListAlias;
136 }
bool get(const KeyType &inKey, ValueType &outValue) const
Definition: SymTab.hpp:121
SymTab< std::string, PortListAliasSharedPtr > mPortListAliasSymTab
Definition: Simulate.hpp:203
boost::shared_ptr< PortListAlias > PortListAliasSharedPtr

+ Here is the call graph for this function:

WaveValueSharedPtr torc::generic::Simulate::findWaveValue ( const std::string &  inName)

Find a WaveValue by name, in the symbol table of port list alias.

Parameters
[in]inNameString specifying the name of the WaveValue.
Returns
A pointer to the WaveValue if found, an empty pointer otherwise.

Definition at line 218 of file Simulate.cpp.

218  {
219  if(inName.empty()) {
220  Error e(eMessageIdErrorEmptyItemName, __FUNCTION__, __FILE__, __LINE__);
221  e.saveContextData("Empty WaveValue name", inName);
222  throw e;
223  }
224  WaveValueSharedPtr waveValue;
225  mWaveValueSymTab.get(inName, waveValue);
226  return waveValue;
227 }
boost::shared_ptr< WaveValue > WaveValueSharedPtr
bool get(const KeyType &inKey, ValueType &outValue) const
Definition: SymTab.hpp:121
SymTab< std::string, WaveValueSharedPtr > mWaveValueSymTab
Definition: Simulate.hpp:204

+ Here is the call graph for this function:

void torc::generic::Simulate::getAllApply ( std::vector< ApplySharedPtr > &  outAllApply) const
inline

Get all the apply objects.

Parameters
[out]outAllApplyVector of apply objects to be appended to

Definition at line 224 of file Simulate.hpp.

224  {
225  outAllApply.insert(outAllApply.end(), mAllApply.begin(), mAllApply.end());
226 }
std::vector< ApplySharedPtr > mAllApply
Definition: Simulate.hpp:205
const std::vector< std::string > & torc::generic::Commentable::getComments ( ) const
inlineinherited

Get the list of all comments

Returns
A list of all comments on this object

Definition at line 85 of file Commentable.hpp.

85  {
86  return mComments;
87 }
std::vector< std::string > mComments
Definition: Commentable.hpp:77
const std::string torc::generic::Nameable::getName ( void  ) const
inlinevirtualinherited

Get the object name

Returns
Name of the object

Definition at line 89 of file Nameable.hpp.

89  {
90  return mName;
91 }

+ Here is the caller graph for this function:

Renamable::Name torc::generic::Renamable::getOriginalName ( ) const
inlinevirtualinherited

Get the new name provided for the object.

Returns
Name of the object

Definition at line 78 of file generic/Renamable.hpp.

78  {
79  return mOriginalName;
80 }

+ Here is the caller graph for this function:

void torc::generic::Simulate::getPortListAliases ( std::vector< PortListAliasSharedPtr > &  outPortListAliases) const
inline

Get all the PortListAlias of this simulation.

Parameters
[out]outPortListAliasesVector of PortListAlias to be appended to

Definition at line 214 of file Simulate.hpp.

215  {
216  mPortListAliasSymTab.getValues(outPortListAliases);
217 }
void getValues(std::vector< ValueType > &outValues) const
Definition: SymTab.hpp:158
SymTab< std::string, PortListAliasSharedPtr > mPortListAliasSymTab
Definition: Simulate.hpp:203
Pointer torc::generic::SelfReferencing< Simulate >::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
void torc::generic::UserDataContainer::getUserData ( std::list< std::string > &  outUserData) const
inlineinherited

Get the list of all userData

Parameters
[out]outUserDataThe list of all userData

Definition at line 78 of file UserDataContainer.hpp.

78  {
79  outUserData.insert(outUserData.end(), mUserData.begin(), mUserData.end());
80  return;
81 }
std::list< std::string > mUserData
void torc::generic::Simulate::getWaveValues ( std::vector< WaveValueSharedPtr > &  outWaveValues) const
inline

Get the vector of wave values.

Parameters
[out]outWaveValuesVector of wave values to be appended to

Definition at line 233 of file Simulate.hpp.

233  {
234  mWaveValueSymTab.getValues(outWaveValues);
235 }
void getValues(std::vector< ValueType > &outValues) const
Definition: SymTab.hpp:158
SymTab< std::string, WaveValueSharedPtr > mWaveValueSymTab
Definition: Simulate.hpp:204

+ Here is the call graph for this function:

Simulate& torc::generic::Simulate::operator= ( const Simulate source)
private
void torc::generic::Simulate::setAllApply ( const std::vector< ApplySharedPtr > &  inAllApply)
throw (Error
)

Set all the apply objects.

Parameters
[in]inAllApplyVector of apply objects to be appended to

Definition at line 157 of file Simulate.cpp.

157  {
158  std::vector<ApplySharedPtr>::const_iterator it = inAllApply.begin();
159  for(; it != inAllApply.end(); it++) {
160  try {
161  addApply(*it);
162  } catch(Error& e) {
163  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
164  throw;
165  }
166  }
167 }
void addApply(const ApplySharedPtr &inSource)
Definition: Simulate.cpp:143

+ Here is the call graph for this function:

void torc::generic::Commentable::setComments ( const std::vector< std::string > &  inSource)
inherited

Get the list of all comments

Parameters
[in]inSourceA list of all comments to be set on this object

Definition at line 45 of file Commentable.cpp.

45  {
46  mComments.insert(mComments.end(), inSource.begin(), inSource.end());
47 }
std::vector< std::string > mComments
Definition: Commentable.hpp:77
void torc::generic::Nameable::setName ( const std::string &  inSource)
throw (Error
)
inherited

Set a name for this object

Parameters
[in]inSourceName of the object
Exceptions
ErrorCould not set name, because name is empty (Will be used by array members)
  • Id : eMessageIdErrorEmptyItemName
  • Context Data

Set a name for this object

Parameters
[in]inSourceName of the object
Exceptions
ErrorCould not set name, because name is empty (Will be used by array members)

Definition at line 41 of file Nameable.cpp.

41  {
42  if(inSource.empty()) {
43  Error e(eMessageIdErrorEmptyItemName, __FUNCTION__, __FILE__, __LINE__);
44  e.saveContextData("Nameable", inSource);
45  throw e;
46  }
47  mName = inSource;
48 }

+ Here is the call graph for this function:

void torc::generic::Renamable::setOriginalName ( const Name inSource)
virtualinherited

Set the new name provided for the object.

Parameters
[in]inSourceName of the object

Definition at line 35 of file generic/Renamable.cpp.

35  {
36  mOriginalName = inSource;
37 }
void torc::generic::Simulate::setPortListAliases ( const std::vector< PortListAliasSharedPtr > &  inPortListAliases)
throw (Error
)

Set all the PortListAlias of this simulation.

Parameters
[in]inPortListAliasesVector of PortListAlias to be appended to

Definition at line 107 of file Simulate.cpp.

108  {
109  std::vector<PortListAliasSharedPtr>::const_iterator it = inPortListAliases.begin();
110  for(; it != inPortListAliases.end(); it++) {
111  try {
112  addPortListAlias(*it);
113  } catch(Error& e) {
114  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
115  throw;
116  }
117  }
118 }
void addPortListAlias(const PortListAliasSharedPtr &inPortListAlias)
Definition: Simulate.cpp:85

+ Here is the call graph for this function:

void torc::generic::UserDataContainer::setUserData ( const std::list< std::string > &  inSource)
inherited

Set the list of userData

Parameters
[in]inSourceThe list of UserData

Definition at line 26 of file UserDataContainer.cpp.

26  {
27  mUserData.insert(mUserData.end(), inSource.begin(), inSource.end());
28 }
std::list< std::string > mUserData
void torc::generic::Simulate::setWaveValues ( const std::vector< WaveValueSharedPtr > &  inWaveValues)
throw (Error
)

Set the vector of wave values.

Parameters
[in]inWaveValuesVector of wave values to be appended to

Definition at line 174 of file Simulate.cpp.

174  {
175  std::vector<WaveValueSharedPtr>::const_iterator it = inWaveValues.begin();
176  for(; it != inWaveValues.end(); it++) {
177  try {
178  addWaveValue(*it);
179  } catch(Error& e) {
180  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
181  throw;
182  }
183  }
184 }
void addWaveValue(const WaveValueSharedPtr &inSource)
Definition: Simulate.cpp:194

+ Here is the call graph for this function:

void torc::generic::SelfReferencing< Simulate >::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< Simulate >
friend

Definition at line 48 of file Simulate.hpp.

Field Documentation

std::vector<ApplySharedPtr> torc::generic::Simulate::mAllApply
private

Definition at line 205 of file Simulate.hpp.

SymTab<std::string, PortListAliasSharedPtr> torc::generic::Simulate::mPortListAliasSymTab
private

Definition at line 203 of file Simulate.hpp.

SymTab<std::string, WaveValueSharedPtr> torc::generic::Simulate::mWaveValueSymTab
private

Definition at line 204 of file Simulate.hpp.


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