#include <parameterservice.h>
Public Types | |
| using | PresetFileList = std::vector< std::string > |
Public Member Functions | |
| ParameterService (ServiceConfiguration *configuration) | |
| PresetFileList | getPresets (const ParameterGroup &group) const |
| bool | loadPreset (ParameterGroup &group, const std::string &presetFile, utility::ErrorState &errorState) |
| bool | savePreset (ParameterGroup &group, const std::string &presetFile, utility::ErrorState &errorState) |
| std::string | getPresetPath (const std::string &groupID, const std::string &filename) const |
| std::string | getGroupPresetDirectory (const std::string &groupID) const |
Public Member Functions inherited from Service | |
| UNPREFIXED_MODULE_NAME_INPUTCASE | Service (ServiceConfiguration *configuration) |
| virtual void | getDependentServices (std::vector< rtti::TypeInfo > &dependencies) override |
| virtual bool | init (nap::utility::ErrorState &errorState) override |
| virtual void | update (double deltaTime) override |
| virtual void | shutdown () override |
| Service (ServiceConfiguration *configuration) | |
| virtual | ~Service () |
| Core & | getCore () |
| const Core & | getCore () const |
| std::string | getTypeName () const |
| const Module & | getModule () const |
| Service (Service &)=delete | |
| Service & | operator= (const Service &)=delete |
| Service (Service &&)=delete | |
| Service & | operator= (Service &&)=delete |
Public Attributes | |
| nap::Signal | presetLoaded |
| nap::Signal | fileLoaded |
Protected Member Functions | |
| virtual void | postResourcesLoaded () override |
Protected Member Functions inherited from Service | |
| virtual void | registerObjectCreators (rtti::Factory &factory) |
| virtual void | getDependentServices (std::vector< rtti::TypeInfo > &dependencies) |
| virtual void | created () |
| virtual bool | init (utility::ErrorState &error) |
| virtual void | preUpdate (double deltaTime) |
| virtual void | update (double deltaTime) |
| virtual void | postUpdate (double deltaTime) |
| virtual void | preShutdown () |
| virtual void | shutdown () |
| virtual void | preResourcesLoaded () |
| template<typename SERVICE_CONFIG > | |
| SERVICE_CONFIG * | getConfiguration () |
| template<typename SERVICE_CONFIG > | |
| const SERVICE_CONFIG * | getConfiguration () const |
| std::string | getIniFilePath () const |
| std::string | getIniFilePath (const std::string &appendix) const |
The ParameterService manages the Parameters for a project. It provides support for loading/saving presets of Parameters
| using PresetFileList = std::vector<std::string> |
| ParameterService | ( | ServiceConfiguration * | configuration | ) |
| std::string getGroupPresetDirectory | ( | const std::string & | groupID | ) | const |
Get the directory that presets for the specified group are stored in
| groupID | The group id |
| std::string getPresetPath | ( | const std::string & | groupID, |
| const std::string & | filename | ||
| ) | const |
Get the full path to the preset file
| groupID | The group id |
| filename | The preset file to get the full path of |
| PresetFileList getPresets | ( | const ParameterGroup & | group | ) | const |
Get a list of all available preset files for the specified group.
| bool loadPreset | ( | ParameterGroup & | group, |
| const std::string & | presetFile, | ||
| utility::ErrorState & | errorState | ||
| ) |
Load a preset from the specified file. The parameters in the Preset will be automatically applied. The list of available presets files can be retrieved through getPresets()
| group | the parameter group. |
| presetFile | The path to the the preset file to load |
| errorState | Detailed error information when load fails |
|
overrideprotectedvirtual |
Called when a json file has been (re)loaded. Used to re-apply the presets.
Reimplemented from Service.
| bool savePreset | ( | ParameterGroup & | group, |
| const std::string & | presetFile, | ||
| utility::ErrorState & | errorState | ||
| ) |
Save the current set of parameters/values to the specified file as a preset.
| group | the parameter group. |
| presetFile | The path to save to |
| errorState | Detailed error information when save fails |
| nap::Signal fileLoaded |
Signal that is emitted when a file reload occurs
| nap::Signal presetLoaded |
Signal that is emitted when a preset is loaded