Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Attributes | List of all members
Mezzanine::Resource::AssetGroup Class Reference

This is a class that stores a specific grouping of Assets, usually based on thier location. More...

#include <assetgroup.h>

+ Collaboration diagram for Mezzanine::Resource::AssetGroup:

Public Types

typedef std::map< String, DataStreamPtrAssetContainer
 Container class for storing DataStream instances in this class.
 
typedef AssetContainer::iterator AssetIterator
 Iterator type for DataStream instances stored in this class.
 
typedef AssetContainer::const_iterator ConstAssetIterator
 Const Iterator type for DataStream instances stored in this class.
 
typedef UnnamedAssetContainer::const_iterator ConstUnnamedAssetIterator
 Const Iterator type for DataStream instances stored by this class.
 
typedef std::vector< Resource::DataStreamPtrUnnamedAssetContainer
 Basic container type for DataStream storage by this class.
 
typedef UnnamedAssetContainer::iterator UnnamedAssetIterator
 Iterator type for DataStream instances stored by this class.
 

Public Member Functions

 AssetGroup (const String &GroupName)
 Class constructor. More...
 
 ~AssetGroup ()
 Class destructor.
 
Resource::DataStreamPtr CreateDataStream (void *Buffer, const UInt32 BufferSize)
 Creates a stream from a memory buffer. More...
 
Resource::DataStreamPtr CreateDataStream (const String &AssetName, void *Buffer, const UInt32 BufferSize)
 Creates a named stream from a memory buffer. More...
 
const StringGetName () const
 Gets the name of this asset group. More...
 
void InitializeAssets ()
 Prepares some Assets for use within this group. More...
 
Resource::DataStreamPtr OpenAssetStream (const String &AssetName)
 Opens a stream to an asset in an AssetGroup. More...
 

Protected Attributes

AssetContainer GroupAssets
 Container storing all of the named open streams belonging to this group. More...
 
String Name
 The name of this group. More...
 
UnnamedAssetContainer UnnamedGroupAssets
 Container storing all of the unnamed open streams bleonging to this group. More...
 

Detailed Description

This is a class that stores a specific grouping of Assets, usually based on thier location.

Definition at line 53 of file assetgroup.h.

Constructor & Destructor Documentation

Mezzanine::Resource::AssetGroup::AssetGroup ( const String GroupName)

Class constructor.

Parameters
GroupNameThe name to be given to this group.

Definition at line 53 of file assetgroup.cpp.

Member Function Documentation

Resource::DataStreamPtr Mezzanine::Resource::AssetGroup::CreateDataStream ( void *  Buffer,
const UInt32  BufferSize 
)

Creates a stream from a memory buffer.

Note
The created stream will take ownership of the buffer you provide. If you want it to have a separate buffer then create a copy and pass that in.
Parameters
BufferA pointer to the memory to stream from.
BufferSizeThe size of the provided buffer in bytes.
Returns
Returns a CountedPtr to the stream to the provided buffer.

Definition at line 97 of file assetgroup.cpp.

Resource::DataStreamPtr Mezzanine::Resource::AssetGroup::CreateDataStream ( const String AssetName,
void *  Buffer,
const UInt32  BufferSize 
)

Creates a named stream from a memory buffer.

Note
The created stream will take ownership of the buffer you provide. If you want it to have a separate buffer then create a copy and pass that in.
Parameters
AssetNameThe name to be given to the created stream.
BufferA pointer to the memory to stream from.
BufferSizeThe size of the provided buffer in bytes.
Returns
Returns a CountedPtr to the stream to the provided buffer.

Definition at line 104 of file assetgroup.cpp.

const String & Mezzanine::Resource::AssetGroup::GetName ( ) const

Gets the name of this asset group.

Returns
Returns a const reference to a string containing the name of this group.

Definition at line 67 of file assetgroup.cpp.

void Mezzanine::Resource::AssetGroup::InitializeAssets ( )

Prepares some Assets for use within this group.

After adding all of your assets and declaring them as nessessary, this function is the final step. After calling this function any and all assets within the defined group will be ready to use. Do not initialize any more groups then you need to however, as that will take up memory and drop performance.

Definition at line 72 of file assetgroup.cpp.

Resource::DataStreamPtr Mezzanine::Resource::AssetGroup::OpenAssetStream ( const String AssetName)

Opens a stream to an asset in an AssetGroup.

Parameters
AssetNameThe identity of the asset to be opened (commonly a file name).
Todo:
This entire method is a bit of a hack. When the resource system gets refactored it should go through our archives or whatever equivalent. Since we currently have to put up with Ogre's system, we'll use it for now as a hack.

Definition at line 80 of file assetgroup.cpp.

Member Data Documentation

AssetContainer Mezzanine::Resource::AssetGroup::GroupAssets
protected

Container storing all of the named open streams belonging to this group.

Definition at line 74 of file assetgroup.h.

String Mezzanine::Resource::AssetGroup::Name
protected

The name of this group.

Definition at line 77 of file assetgroup.h.

UnnamedAssetContainer Mezzanine::Resource::AssetGroup::UnnamedGroupAssets
protected

Container storing all of the unnamed open streams bleonging to this group.

Definition at line 71 of file assetgroup.h.


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