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

PrimitiveSet. More...

#include <PrimitiveSet.hpp>

+ Inheritance diagram for torc::physical::PrimitiveSet:
+ Collaboration diagram for torc::physical::PrimitiveSet:

Public Types

typedef
PrimitiveSharedPtrVector::const_iterator 
PrimitiveSharedPtrConstIterator
 Constant iterator for Primitive shared pointers. More...
 
typedef
PrimitiveSharedPtrVector::iterator 
PrimitiveSharedPtrIterator
 Non-constant iterator for Primitive shared pointers. More...
 

Public Member Functions

PrimitiveSharedPtrIterator findPrimitive (const string &inName)
 Find a PrimitiveSet primitive by name. More...
 
bool addPrimitive (PrimitiveSharedPtr &inPrimitivePtr)
 Add a primitive to the PrimitiveSet. More...
 
bool removePrimitive (PrimitiveSharedPtr &inPrimitivePtr)
 Remove a primitive from the PrimitiveSet. More...
 
size_t getPrimitiveCount (void) const
 
PrimitiveSharedPtrConstIterator primitivesBegin (void) const
 Returns the begin constant iterator for primitives. More...
 
PrimitiveSharedPtrConstIterator primitivesEnd (void) const
 Returns the end constant iterator for primitives. More...
 
PrimitiveSharedPtrIterator primitivesBegin (void)
 Returns the begin non-constant iterator for primitives. More...
 
PrimitiveSharedPtrIterator primitivesEnd (void)
 Returns the end non-constant iterator for primitives. More...
 
const stringgetName (void) const
 Returns the object name. More...
 
bool operator== (const Named &rhs) const
 Equality operator. More...
 
const WeakPtrTypegetParentWeakPtr (void) const
 Returns a weak pointer to the parent. More...
 
void setParentWeakPtr (WeakPtrType inParentPtr)
 Sets the weak pointer to the parent. More...
 
void resetParentWeakPtr (void)
 Method to reset and orphan this object. More...
 
const SharedPtrTypegetParentSharedPtr (void) const
 Returns a shared pointer to the parent (WARNING: Does not work right). More...
 

Protected Types

typedef std::string string
 Imported type name. More...
 
typedef boost::weak_ptr< class
PrimitiveSet
WeakPtrType
 Weak pointer of our own type. More...
 
typedef boost::shared_ptr
< class PrimitiveSet
SharedPtrType
 Shared pointer of our own type. More...
 
typedef boost::weak_ptr< class
PrimitiveSet
WeakPtrType
 Weak pointer of our own type. More...
 
typedef boost::shared_ptr
< class PrimitiveSet
SharedPtrType
 Shared pointer of our own type. More...
 

Protected Member Functions

 PrimitiveSet (const string &inName)
 
void setSelfWeakPtr (WeakPtrType inSelfPtr)
 Sets the weak pointer to this object. More...
 
const WeakPtrTypegetSelfWeakPtr (void) const
 Returns a weak pointer to this object. More...
 

Protected Attributes

PrimitiveSharedPtrVector mPrimitives
 Vector of primitive shared pointers. More...
 
string mName
 The name of the object. More...
 
WeakPtrType mParentWeakPtr
 Weak pointer to the parent. More...
 
WeakPtrType mSelfWeakPtr
 Weak pointer this object. More...
 

Friends

class RcFactory
 The Factory class has direct access to our internals. More...
 

Detailed Description

PrimitiveSet.

Definition at line 30 of file PrimitiveSet.hpp.

Member Typedef Documentation

typedef PrimitiveSharedPtrVector::const_iterator torc::physical::PrimitiveSet::PrimitiveSharedPtrConstIterator

Constant iterator for Primitive shared pointers.

Definition at line 51 of file PrimitiveSet.hpp.

typedef PrimitiveSharedPtrVector::iterator torc::physical::PrimitiveSet::PrimitiveSharedPtrIterator

Non-constant iterator for Primitive shared pointers.

Definition at line 53 of file PrimitiveSet.hpp.

typedef boost::shared_ptr<class PrimitiveSet > torc::physical::Progeny< class PrimitiveSet >::SharedPtrType
protectedinherited

Shared pointer of our own type.

Definition at line 35 of file Progeny.hpp.

typedef boost::shared_ptr<class PrimitiveSet > torc::physical::Progenitor< class PrimitiveSet >::SharedPtrType
protectedinherited

Shared pointer of our own type.

Definition at line 52 of file Progenitor.hpp.

typedef std::string torc::physical::PrimitiveSet::string
protected

Imported type name.

Definition at line 40 of file PrimitiveSet.hpp.

typedef boost::weak_ptr<class PrimitiveSet > torc::physical::Progeny< class PrimitiveSet >::WeakPtrType
protectedinherited

Weak pointer of our own type.

Definition at line 33 of file Progeny.hpp.

typedef boost::weak_ptr<class PrimitiveSet > torc::physical::Progenitor< class PrimitiveSet >::WeakPtrType
protectedinherited

Weak pointer of our own type.

Definition at line 50 of file Progenitor.hpp.

Constructor & Destructor Documentation

torc::physical::PrimitiveSet::PrimitiveSet ( const string inName)
inlineprotected

Definition at line 46 of file PrimitiveSet.hpp.

46 : Named(inName), Progenitor<class PrimitiveSet>(){}
Named(const string &inName)
Constructor which must specify the object name.
Definition: Named.hpp:48

Member Function Documentation

bool torc::physical::PrimitiveSet::addPrimitive ( PrimitiveSharedPtr inPrimitivePtr)
inline

Add a primitive to the PrimitiveSet.

Parameters
inPrimitivePtrThe primitive to add.
Returns
true if the primitive was added, or false if a primitive with the same name already exists in the PrimitiveSet.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 67 of file PrimitiveSet.hpp.

67  {
68 /// \todo Acquire mutex.
69 PrimitiveSharedPtrVector::iterator e = mPrimitives.end();
70 PrimitiveSharedPtrVector::iterator result = findPrimitive(inPrimitivePtr->getName());
71 if(result == e) mPrimitives.push_back(inPrimitivePtr);
72 return result == e; // return true if we added the primitive
73 /// \todo Release mutex.
74 }
PrimitiveSharedPtrIterator findPrimitive(const string &inName)
Find a PrimitiveSet primitive by name.
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.

+ Here is the call graph for this function:

PrimitiveSharedPtrIterator torc::physical::PrimitiveSet::findPrimitive ( const string inName)
inline

Find a PrimitiveSet primitive by name.

Parameters
inNameThe primitive name to look for.
Returns
an iterator for the specified primitive, or primitivesEnd() if the name was not found.

Definition at line 59 of file PrimitiveSet.hpp.

59  {
60 NameComparator predicate(inName);
61 return std::find_if(primitivesBegin(), primitivesEnd(), predicate);
62 }
PrimitiveSharedPtrConstIterator primitivesBegin(void) const
Returns the begin constant iterator for primitives.
PrimitiveSharedPtrConstIterator primitivesEnd(void) const
Returns the end constant iterator for primitives.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const string& torc::physical::Named::getName ( void  ) const
inlineinherited

Returns the object name.

Definition at line 51 of file Named.hpp.

51 { return mName; }
string mName
The name of the object.
Definition: Named.hpp:43

+ Here is the caller graph for this function:

const SharedPtrType& torc::physical::Progeny< class PrimitiveSet >::getParentSharedPtr ( void  ) const
inlineinherited

Returns a shared pointer to the parent (WARNING: Does not work right).

Always seems to generate a "Returning reference to temporary" warning, and I cannot figure out why.

It is the caller's responsibility to reset the shared pointer when done.

Todo:
Figure out why Progeny<T>::getParentSharedPtr() yields a "Returning reference to temporary" warning.

Definition at line 59 of file Progeny.hpp.

59 { return mParentWeakPtr.lock(); }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
const WeakPtrType& torc::physical::Progeny< class PrimitiveSet >::getParentWeakPtr ( void  ) const
inlineinherited

Returns a weak pointer to the parent.

Definition at line 47 of file Progeny.hpp.

47 { return mParentWeakPtr; }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
size_t torc::physical::PrimitiveSet::getPrimitiveCount ( void  ) const
inline

Definition at line 91 of file PrimitiveSet.hpp.

91 { return mPrimitives.size(); }
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.
const WeakPtrType& torc::physical::Progenitor< class PrimitiveSet >::getSelfWeakPtr ( void  ) const
inlineinherited

Returns a weak pointer to this object.

Definition at line 68 of file Progenitor.hpp.

68 { return mSelfWeakPtr; }
WeakPtrType mSelfWeakPtr
Weak pointer this object.
Definition: Progenitor.hpp:57
bool torc::physical::Named::operator== ( const Named rhs) const
inlineinherited

Equality operator.

Definition at line 54 of file Named.hpp.

54 { return mName == rhs.mName; }
string mName
The name of the object.
Definition: Named.hpp:43
PrimitiveSharedPtrConstIterator torc::physical::PrimitiveSet::primitivesBegin ( void  ) const
inline

Returns the begin constant iterator for primitives.

Definition at line 94 of file PrimitiveSet.hpp.

94 { return mPrimitives.begin(); }
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.

+ Here is the caller graph for this function:

PrimitiveSharedPtrIterator torc::physical::PrimitiveSet::primitivesBegin ( void  )
inline

Returns the begin non-constant iterator for primitives.

Definition at line 98 of file PrimitiveSet.hpp.

98 { return mPrimitives.begin(); }
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.
PrimitiveSharedPtrConstIterator torc::physical::PrimitiveSet::primitivesEnd ( void  ) const
inline

Returns the end constant iterator for primitives.

Definition at line 96 of file PrimitiveSet.hpp.

96 { return mPrimitives.end(); }
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.

+ Here is the caller graph for this function:

PrimitiveSharedPtrIterator torc::physical::PrimitiveSet::primitivesEnd ( void  )
inline

Returns the end non-constant iterator for primitives.

Definition at line 100 of file PrimitiveSet.hpp.

100 { return mPrimitives.end(); }
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.
bool torc::physical::PrimitiveSet::removePrimitive ( PrimitiveSharedPtr inPrimitivePtr)
inline

Remove a primitive from the PrimitiveSet.

Parameters
inPrimitivePtrThe primitive to remove.
Returns
true if the primitive was removed, or false if the primitive did not exist.
Todo:
Acquire mutex.
Todo:
Release mutex.

Definition at line 78 of file PrimitiveSet.hpp.

78  {
79 /// \todo Acquire mutex.
80 PrimitiveSharedPtrVector::iterator e = mPrimitives.end();
81 PrimitiveSharedPtrVector::iterator result = std::find(mPrimitives.begin(), e, inPrimitivePtr);
82 if(result == e) return false;
83 mPrimitives.erase(result);
84 /// \todo Release mutex.
85 return true;
86 }
PrimitiveSharedPtrVector mPrimitives
Vector of primitive shared pointers.
void torc::physical::Progeny< class PrimitiveSet >::resetParentWeakPtr ( void  )
inlineinherited

Method to reset and orphan this object.

Definition at line 51 of file Progeny.hpp.

51 { mParentWeakPtr.reset(); }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
void torc::physical::Progeny< class PrimitiveSet >::setParentWeakPtr ( WeakPtrType  inParentPtr)
inlineinherited

Sets the weak pointer to the parent.

Definition at line 49 of file Progeny.hpp.

49 { mParentWeakPtr = inParentPtr; }
WeakPtrType mParentWeakPtr
Weak pointer to the parent.
Definition: Progeny.hpp:38
void torc::physical::Progenitor< class PrimitiveSet >::setSelfWeakPtr ( WeakPtrType  inSelfPtr)
inlineprotectedinherited

Sets the weak pointer to this object.

Definition at line 59 of file Progenitor.hpp.

59 { mSelfWeakPtr = inSelfPtr; }
WeakPtrType mSelfWeakPtr
Weak pointer this object.
Definition: Progenitor.hpp:57

Friends And Related Function Documentation

friend class RcFactory
friend

The Factory class has direct access to our internals.

Definition at line 34 of file PrimitiveSet.hpp.

Field Documentation

string torc::physical::Named::mName
protectedinherited

The name of the object.

Definition at line 43 of file Named.hpp.

WeakPtrType torc::physical::Progeny< class PrimitiveSet >::mParentWeakPtr
protectedinherited

Weak pointer to the parent.

Definition at line 38 of file Progeny.hpp.

PrimitiveSharedPtrVector torc::physical::PrimitiveSet::mPrimitives
protected

Vector of primitive shared pointers.

Definition at line 43 of file PrimitiveSet.hpp.

WeakPtrType torc::physical::Progenitor< class PrimitiveSet >::mSelfWeakPtr
protectedinherited

Weak pointer this object.

This weak pointer is kept here to be passed along to our children, allowing them to point back to us without the strong dependency of a shared pointer.

Definition at line 57 of file Progenitor.hpp.


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