![]() |
RTFX
0.3
Real time special effects collaborative visualization and production library.
|
The RTFXData class can be used to create a network or graph of RTFXObjects. It is used as the primary storage mechanism for RTFXObjects at any source. More...
#include <RTFXData.h>
Public Member Functions | |
RTFXData () | |
~RTFXData () | |
void | DeleteObjectMemoryMap () |
void | DeletePropertyMemoryMap () |
void | DeleteParentMemoryVector () |
void | DeleteChildrenMemoryVector () |
void | SetID (boost::uuids::uuid _id) |
void | SetRoot (bool _root) |
void | SetName (std::string _name) |
void | SetDescription (std::string _description) |
boost::uuids::uuid | GetID () |
bool | GetRoot () |
std::string | GetName () |
std::string | GetDescription () |
void | AddProperty (RTFXProperty *_property) |
bool | PropertyExists (boost::uuids::uuid _id, std::string _propertyName) |
void | DeleteProperty (boost::uuids::uuid _id, std::string _propertyName) |
RTFXProperty * | GetProperty (boost::uuids::uuid _id, std::string _propertyName) |
void | AddObject (RTFXObject *_object) |
bool | ObjectExists (boost::uuids::uuid _id) |
bool | ObjectExists (std::string _name) |
RTFXObject * | GetAnObject (boost::uuids::uuid _id) |
RTFXObject * | GetAnObject (std::string _name) |
void | DeleteObject (boost::uuids::uuid _id) |
void | DeleteObject (std::string _name) |
void | DeleteAllWithOwner (boost::uuids::uuid _id) |
std::vector< RTFXData * > * | GetParents () |
std::vector< RTFXData * > * | GetChildren () |
void | AddParent (RTFXData *_parent) |
void | AddChild (RTFXData *_child) |
RTFXData * | FindParent (std::string _name) |
RTFXData * | FindChild (std::string _name) |
void | DeleteParent (std::string _name) |
std::vector< RTFXProperty * > | GetChangedProperties () |
vector< RTFXObject * > | GetNewObjects () |
RTFXData * | GetUpdated () |
void | Rebuild () |
RTFXObject * | FindObjectInGraph (boost::uuids::uuid _id) |
RTFXProperty * | FindPropertyNotAtObjectLevel (boost::uuids::uuid _id, std::string _propertyName) |
RTFXData * | FindChild (boost::uuids::uuid _id) |
vector< RTFXObject * > | GetAllObjects () |
unsigned int | NumberOfObjectsOfType (unsigned int _type) |
bool | AreThereAnyObjectsOfType (unsigned int _type) |
vector< RTFXObject * > | GetObjectsOfType (RTFXObject::RTFXObjectType _objectType) |
void | Merge (RTFXData *_other) |
RTFXBIGINT | GetNumObjects () |
boost::uuids::uuid | GetObjectIDOfTypeAtIndex (unsigned int _type, unsigned int _idx) |
void | UpdateProcessCompleted () |
void | SetLocks (bool _useLocks) |
bool | GetLockStatus () |
void | RemoveObjectReferences (boost::uuids::uuid _id) |
void | RemovePropertyReferences (boost::uuids::uuid _owner, string _name) |
void | AssignOwner (boost::uuids::uuid _owner) |
Private Member Functions | |
bool | MergeObject (RTFXObject *_obj) |
bool | MergeProperty (RTFXProperty *_prop) |
RTFXObject * | FindAnObject (boost::uuids::uuid _id) |
RTFXObject * | FindAnObject (std::string _name) |
template<class Archive > | |
void | serialize (Archive &_ar, const unsigned int _version) |
Private Attributes | |
bool | useLocks |
boost::mutex | graphLock |
boost::uuids::uuid | id |
bool | isRoot |
std::string | name |
std::string | description |
std::map< pair < boost::uuids::uuid, std::string >, RTFXProperty * > | propertyMap |
std::map< boost::uuids::uuid, RTFXObject * > | objectMap |
std::map< std::string, boost::uuids::uuid > | objectMapByName |
std::vector< RTFXData * > | parents |
std::vector< RTFXData * > | children |
std::map < RTFXObject::RTFXObjectType, std::vector < boost::uuids::uuid > > | listOfObjectIdsByType |
Friends | |
class | boost::serialization::access |
The RTFXData class can be used to create a network or graph of RTFXObjects. It is used as the primary storage mechanism for RTFXObjects at any source.
An RTFXData is a node which has some number of parents, and some number of children. The parents and children are of type RTFXData *. Each RTFXData node contains a map of RTFXObjects, and a map of RTFXProperties.
NOTE: Presently, the PARENTS and CHILDREN are not used. The ability to create a tree from RTFXData "nodes" is presently unavailable. Will be added in the future.
An RTFXData can be serialized and sent over the network, or individual components/sub- components can be sent.
An RTFXData has an identification number, along with name and description.
RTFX::RTFXData::RTFXData | ( | ) |
Constructor: initializes the ID to nil, and ROOT to false
References RTFX::verbose().
RTFX::RTFXData::~RTFXData | ( | ) |
Destructor
References RTFX::verbose().
void RTFX::RTFXData::AddChild | ( | RTFXData * | _child | ) |
Add a child to the array. Assumes child has not already been added.
void RTFX::RTFXData::AddObject | ( | RTFXObject * | _object | ) |
Add an RTFXObject to this node. Assumes property does not already exist in map
Add an RTFXObject to this node. Assumes that no object with the same ID exists. When an object is added to an RTFXData, it is also referenced by name and by type for fast access.
References RTFX::RTFXObject::GetID(), RTFX::RTFXObject::GetName(), RTFX::RTFXObject::GetType(), and RTFX::verbose().
void RTFX::RTFXData::AddParent | ( | RTFXData * | _parent | ) |
Add a parent to the array. Assumes parent has not already been added.
void RTFX::RTFXData::AddProperty | ( | RTFXProperty * | _property | ) |
Add a property. Assumes no existing property has the same name
Add a property. Assumes no existing property has the same name and ID. If there is a property with the same ID and name, the map entry will be overwritten with a pointer to the new property, but the memory of the old property will not be freed. So, if adding a property, check first.
References RTFX::RTFXProperty::GetName(), and RTFX::RTFXProperty::GetOwner().
bool RTFX::RTFXData::AreThereAnyObjectsOfType | ( | unsigned int | _type | ) |
Determine if there are any objects of a given type in the RTFXData
References RTFX::RTFXObject::GetType().
|
inline |
Assign Owner to all objects in the Graph and all properties in the graph
References RTFX::RTFXProperty::SetOwner().
void RTFX::RTFXData::DeleteAllWithOwner | ( | boost::uuids::uuid | _id | ) |
Delete objects that are owned by whomever has the provided ID
References RTFX::RTFXObject::GetID(), RTFX::RTFXProperty::GetName(), RTFX::RTFXProperty::GetOwner(), and RTFX::RTFXObject::GetOwner().
void RTFX::RTFXData::DeleteChildrenMemoryVector | ( | ) |
Free the memory in the children vector, but do not call delete on children
void RTFX::RTFXData::DeleteObject | ( | boost::uuids::uuid | _id | ) |
Delete an object from the map. Assumes object exists.
References RTFX::debug(), RTFX::RTFXObject::GetID(), RTFX::RTFXObject::GetName(), and RTFX::RTFXObject::GetType().
void RTFX::RTFXData::DeleteObject | ( | std::string | _name | ) |
Delete an object from the map using the name. Assumes object exists.
References RTFX::debug().
void RTFX::RTFXData::DeleteObjectMemoryMap | ( | ) |
Free memory in object maps, but do not call delete on objects (assume already deleted, or memory used by another process
Free memory in object maps, but do not call delete on objects (assume already deleted)
void RTFX::RTFXData::DeleteParent | ( | std::string | _name | ) |
Delete a parent node from the list
References GetName().
void RTFX::RTFXData::DeleteParentMemoryVector | ( | ) |
Free the memory in the parent vector, but do not call delete on parents
void RTFX::RTFXData::DeleteProperty | ( | boost::uuids::uuid | _id, |
std::string | _propertyName | ||
) |
Delete the property from the map. Assumes property exists.
Delete the property from the map. If the property does not exist, nothing is deleted.
void RTFX::RTFXData::DeletePropertyMemoryMap | ( | ) |
Free memory in property map, but do not call delete on properties
Free memory in property map, but do not call delete on properties (assume already deleted)
|
inlineprivate |
FindAnObject - by name, without lock
References RTFX::debug(), and RTFX::RTFXObject::GetName().
|
inlineprivate |
FindAnObject - by id, without lock. Get a pointer to an object using the name. Assumes object exists.
References RTFX::debug().
RTFXData * RTFX::RTFXData::FindChild | ( | std::string | _name | ) |
Find a child node using a name. Assumes child exists
RTFXData * RTFX::RTFXData::FindChild | ( | boost::uuids::uuid | _id | ) |
Find a child RTFXData node using the ID
RTFXObject * RTFX::RTFXData::FindObjectInGraph | ( | boost::uuids::uuid | _id | ) |
Search the Graph to find and return an object that has a particular id
References RTFX::debug().
RTFXData * RTFX::RTFXData::FindParent | ( | std::string | _name | ) |
Find a parent node using a name. Assumes parent exists
RTFXProperty * RTFX::RTFXData::FindPropertyNotAtObjectLevel | ( | boost::uuids::uuid | _id, |
std::string | propertyName | ||
) |
Search the graph for a property that does not belong to an object. There may be many properties in the tree with the same name, this will return the first.
vector< RTFXObject * > RTFX::RTFXData::GetAllObjects | ( | ) |
Get a vector of all the objects contained in the graph
RTFXObject * RTFX::RTFXData::GetAnObject | ( | boost::uuids::uuid | _id | ) |
Get a pointer to an object using the unique id. Assumes object exists
References RTFX::debug(), RTFX::RTFXObject::GetName(), and RTFX::verbose().
RTFXObject * RTFX::RTFXData::GetAnObject | ( | std::string | _name | ) |
Get a pointer to an object using the name. Assumes object exists.
References RTFX::debug(), and RTFX::verbose().
std::vector< RTFXProperty * > RTFX::RTFXData::GetChangedProperties | ( | ) |
Acquire a list of Properties, from both this Graph node's own stash, and the containing RTFXObjects, which have CHANGED since the last send event. RTFXProperties belonging to RTFXObject's whose NEW flag is set, will NOT be added to the list.
References RTFX::RTFXProperty::GetChanged(), RTFX::RTFXObject::GetChangedProperties(), and RTFX::RTFXObject::GetIsNew().
std::vector< RTFXData * > * RTFX::RTFXData::GetChildren | ( | ) |
Get a pointer to the array of children
std::string RTFX::RTFXData::GetDescription | ( | ) |
Get the description of this node
boost::uuids::uuid RTFX::RTFXData::GetID | ( | ) |
Get the ID of this node
|
inline |
Get the lock value
std::string RTFX::RTFXData::GetName | ( | ) |
Get the name of this node
vector< RTFXObject * > RTFX::RTFXData::GetNewObjects | ( | ) |
Get all RTFXObjects from this node that have their new flag set
References RTFX::RTFXObject::GetIsNew().
RTFXBIGINT RTFX::RTFXData::GetNumObjects | ( | ) |
Get the number of objects in the map
boost::uuids::uuid RTFX::RTFXData::GetObjectIDOfTypeAtIndex | ( | unsigned int | _type, |
unsigned int | _idx | ||
) |
Get the ith ID of the object of specified type
vector< RTFXObject * > RTFX::RTFXData::GetObjectsOfType | ( | RTFXObject::RTFXObjectType | _objectType | ) |
Get a vector all objects of a given type from the RTFXData
References RTFX::RTFXObject::GetType().
std::vector< RTFXData * > * RTFX::RTFXData::GetParents | ( | ) |
Get a pointer to the array of parents
RTFXProperty * RTFX::RTFXData::GetProperty | ( | boost::uuids::uuid | _id, |
std::string | _propertyName | ||
) |
Get a pointer to the named property. Assumes property exists.
Get a pointer to the named property. Returns NULL if property does not exist.
bool RTFX::RTFXData::GetRoot | ( | ) |
Get the ROOT status of this node
RTFXData * RTFX::RTFXData::GetUpdated | ( | ) |
Construct a graph which contains only components from the tree which have their update flags set.
NOTE: At this point in time, GetUpdated does NOT search below the root for updated materials.
References AddObject(), and AddProperty().
void RTFX::RTFXData::Merge | ( | RTFXData * | _other | ) |
Merge an existing RTFXData with this one. CURRENTLY: does not actually perform tree merge, only a top-level merge.
Merge an existing RTFXData with this one. CURRENTLY: does not actually perform tree merge, only a top-level merge. Input: another RTFXData, which is DELETED by this function prior to returning.
References RTFX::debug(), GetAllObjects(), RTFX::performance(), propertyMap, RemoveObjectReferences(), and RemovePropertyReferences().
|
private |
Merge an object into the RTFXData
References RTFX::debug(), RTFX::RTFXObject::GetID(), RTFX::RTFXObject::SetChanged(), RTFX::RTFXObject::Update(), and RTFX::verbose().
|
private |
Merge a property into the RTFXData
References RTFX::RTFXProperty::Copy(), RTFX::debug(), RTFX::RTFXProperty::GetDelete(), RTFX::RTFXProperty::GetName(), RTFX::RTFXProperty::GetOwner(), RTFX::RTFXProperty::GetType(), and RTFX::verbose().
unsigned int RTFX::RTFXData::NumberOfObjectsOfType | ( | unsigned int | _type | ) |
Count the number of objects of a given type that are stored in the RTFXData
References RTFX::RTFXObject::GetType().
bool RTFX::RTFXData::ObjectExists | ( | boost::uuids::uuid | _id | ) |
Determine if an Object exists in the map using the unique id
References RTFX::verbose().
bool RTFX::RTFXData::ObjectExists | ( | std::string | _name | ) |
Determine if an Object exists in the map using the string name
bool RTFX::RTFXData::PropertyExists | ( | boost::uuids::uuid | _id, |
std::string | _propertyName | ||
) |
Determine if a property exists
void RTFX::RTFXData::Rebuild | ( | ) |
Rebuild the structure links after serialization
References Rebuild().
void RTFX::RTFXData::RemoveObjectReferences | ( | boost::uuids::uuid | _id | ) |
Remove all references to a particular object, but DO NOT delete the object
References RTFX::RTFXObject::GetName(), and RTFX::RTFXObject::GetType().
void RTFX::RTFXData::RemovePropertyReferences | ( | boost::uuids::uuid | _owner, |
string | _name | ||
) |
Remove all references to a particular property, but DO NOT delete the property
References RTFX::RTFXObject::RemovePropertyReference().
void RTFX::RTFXData::SetDescription | ( | std::string | _description | ) |
Set the description of the graph
void RTFX::RTFXData::SetID | ( | boost::uuids::uuid | _id | ) |
Set the ID of this node
|
inline |
Turn locks on or off. True means on, False means off.
void RTFX::RTFXData::SetName | ( | std::string | _name | ) |
Set the name graph
void RTFX::RTFXData::SetRoot | ( | bool | _root | ) |
Set the ROOT flag of this node, but only if this node is the absolute root
void RTFX::RTFXData::UpdateProcessCompleted | ( | ) |
Reset all changed properties to false
References RTFX::RTFXObject::SetAllPropertyChanged(), RTFX::RTFXProperty::SetChanged(), RTFX::RTFXObject::SetChanged(), and RTFX::RTFXObject::SetNew().
|
friend |
Locking mechanism so you can't read and write object at same time
|
private |
A vector of pointers to the child Graphs
|
private |
A description of this node or graph, this is optional
|
private |
A data lock
|
private |
Unique identifier of this node
|
private |
A flag which indicates if this is the absolute ROOT of the graph
|
private |
Keep a list of the IDs for each type of RTFXObject contained at this node
|
private |
The name of this node or graph, this is optional
|
private |
A map of local RTFXObjects, identified by UUID
|
private |
A map of the local RTFXObject, using the name as a key. This is for more human-happy access. It also implies that object names must be unique, which we can't guarantee to be true.
|
private |
A vector of pointers to the parent Graphs
|
private |
A map of local properties, identified by NAME, not id number
|
private |
This boolean controls whether locks will be used or not. Default value is false.