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

#include <Property.hpp>

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

Data Structures

class  Factory
 

Public Types

typedef VisitorType< PropertyVisitor
 
typedef std::string Name
 
typedef Property Type
 
typedef boost::shared_ptr< TypePointer
 
typedef boost::weak_ptr< TypeWeakPointer
 

Public Member Functions

virtual void accept (BaseVisitor &inoutVisitor) throw (Error)
 
virtual ~Property () throw ()
 
const Value getValue () const
 
void setValue (const Value &inSource)
 
const Unit getUnit () const
 
void setUnit (const Unit &inSource)
 
const std::string getOwner () const
 
void setOwner (const std::string &inSource)
 
void getChildren (std::map< std::string, PropertySharedPtr > &outValues) const
 
template<typename _Action >
void applyOnAllChildren (const _Action &action) throw (Error)
 
void setChildren (const std::map< std::string, PropertySharedPtr > &inSource)
 
bool addChildProperty (const std::string &inName, const PropertySharedPtr &inProperty)
 
void addComment (const std::string &comment)
 
const std::vector< std::string > & getComments () const
 
void setComments (const std::vector< std::string > &inSource)
 
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 setWeakThis (const WeakPointer &inWeakThis)
 
Pointer getSharedThis () const
 

Protected Member Functions

 Property ()
 

Private Attributes

std::string mOwner
 
Unit mUnit
 
Value mValue
 
SymTab< std::string,
PropertySharedPtr
mChildren
 

Friends

class FactoryType< Property >
 

Detailed Description

Represents an EDIF property. EDIF supports placing of simple and nested properties on different objects.

Definition at line 48 of file Property.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< Property >::Pointer
inherited

Definition at line 36 of file SelfReferencing.hpp.

Definition at line 35 of file SelfReferencing.hpp.

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

Definition at line 37 of file SelfReferencing.hpp.

Constructor & Destructor Documentation

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

Definition at line 43 of file Property.cpp.

43 {}
torc::generic::Property::Property ( )
protected

Definition at line 41 of file Property.cpp.

Member Function Documentation

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

Implements torc::generic::Visitable.

Definition at line 32 of file Property.cpp.

32  {
33  try {
34  runVisitor(*this, inoutVisitor);
35  } catch(Error& e) {
36  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
37  throw;
38  }
39 }
void runVisitor(_Tp &inoutVisited, BaseVisitor &inoutVisitor)
Definition: VisitorType.hpp:78

+ Here is the call graph for this function:

bool torc::generic::Property::addChildProperty ( const std::string &  inName,
const PropertySharedPtr inProperty 
)

Add a nested property to this property

Parameters
[in]inNameNested property name
[in]inPropertyNested property

Definition at line 91 of file Property.cpp.

91  {
92  if(!inName.empty()) {
93  return mChildren.set(inName, inProperty);
94  }
95  return false;
96 }
SymTab< std::string, PropertySharedPtr > mChildren
Definition: Property.hpp:168
bool set(const KeyType &inKey, const ValueType &inValue)
Definition: SymTab.hpp:132

+ Here is the call graph for this function:

+ Here is the caller 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
template<typename _Action >
void torc::generic::Property::applyOnAllChildren ( const _Action &  action)
throw (Error
)
inline

Apply action on all children.

Parameters
[in]actionAction to be applied

Definition at line 207 of file Property.hpp.

208  {
209  try {
210  mChildren.applyOnAll(action);
211  } catch(Error& e) {
212  e.setCurrentLocation(__FUNCTION__, __FILE__, __LINE__);
213  throw;
214  }
215 }
SymTab< std::string, PropertySharedPtr > mChildren
Definition: Property.hpp:168
void applyOnAll(const _Action &action)
Definition: SymTab.hpp:192

+ Here is the call graph for this function:

void torc::generic::Property::getChildren ( std::map< std::string, PropertySharedPtr > &  outValues) const
inline

Get the nested properties.

Returns
map Containing properties

Get the nested properties.

Parameters
[out]outValuesmap Containing properties

Definition at line 203 of file Property.hpp.

203  {
204  mChildren.getValueMap(outValues);
205 }
SymTab< std::string, PropertySharedPtr > mChildren
Definition: Property.hpp:168
void getValueMap(UserMap &outMap) const
Definition: SymTab.hpp:171

+ Here is the call graph for this function:

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:

const std::string torc::generic::Property::getOwner ( ) const
inline

Get the owner/source of this property.

Returns
string Owner of this property

Definition at line 194 of file Property.hpp.

194  {
195  return mOwner;
196 }
Pointer torc::generic::SelfReferencing< Property >::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
const Unit torc::generic::Property::getUnit ( ) const
inline

Get the Unit inSource.

Returns
Unit of property.

Definition at line 185 of file Property.hpp.

185  {
186  return mUnit;
187 }
const Value torc::generic::Property::getValue ( ) const
inline

Get the Property inSource.

Returns
Value of property.

Definition at line 176 of file Property.hpp.

176  {
177  return mValue;
178 }
void torc::generic::Property::setChildren ( const std::map< std::string, PropertySharedPtr > &  inSource)

Set the nested properties.

Parameters
[in]inSourceMap containing properties

Definition at line 77 of file Property.cpp.

77  {
78  std::map<std::string, PropertySharedPtr>::const_iterator entry = inSource.begin();
79  std::map<std::string, PropertySharedPtr>::const_iterator end = inSource.end();
80  for(; entry != end; ++entry) {
81  addChildProperty((*entry).first, (*entry).second);
82  }
83 }
bool addChildProperty(const std::string &inName, const PropertySharedPtr &inProperty)
Definition: Property.cpp:91

+ 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::Property::setOwner ( const std::string &  inSource)

Set the owner/source of this property.

Parameters
[in]inSourceOwner of this property

Definition at line 68 of file Property.cpp.

68  {
69  mOwner = inSource;
70 }
void torc::generic::Property::setUnit ( const Unit inSource)

Set the Property inSource unit.

Parameters
[in]inSourceUnit of property.

Definition at line 59 of file Property.cpp.

59  {
60  mUnit = inSource;
61 }
void torc::generic::Property::setValue ( const Value inSource)

Set the Property inSource.

Parameters
[in]inSourceValue of property.

Definition at line 50 of file Property.cpp.

50  {
51  mValue = inSource;
52 }
void torc::generic::SelfReferencing< Property >::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< Property >
friend

Definition at line 54 of file Property.hpp.

Field Documentation

SymTab<std::string, PropertySharedPtr> torc::generic::Property::mChildren
private

Definition at line 168 of file Property.hpp.

std::string torc::generic::Property::mOwner
private

Definition at line 165 of file Property.hpp.

Unit torc::generic::Property::mUnit
private

Definition at line 166 of file Property.hpp.

Value torc::generic::Property::mValue
private

Definition at line 167 of file Property.hpp.


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