Om
1.0.0
A universal framework for multimedia simulation
|
A class that represents a generic collection of arbitrarily-typed resource objects. More...
#include <omResourceSet.h>
Public Member Functions | |
ResourceSet () | |
Create a new empty resource set that has no stored resources. More... | |
ResourceSet (const ResourceSet &other) | |
Create a copy of another resource set, copying all of its stored resources. More... | |
virtual | ~ResourceSet () |
Destroy an resource set, deallocating all stored resources. More... | |
ResourceSet & | operator= (const ResourceSet &other) |
Assign the contents of one resource set to another, copying all stored resources. More... | |
Size | getTypeCount () const |
Return the number of resource types that this resource set contains. More... | |
ResourceTypeSetBase * | getType (Index typeIndex) |
Return a pointer to the object that manages the resource type at the specified index. More... | |
const ResourceTypeSetBase * | getType (Index typeIndex) const |
Return a pointer to the object that manages the resource type at the specified index. More... | |
Bool | getTypeIndex (const ResourceType &type, ResourceLocalID &typeIndex) const |
Get the index of the specified resource type within this resource set. More... | |
template<typename DataType > | |
Resource< DataType > * | getResource () |
Return a pointer to the first resource that the resource set has for the specified type. More... | |
template<typename DataType > | |
const Resource< DataType > * | getResource () const |
Return a const pointer to the first resource that the resource set has for the specified type. More... | |
template<typename DataType > | |
Resource< DataType > * | getResource (const UTF8String &name) |
Return a pointer to the resource that the resource set has for the specified type and with the given name. More... | |
template<typename DataType > | |
const Resource< DataType > * | getResource (const UTF8String &name) const |
Return a const pointer to the resource that the resource set has for the specified type and with the given name. More... | |
template<typename DataType > | |
Resource< DataType > * | getResource (const ResourceID &identifier) |
Return a const pointer to the resource that the resource set has for the specified type and with the given ID. More... | |
template<typename DataType > | |
const Resource< DataType > * | getResource (const ResourceID &identifier) const |
Return a const pointer to the resource that the resource set has for the specified type and with the given ID. More... | |
template<typename DataType > | |
Resource< DataType > * | getResource (ResourceLocalID localID) |
Return a const pointer to the resource of the templated type at the given index within its type set. More... | |
template<typename DataType > | |
const Resource< DataType > * | getResource (ResourceLocalID localID) const |
Return a const pointer to the resource of the templated type at the given index within its type set. More... | |
void * | getResourceData (const ResourceType &type, ResourceLocalID localID) const |
Return a an opaque pointer to the resource data at the given index within its type set. More... | |
OpaqueResource | getResource (const ResourceType &type, ResourceLocalID localID) const |
Return an opaque resource at the given local ID within its type set. More... | |
OpaqueResource | getResource (ResourceLocalID localTypeID, ResourceLocalID localID) const |
Return an opaque resource at the given local IDs within its type set. More... | |
const ResourceID * | getResourceID (const ResourceType &type, const void *resource) const |
Return a pointer to the ID for the resource with the given type and opaque data pointer. More... | |
template<typename DataType > | |
Bool | getResourceLocalID (const DataType *resource, ResourceLocalID &localID) const |
Get the index within its data type for the resource with the given raw data pointer in the output parameter. More... | |
template<typename DataType > | |
ResourceLocalID | getResourceLocalID (const DataType *resource) const |
Return the index for the resource with the given raw data pointer. More... | |
Bool | getResourceLocalID (const ResourceType &type, const void *resource, ResourceLocalID &localID) const |
Get the index for the resource with the given type and opaque data pointer in the output parameter. More... | |
ResourceLocalID | getResourceLocalID (const ResourceType &type, const void *resource) const |
Return the index for the resource with the given resource type and raw data pointer. More... | |
Bool | getResourceLocalIDs (const ResourceType &type, const void *resource, ResourceLocalID &typeID, ResourceLocalID &localID) const |
Get the type index and local index for the resource with the given type and opaque data pointer in the output parameter. More... | |
template<typename DataType > | |
ResourceTypeSet< DataType > * | getResources () |
Return a pointer to a set of resources of the specified template type. More... | |
template<typename DataType > | |
const ResourceTypeSet< DataType > * | getResources () const |
Return a const pointer to a set of resources of the specified template type. More... | |
ResourceTypeSetBase * | getResources (const ResourceType &type) |
Return a pointer to a set of resources of the specified resource type. More... | |
const ResourceTypeSetBase * | getResources (const ResourceType &type) const |
Return a const pointer to a set of resources of the specified resource type. More... | |
const ResourceType * | getResourceType (const ResourceType &type) const |
Return a pointer to a global resource type object that matches the specified resource type. More... | |
template<typename DataType > | |
Bool | addResource (const Resource< DataType > &resource) |
Add the specified resource to this resource set. More... | |
void | addResources (const ResourceSet &resources) |
Add all resources from another resource set to this one. More... | |
template<typename DataType > | |
Bool | removeResource (const DataType *resource) |
Remove the specified resource from this resource set if it exists. More... | |
template<typename DataType > | |
Bool | removeResource (const UTF8String &name) |
Remove the resource with the specified name from this resource set if it exists. More... | |
Bool | removeResource (const OpaqueResource &resource) |
Remove the specified opaque resource from this resource set. More... | |
template<typename DataType > | |
Bool | removeResources () |
Remove all resources with the specified resource type from this resource set. More... | |
void | clearResources () |
Remove all resources from this resource set. More... | |
const UTF8String & | getName () const |
Return a reference to a string representing the name of this resource set. More... | |
void | setName (const UTF8String &newName) |
Return a reference to a string representing the name of this resource set. More... | |
const UTF8String & | getDescription () const |
Return a reference to a string representing the name of this resource set. More... | |
void | setDescription (const UTF8String &newDescription) |
Return a reference to a string representing the name of this resource set. More... | |
Static Public Attributes | |
static const ResourceType | RESOURCE_TYPE |
The resource type for a resource set. More... | |
A class that represents a generic collection of arbitrarily-typed resource objects.
om::resources::ResourceSet::ResourceSet | ( | ) |
Create a new empty resource set that has no stored resources.
om::resources::ResourceSet::ResourceSet | ( | const ResourceSet & | other | ) |
Create a copy of another resource set, copying all of its stored resources.
|
virtual |
Destroy an resource set, deallocating all stored resources.
ResourceSet& om::resources::ResourceSet::operator= | ( | const ResourceSet & | other | ) |
Assign the contents of one resource set to another, copying all stored resources.
|
inline |
Return the number of resource types that this resource set contains.
|
inline |
Return a pointer to the object that manages the resource type at the specified index.
|
inline |
Return a pointer to the object that manages the resource type at the specified index.
Bool om::resources::ResourceSet::getTypeIndex | ( | const ResourceType & | type, |
ResourceLocalID & | typeIndex | ||
) | const |
Get the index of the specified resource type within this resource set.
|
inline |
Return a pointer to the first resource that the resource set has for the specified type.
If the resource set does not have any resources for the specified template type, NULL is returned.
|
inline |
Return a const pointer to the first resource that the resource set has for the specified type.
If the resource set does not have any resources for the specified template type, NULL is returned.
|
inline |
Return a pointer to the resource that the resource set has for the specified type and with the given name.
If the resource set does not have any resources for the specified template type and a matching name string, NULL is returned.
|
inline |
Return a const pointer to the resource that the resource set has for the specified type and with the given name.
If the resource set does not have any resources for the specified template type and a matching name string, NULL is returned.
|
inline |
Return a const pointer to the resource that the resource set has for the specified type and with the given ID.
If the resource set does not have any resources for the specified template type and a matching ID, NULL is returned.
|
inline |
Return a const pointer to the resource that the resource set has for the specified type and with the given ID.
If the resource set does not have any resources for the specified template type and a matching ID, NULL is returned.
|
inline |
Return a const pointer to the resource of the templated type at the given index within its type set.
If there is no resource of the templated type or index, NULL is returned.
|
inline |
Return a const pointer to the resource of the templated type at the given index within its type set.
If there is no resource of the templated type or index, NULL is returned.
void* om::resources::ResourceSet::getResourceData | ( | const ResourceType & | type, |
ResourceLocalID | localID | ||
) | const |
Return a an opaque pointer to the resource data at the given index within its type set.
If there is no resource of the specified type or index, NULL is returned.
OpaqueResource om::resources::ResourceSet::getResource | ( | const ResourceType & | type, |
ResourceLocalID | localID | ||
) | const |
Return an opaque resource at the given local ID within its type set.
If there is no resource of the specified type or index, a NULL resource is returned.
OpaqueResource om::resources::ResourceSet::getResource | ( | ResourceLocalID | localTypeID, |
ResourceLocalID | localID | ||
) | const |
Return an opaque resource at the given local IDs within its type set.
If there is no resource of the specified type or index, a NULL resource is returned.
const ResourceID* om::resources::ResourceSet::getResourceID | ( | const ResourceType & | type, |
const void * | resource | ||
) | const |
Return a pointer to the ID for the resource with the given type and opaque data pointer.
If the resource set does not contain the given resource type or resource, the method fails and NULL is returned.
|
inline |
Get the index within its data type for the resource with the given raw data pointer in the output parameter.
If the resource set does not contain the given resource, the method fails and FALSE is returned.
|
inline |
Return the index for the resource with the given raw data pointer.
If the resource set does not contain the given resource, the method returns ResourceID::INVALID_LOCAL_ID.
Bool om::resources::ResourceSet::getResourceLocalID | ( | const ResourceType & | type, |
const void * | resource, | ||
ResourceLocalID & | localID | ||
) | const |
Get the index for the resource with the given type and opaque data pointer in the output parameter.
If the resource set does not contain the given resource type or resource, the method fails and FALSE is returned.
ResourceLocalID om::resources::ResourceSet::getResourceLocalID | ( | const ResourceType & | type, |
const void * | resource | ||
) | const |
Return the index for the resource with the given resource type and raw data pointer.
If the resource set does not contain the given resource, the method returns ResourceID::INVALID_LOCAL_ID.
Bool om::resources::ResourceSet::getResourceLocalIDs | ( | const ResourceType & | type, |
const void * | resource, | ||
ResourceLocalID & | typeID, | ||
ResourceLocalID & | localID | ||
) | const |
Get the type index and local index for the resource with the given type and opaque data pointer in the output parameter.
If the resource set does not contain the given resource type or resource, the method fails and FALSE is returned.
|
inline |
Return a pointer to a set of resources of the specified template type.
If the resource set does not have any resources for the specified template type, NULL is returned.
|
inline |
Return a const pointer to a set of resources of the specified template type.
If the resource set does not have any resources for the specified template type, NULL is returned.
ResourceTypeSetBase* om::resources::ResourceSet::getResources | ( | const ResourceType & | type | ) |
Return a pointer to a set of resources of the specified resource type.
If the resource set does not have any resources for the specified resource type, NULL is returned.
const ResourceTypeSetBase* om::resources::ResourceSet::getResources | ( | const ResourceType & | type | ) | const |
Return a const pointer to a set of resources of the specified resource type.
If the resource set does not have any resources for the specified resource type, NULL is returned.
const ResourceType* om::resources::ResourceSet::getResourceType | ( | const ResourceType & | type | ) | const |
Return a pointer to a global resource type object that matches the specified resource type.
If there is no valid resource type, NULL is returned.
|
inline |
Add the specified resource to this resource set.
The method returns whether or not adding the resource was successful.
void om::resources::ResourceSet::addResources | ( | const ResourceSet & | resources | ) |
Add all resources from another resource set to this one.
|
inline |
Remove the specified resource from this resource set if it exists.
If the resource set contains a resource that is equal in type and value to the specified resource, the resource is removed and TRUE is returned. Otherwise, FALSE is returned and the resource set is unchanged.
|
inline |
Remove the resource with the specified name from this resource set if it exists.
If the resource set contains a resource that is equal in type and has the specified name, the resource is removed and TRUE is returned. Otherwise, FALSE is returned and the resource set is unchanged.
Bool om::resources::ResourceSet::removeResource | ( | const OpaqueResource & | resource | ) |
Remove the specified opaque resource from this resource set.
If the resource set contains a resource that is equal in type and has the specified name, the resource is removed and TRUE is returned. Otherwise, FALSE is returned and the resource set is unchanged.
|
inline |
Remove all resources with the specified resource type from this resource set.
If the resource set contains any resources that have the specified type, the resources are removed and TRUE is returned. Otherwise, FALSE is returned and the resource set is unchanged.
void om::resources::ResourceSet::clearResources | ( | ) |
Remove all resources from this resource set.
|
inline |
Return a reference to a string representing the name of this resource set.
|
inline |
Return a reference to a string representing the name of this resource set.
|
inline |
Return a reference to a string representing the name of this resource set.
|
inline |
Return a reference to a string representing the name of this resource set.
|
static |
The resource type for a resource set.