TrueReality  v0.1.1912
trBase::UserDataContainer Class Reference

This class hold custom user data. More...

#include <UserDataContainer.h>

Inheritance diagram for trBase::UserDataContainer:
Collaboration diagram for trBase::UserDataContainer:

Public Types

using BaseClass = trBase::Base
 
- Public Types inherited from trBase::Base
using BaseClass = trBase::SmrtClass
 
- Public Types inherited from trBase::SmrtClass
using BaseClass = osg::Referenced
 

Public Member Functions

 UserDataContainer (const std::string name=CLASS_TYPE)
 Holds the class type name for efficient comparisons. More...
 
virtual const std::string & GetType () const override
 Returns the class type. More...
 
virtual trBase::SmrtClassGetUserDataContainer ()
 Returns the user data object. More...
 
virtual const trBase::SmrtClassGetUserDataContainer () const
 Returns the user data object. More...
 
virtual void SetUserDataContainer (trBase::SmrtClass *data)
 Sets the user data object. More...
 
virtual std::vector< std::string > GetDescriptionList ()
 Returns a list of Description strings. More...
 
virtual const std::vector< std::string > GetDescriptionList () const
 Returns a list of Description strings. More...
 
virtual int GetDescriptionListCount ()
 Returns the number of objects stored in the Description list. More...
 
virtual std::string GetDescription (int index=0)
 Returns the specified description. More...
 
virtual const std::string GetDescription (int index=0) const
 Returns the specified description. More...
 
virtual void AddDescription (std::string description)
 Adds a new description string to the list of descriptions. More...
 
virtual void SetDescriptions (std::vector< std::string > descriptions)
 Set a new list of descriptions strings. More...
 
virtual std::vector< trBase::SmrtPtr< trBase::Base > > GetObjectList ()
 Returns the list of all the user objects cast down to Base class. More...
 
virtual const std::vector< trBase::SmrtPtr< trBase::Base > > GetObjectList () const
 Returns the list of all the user objects cast down to Base class. More...
 
virtual int GetObjectListCount ()
 Returns the number of objects stored in the Object list. More...
 
virtual trBase::SmrtPtr< trBase::BaseGetObject (int index=0)
 Returns the specified object. More...
 
virtual const trBase::SmrtPtr< trBase::BaseGetObject (int index=0) const
 Returns the specified object. More...
 
virtual void AddObject (trBase::SmrtPtr< trBase::Base > obj)
 Adds a new object to the object list. More...
 
virtual void SetObjects (std::vector< trBase::SmrtPtr< trBase::Base >> objList)
 Set a new list of objects. More...
 
- Public Member Functions inherited from trBase::Base
 Base (const std::string &name=CLASS_TYPE)
 Holds the class type name for efficient comparisons. More...
 
virtual void SetName (const std::string &name)
 Sets this instances name. More...
 
virtual const std::string & GetName ()
 Returns this instances name. More...
 
virtual const std::string & GetName () const
 Returns this instances name. More...
 
virtual void SetUUID (const trBase::UniqueId &id)
 Overwrites the default internal UUID with the passed in one. More...
 
virtual const trBase::UniqueIdGetUUID (void)
 Returns the instances Universally Unique ID. More...
 
- Public Member Functions inherited from trBase::SmrtClass
 SmrtClass ()
 Adds an easy and swappable access to the base class. More...
 
 SmrtClass (bool threadSafeRefUnref)
 Constructor. More...
 
 SmrtClass (const SmrtClass &inst)
 Copy constructor. More...
 
virtual bool GetThreadSafeRefUnref ()
 Get whether a mutex is used to ensure Ref() and UnRef() are thread safe. More...
 
OpenThreads::Mutex * GetRefMutex () const
 Get the mutex used to ensure thread safety of Ref()/UnRef(). More...
 
int Ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
int Unref () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int UnRefNoDelete () const
 Decrement the reference count by one, indicating that a pointer to this object is no longer referencing it. More...
 
int ReferenceCount () const
 Return the number of pointers currently referencing this object. More...
 

Static Public Attributes

static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trBase::UserDataContainer")
 Adds an easy and swappable access to the base class. More...
 
- Static Public Attributes inherited from trBase::Base
static const trUtil::RefStr CLASS_TYPE = trUtil::RefStr("trBase::Base")
 Adds an easy and swappable access to the base class. More...
 

Protected Member Functions

 ~UserDataContainer ()
 dtor More...
 
- Protected Member Functions inherited from trBase::Base
 ~Base ()
 Base destructor. More...
 
- Protected Member Functions inherited from trBase::SmrtClass
 ~SmrtClass ()
 

Protected Attributes

trBase::SmrtPtr< trBase::SmrtClassmUserDataContainer
 
std::vector< std::string > mDescriptionList
 
std::vector< trBase::SmrtPtr< trBase::Base > > mObjectList
 

Additional Inherited Members

- Static Public Member Functions inherited from trBase::SmrtClass
static OpenThreads::Mutex * GetGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all trBase::SmrtClass. More...
 

Detailed Description

This class hold custom user data.

Since all the objects in this class can be different, it is strongly encouraged to use the Description field to note what objects are stored in the instance.

Definition at line 41 of file UserDataContainer.h.

Member Typedef Documentation

◆ BaseClass

Constructor & Destructor Documentation

◆ UserDataContainer()

trBase::UserDataContainer::UserDataContainer ( const std::string  name = CLASS_TYPE)

Holds the class type name for efficient comparisons.

ctor

Definition at line 30 of file UserDataContainer.cpp.

◆ ~UserDataContainer()

trBase::UserDataContainer::~UserDataContainer ( )
protected

dtor

Definition at line 35 of file UserDataContainer.cpp.

Member Function Documentation

◆ AddDescription()

void trBase::UserDataContainer::AddDescription ( std::string  description)
virtual

Adds a new description string to the list of descriptions.

Definition at line 94 of file UserDataContainer.cpp.

References mDescriptionList.

◆ AddObject()

void trBase::UserDataContainer::AddObject ( trBase::SmrtPtr< trBase::Base obj)
virtual

Adds a new object to the object list.

Definition at line 136 of file UserDataContainer.cpp.

References mObjectList.

◆ GetDescription() [1/2]

std::string trBase::UserDataContainer::GetDescription ( int  index = 0)
virtual

Returns the specified description.

Returns the first one if no index is specified

Definition at line 82 of file UserDataContainer.cpp.

References mDescriptionList.

◆ GetDescription() [2/2]

const std::string trBase::UserDataContainer::GetDescription ( int  index = 0) const
virtual

Returns the specified description.

Returns the first one if no index is specified

Definition at line 88 of file UserDataContainer.cpp.

References mDescriptionList.

◆ GetDescriptionList() [1/2]

std::vector< std::string > trBase::UserDataContainer::GetDescriptionList ( )
virtual

Returns a list of Description strings.

Definition at line 64 of file UserDataContainer.cpp.

References mDescriptionList.

◆ GetDescriptionList() [2/2]

const std::vector< std::string > trBase::UserDataContainer::GetDescriptionList ( ) const
virtual

Returns a list of Description strings.

Definition at line 70 of file UserDataContainer.cpp.

References mDescriptionList.

◆ GetDescriptionListCount()

int trBase::UserDataContainer::GetDescriptionListCount ( )
virtual

Returns the number of objects stored in the Description list.

Definition at line 76 of file UserDataContainer.cpp.

References mDescriptionList.

◆ GetObject() [1/2]

trBase::SmrtPtr< trBase::Base > trBase::UserDataContainer::GetObject ( int  index = 0)
virtual

Returns the specified object.

Returns the first one if no index is specified

Definition at line 124 of file UserDataContainer.cpp.

References mObjectList.

◆ GetObject() [2/2]

const trBase::SmrtPtr< trBase::Base > trBase::UserDataContainer::GetObject ( int  index = 0) const
virtual

Returns the specified object.

Returns the first one if no index is specified

Definition at line 130 of file UserDataContainer.cpp.

References mObjectList.

◆ GetObjectList() [1/2]

std::vector< trBase::SmrtPtr< trBase::Base > > trBase::UserDataContainer::GetObjectList ( )
virtual

Returns the list of all the user objects cast down to Base class.

Definition at line 106 of file UserDataContainer.cpp.

References mObjectList.

◆ GetObjectList() [2/2]

const std::vector< trBase::SmrtPtr< trBase::Base > > trBase::UserDataContainer::GetObjectList ( ) const
virtual

Returns the list of all the user objects cast down to Base class.

Definition at line 112 of file UserDataContainer.cpp.

References mObjectList.

◆ GetObjectListCount()

int trBase::UserDataContainer::GetObjectListCount ( )
virtual

Returns the number of objects stored in the Object list.

Definition at line 118 of file UserDataContainer.cpp.

References mObjectList.

◆ GetType()

const std::string & trBase::UserDataContainer::GetType ( ) const
overridevirtual

Returns the class type.

Implements trBase::Base.

Definition at line 40 of file UserDataContainer.cpp.

References CLASS_TYPE.

◆ GetUserDataContainer() [1/2]

trBase::SmrtClass * trBase::UserDataContainer::GetUserDataContainer ( )
virtual

Returns the user data object.

Definition at line 46 of file UserDataContainer.cpp.

References mUserDataContainer.

◆ GetUserDataContainer() [2/2]

const trBase::SmrtClass * trBase::UserDataContainer::GetUserDataContainer ( ) const
virtual

Returns the user data object.

Definition at line 52 of file UserDataContainer.cpp.

References mUserDataContainer.

◆ SetDescriptions()

void trBase::UserDataContainer::SetDescriptions ( std::vector< std::string >  descriptions)
virtual

Set a new list of descriptions strings.

Definition at line 100 of file UserDataContainer.cpp.

References mDescriptionList.

◆ SetObjects()

void trBase::UserDataContainer::SetObjects ( std::vector< trBase::SmrtPtr< trBase::Base >>  objList)
virtual

Set a new list of objects.

Definition at line 142 of file UserDataContainer.cpp.

References mObjectList.

◆ SetUserDataContainer()

void trBase::UserDataContainer::SetUserDataContainer ( trBase::SmrtClass data)
virtual

Sets the user data object.

Definition at line 58 of file UserDataContainer.cpp.

References mUserDataContainer.

Member Data Documentation

◆ CLASS_TYPE

const trUtil::RefStr trBase::UserDataContainer::CLASS_TYPE = trUtil::RefStr("trBase::UserDataContainer")
static

Adds an easy and swappable access to the base class.

Definition at line 47 of file UserDataContainer.h.

Referenced by GetType().

◆ mDescriptionList

std::vector<std::string> trBase::UserDataContainer::mDescriptionList
protected

◆ mObjectList

std::vector<trBase::SmrtPtr<trBase::Base> > trBase::UserDataContainer::mObjectList
protected

◆ mUserDataContainer

trBase::SmrtPtr<trBase::SmrtClass> trBase::UserDataContainer::mUserDataContainer
protected

Definition at line 146 of file UserDataContainer.h.

Referenced by GetUserDataContainer(), and SetUserDataContainer().


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