Emergency 2017 Dokumentation  v3.0.1
qsf::ParameterGroupManager Class Reference

Abstract parameter groups group manager class. More...

#include <ParameterGroupManager.h>

Public Member Functions

virtual ~ParameterGroupManager ()
 Destructor. More...
 
void setParametersToDefaultValues ()
 Set all parameters to their default values. More...
 
bool loadByAbsoluteFilename (const std::string &filename, const std::string *formatTypeOverride=nullptr, bool showMessageBoxOnParserError=false, bool setToDefaults=true)
 Load a parameter group by using a given absolute filename. More...
 
bool saveByAbsoluteFilename (const std::string &filename, bool differenceToDefault=false)
 Save the parameter group by using a given absolute filename. More...
 
const std::string & getFilename () const
 Return the absolute filename of the parameter group. More...
 
- Public Member Functions inherited from qsf::PluginableManager
virtual ~PluginableManager ()
 Destructor. More...
 
const std::vector< PluginableBase * > & getPluginableList () const
 Return the list of all available pluginable instances. More...
 
template<typename T >
const std::vector< T * > & getList () const
 Return the list of all available pluginable instances. More...
 
PluginableBasegetPluginableByCampClass (const camp::Class &campClass) const
 Return a pluginable instance by using a given CAMP reflection class. More...
 
PluginableBasegetPluginableById (const StringHash &id) const
 Return a pointer to a pluginable instance by using its unique identifier. More...
 
template<typename T >
T * get () const
 Return a pointer to a pluginable instance of a certain type. More...
 
template<typename T >
T * getById (const StringHash &id) const
 Return a pointer to a pluginable instance by using its unique identifier. More...
 
template<typename T >
T & getSafe () const
 Return a reference to a pluginable instance of a certain type. More...
 
template<typename T >
T & getByIdSafe (const StringHash &id) const
 Return a reference to a pluginable instance by using its unique identifier. More...
 

Public Attributes

boost::signals2::signal< void(const ParameterGroup &, uint32)> PropertyChanged
 This Boost signal is emitted when a property of one of the parameter groups was changed; parameter: parameter group instance, unique class property ID inside the parameter group class. More...
 

Protected Member Functions

 ParameterGroupManager ()
 Default constructor. More...
 
- Protected Member Functions inherited from qsf::PluginableManager
 PluginableManager ()
 Default constructor. More...
 
void registerPluginables ()
 Register all known and supported CAMP pluginable classes. More...
 
PluginableBaseregisterPluginable (const camp::Class &added)
 Register the given CAMP pluginable class. More...
 
void injectPluginable (uint32 id, PluginableBase &pluginableBase)
 Insert the given pluginable in the internal data structure of the pluginable manager. More...
 
virtual void classAdded (const camp::Class &added)
 Called after a new CAMP class has been registered. More...
 
virtual void createPluginableInstance (const camp::Class &added, camp::UserObject &campUserObject)
 Create an instance of the given CAMP pluginable class. More...
 
virtual void unregisterPluginables ()
 Unregister all known and supported CAMP pluginable classes. More...
 
- Protected Member Functions inherited from qsf::Manager
 Manager ()
 Default constructor. More...
 
virtual ~Manager ()
 Destructor. More...
 

Additional Inherited Members

- Protected Attributes inherited from qsf::PluginableManager
std::vector< PluginableBase * > mPluginables
 List of all available pluginable instances, we have to destroy the instances if we no longer need them. More...
 
boost::container::flat_map< uint32, PluginableBase * > mPluginableMap
 Pluginable map with unique pluginable identifier as key and pointer to the pluginable as value. More...
 

Detailed Description

Abstract parameter groups group manager class.

Definition at line 44 of file ParameterGroupManager.h.

Constructor & Destructor Documentation

virtual qsf::ParameterGroupManager::~ParameterGroupManager ( )
virtual

Destructor.

qsf::ParameterGroupManager::ParameterGroupManager ( )
protected

Default constructor.

Member Function Documentation

const std::string& qsf::ParameterGroupManager::getFilename ( ) const

Return the absolute filename of the parameter group.

Returns
The absolute UTF-8 filename in platform-independent notation of the parameter group, do no destroy the returned instance
Note
  • There's no "setFilename()"-method by intent
bool qsf::ParameterGroupManager::loadByAbsoluteFilename ( const std::string &  filename,
const std::string *  formatTypeOverride = nullptr,
bool  showMessageBoxOnParserError = false,
bool  setToDefaults = true 
)

Load a parameter group by using a given absolute filename.

Parameters
[in]filenameAbsolute UTF-8 filename in platform-independent notation of the parameter group to load
[in]formatTypeOverrideIf not a null pointer, this format type string is overriding the default format type required in the JSON
[in]showMessageBoxOnParserErrorIf "true", show a message box to the user if a parser error occurs reading the file
[in]setToDefaultsIf "true", all properties are reset to their defaults before loading
Returns
"true" if all went fine, else "false" (file not found?)
Note
  • The current parameter group will get lost, so, you might want to save a manipulated parameter group before loading a new one
  • On success, automatically makes the given filename to the internally stored parameter group filename
Todo:
  • TODO(co) For now, we only support JSON
bool qsf::ParameterGroupManager::saveByAbsoluteFilename ( const std::string &  filename,
bool  differenceToDefault = false 
)

Save the parameter group by using a given absolute filename.

Parameters
[in]filenameAbsolute UTF-8 filename in platform-independent notation of the parameter group to save
[in]differenceToDefaultDo not save properties which have the default value (meaning we already know its value without having to read it when loading)
Returns
"true" if all went fine, else "false"
Note
  • On success, automatically makes the given filename to the internally stored parameter group filename
Todo:
  • TODO(co) For now, we only support JSON
void qsf::ParameterGroupManager::setParametersToDefaultValues ( )

Set all parameters to their default values.

Member Data Documentation

boost::signals2::signal<void (const ParameterGroup&, uint32)> qsf::ParameterGroupManager::PropertyChanged

This Boost signal is emitted when a property of one of the parameter groups was changed; parameter: parameter group instance, unique class property ID inside the parameter group class.

Definition at line 52 of file ParameterGroupManager.h.


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