Emergency 2017 Dokumentation  v3.0.1
em5::FireMaterialManager Class Reference

Manager contains all fire materials. More...

#include <FireMaterialManager.h>

Public Member Functions

 FireMaterialManager ()
 Default constructor. More...
 
virtual ~FireMaterialManager ()
 Destructor. More...
 
void loadAssets ()
 Load the assets. More...
 
void saveAssets ()
 Save the assets. More...
 
bool loadByFilename (const std::string &filename)
 Load fire material JSON file. More...
 
bool saveByFilename (const std::string &filename)
 Save fire material JSON file. More...
 
const FireMaterialgetFireMaterialByName (const std::string &name)
 Find fire material by name. More...
 
std::string findUniqueNameForMaterial (const std::string &name)
 Find a unique name for the fire material; used if the user entered a name that is already taken. More...
 
bool getContentHasChanged () const
 
void setContentHasChanged (bool contentHasChanged)
 Flag content of fire material manager as dirty. More...
 
const FireMaterialgetOrCreateDefaultMaterial ()
 Return the default fire material, in case there is non, create one. More...
 
void setIsEditing (bool isEditing, qsf::AssetRevision assetRevision=-1)
 Let the manager know if the fire materials assets are currently be edited. More...
 
- Public Member Functions inherited from qsf::ElementManager< uint32, FireMaterial >
 ElementManager ()
 Default constructor. More...
 
virtual ~ElementManager ()
 Destructor. More...
 
const ElementMapgetElements () const
 Return map of elements. More...
 
FireMaterial * findElement (const uint32 &key) const
 Find a specific element by its key in either the element map. More...
 
void reserveElements (size_t numberOfElements)
 Reserve elements. More...
 
FireMaterial * createElement ()
 Create a new element. More...
 
FireMaterial * createElementById (const uint32 &key)
 Create a new element with an enforced given unique element identifier. More...
 
bool insertElement (const uint32 &key, FireMaterial &element)
 Insert an element with an enforced given unique element identifier. More...
 
bool destroyElement (const uint32 &key)
 Destroy an element by its key. More...
 
ElementManager< uint32, FireMaterial, detail::DirectAllocator< FireMaterial >, ConsecutiveIdGenerator< uint32 > >::ElementMap::iterator destroyElement (typename ElementMap::iterator iterator)
 Destroy an element by iterator. More...
 
void destroyAllElements ()
 Destroy all elements. More...
 
FireMaterial * grabElement (const uint32 &key)
 Remove an element from the element manager without destroying it. More...
 
uint32 generateId ()
 Generate a new, unused key. More...
 

Public Attributes

boost::signals2::signal< void()> FireMaterialsChanged
 This Boost signal is emitted after the asset of the fire materials got changed (updated/deleted) More...
 

Protected Member Functions

virtual void onElementInsertion (const uint32 &key, FireMaterial &element) override
 
virtual void onElementRemoval (const uint32 &key, FireMaterial &element) override
 
- Protected Member Functions inherited from qsf::ElementManager< uint32, FireMaterial >
ElementMapgetElementsWritable ()
 Return map of elements. More...
 
virtual void onElementInsertion (const uint32 &key, FireMaterial &element)
 Called whenever an element is inserted into the element map. More...
 
virtual void onElementRemoval (const uint32 &key, FireMaterial &element)
 Called whenever an element is actually going to be destroyed. More...
 
- Protected Member Functions inherited from qsf::Manager
 Manager ()
 Default constructor. More...
 
virtual ~Manager ()
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from qsf::ElementManager< uint32, FireMaterial >
typedef boost::container::flat_map< uint32, FireMaterial * > ElementMap
 

Detailed Description

Manager contains all fire materials.

Note
  • Use "EM5_FIRE.getFireMaterialByName("FireMaterialName")" to get the specific material

Definition at line 47 of file FireMaterialManager.h.

Constructor & Destructor Documentation

em5::FireMaterialManager::FireMaterialManager ( )

Default constructor.

virtual em5::FireMaterialManager::~FireMaterialManager ( )
virtual

Destructor.

Member Function Documentation

std::string em5::FireMaterialManager::findUniqueNameForMaterial ( const std::string &  name)

Find a unique name for the fire material; used if the user entered a name that is already taken.

Parameters
[in]nameThe name the user entered
Returns
The unique generated name
Note
  • See qsf::MapHelper::findUniqueNameforEntity for reference
bool em5::FireMaterialManager::getContentHasChanged ( ) const
inline

Return true if the content is not matching the saved

Definition at line 14 of file FireMaterialManager-inl.h.

const FireMaterial* em5::FireMaterialManager::getFireMaterialByName ( const std::string &  name)

Find fire material by name.

Parameters
[in]nameName where searching for
Returns
The fire material found, can be a null pointer
const FireMaterial* em5::FireMaterialManager::getOrCreateDefaultMaterial ( )

Return the default fire material, in case there is non, create one.

Note
  • Automatically called in after loading, default material must always be valid.
void em5::FireMaterialManager::loadAssets ( )

Load the assets.

bool em5::FireMaterialManager::loadByFilename ( const std::string &  filename)

Load fire material JSON file.

Parameters
[in]filenamePath of the file to load
virtual void em5::FireMaterialManager::onElementInsertion ( const uint32 key,
FireMaterial element 
)
overrideprotectedvirtual
virtual void em5::FireMaterialManager::onElementRemoval ( const uint32 key,
FireMaterial element 
)
overrideprotectedvirtual
void em5::FireMaterialManager::saveAssets ( )

Save the assets.

bool em5::FireMaterialManager::saveByFilename ( const std::string &  filename)

Save fire material JSON file.

Parameters
[in]filenamePath of the file to save
void em5::FireMaterialManager::setContentHasChanged ( bool  contentHasChanged)
inline

Flag content of fire material manager as dirty.

Note
  • Automatically reseted after saving the assets

Definition at line 19 of file FireMaterialManager-inl.h.

void em5::FireMaterialManager::setIsEditing ( bool  isEditing,
qsf::AssetRevision  assetRevision = -1 
)
inline

Let the manager know if the fire materials assets are currently be edited.

Parameters
[in]isEditingIndicates if editing is enabled or not
[in]assetRevisionThe revision of the asset which the asset will have after editing -> Is used to ignore asset mount/umount events for the localy changed asset of fire materials
Todo:
  • TODO(sw) remove the qsf::AssetRevision parameter as soon as this information can be gathered inside the manager

Definition at line 25 of file FireMaterialManager-inl.h.

Member Data Documentation

boost::signals2::signal<void ()> em5::FireMaterialManager::FireMaterialsChanged

This Boost signal is emitted after the asset of the fire materials got changed (updated/deleted)

Definition at line 55 of file FireMaterialManager.h.


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