|
lintel 0.2.0
|
#include <PropertyService.h>
Public Member Functions | |
| PropertyService (const std::vector< std::shared_ptr< PropertyRepository > > &propertyRepositories, std::vector< std::shared_ptr< AbstractServiceInterface > > abstractServices) | |
| virtual | ~PropertyService ()=default |
| void | onAwake () override |
| void | getOrCreate (const std::vector< std::shared_ptr< PropertyBase > > &propertiesVec) |
| template<class T > | |
| std::shared_ptr< Property< T > > | getOrCreate (const std::string &name, const std::string &instanceName, const std::string &className, const std::string &processName, const std::string &description, bool runtimeChange, const T &defaultValue=T()) |
| std::shared_ptr< PropertyBase > & | get (const std::string &name, const std::string &instanceName, const std::string &className, const std::string &processName) |
| std::vector< std::shared_ptr< PropertyBase > > | allOf () |
| std::vector< std::shared_ptr< PropertyBase > > | allOf (const std::string &processName) |
| std::vector< std::shared_ptr< PropertyBase > > | allOf (const std::string &processName, const std::string &className) |
| std::vector< std::shared_ptr< PropertyBase > > | allOf (const std::string &processName, const std::string &className, const std::string &instanceName) |
| template<class T > | |
| void | changeValueOf (const std::shared_ptr< PropertyBase > &property, const T &value) |
| void | changeStringValueOf (const std::shared_ptr< PropertyBase > &property, const std::string &value) |
| void | setPropertyChangeBus (const std::shared_ptr< IEventBus > &bus, const std::string &subscriberName) |
| std::size_t | applyChangeNotifications () |
| std::map< PropertyRepositoryType, std::shared_ptr< PropertyRepository > > | buildMap (const std::vector< std::shared_ptr< PropertyRepository > > &vector) |
Static Public Attributes | |
| static constexpr std::string_view | PROPERTY_CHANGES_TOPIC = "property_changes" |
| static constexpr std::string_view | PROPERTY_CHANGES_TYPE = "property_change" |
Central service for managing, querying and persisting properties
| lintel::PropertyService::PropertyService | ( | const std::vector< std::shared_ptr< PropertyRepository > > & | propertyRepositories, |
| std::vector< std::shared_ptr< AbstractServiceInterface > > | abstractServices | ||
| ) |
| propertyRepositories | list of all property repositories |
| abstractServices | list of services to notify on property changes |
|
virtualdefault |
| std::vector< std::shared_ptr< PropertyBase > > lintel::PropertyService::allOf | ( | ) |
| std::vector< std::shared_ptr< PropertyBase > > lintel::PropertyService::allOf | ( | const std::string & | processName | ) |
| std::vector< std::shared_ptr< PropertyBase > > lintel::PropertyService::allOf | ( | const std::string & | processName, |
| const std::string & | className | ||
| ) |
| std::vector< std::shared_ptr< PropertyBase > > lintel::PropertyService::allOf | ( | const std::string & | processName, |
| const std::string & | className, | ||
| const std::string & | instanceName | ||
| ) |
| std::size_t lintel::PropertyService::applyChangeNotifications | ( | ) |
Drain pending change notifications and apply them to local properties.
| std::map< PropertyRepositoryType, std::shared_ptr< PropertyRepository > > lintel::PropertyService::buildMap | ( | const std::vector< std::shared_ptr< PropertyRepository > > & | vector | ) |
Build repository type-to-instance map
| void lintel::PropertyService::changeStringValueOf | ( | const std::shared_ptr< PropertyBase > & | property, |
| const std::string & | value | ||
| ) |
Change the value of a property from string representation
| void lintel::PropertyService::changeValueOf | ( | const std::shared_ptr< PropertyBase > & | property, |
| const T & | value | ||
| ) |
Change the value of a property at runtime
| PropertyNoRuntimeChangeSupported | if property does not allow it |
| std::shared_ptr< PropertyBase > & lintel::PropertyService::get | ( | const std::string & | name, |
| const std::string & | instanceName, | ||
| const std::string & | className, | ||
| const std::string & | processName | ||
| ) |
Get a property by its coordinates
| PropertyNotFoundException | if not found |
| std::shared_ptr< Property< T > > lintel::PropertyService::getOrCreate | ( | const std::string & | name, |
| const std::string & | instanceName, | ||
| const std::string & | className, | ||
| const std::string & | processName, | ||
| const std::string & | description, | ||
| bool | runtimeChange, | ||
| const T & | defaultValue = T() |
||
| ) |
Get or create a typed property
| T | property value type |
| name | property name |
| instanceName | instance name |
| className | class name |
| processName | process name |
| description | property description |
| runtimeChange | whether runtime changes are supported |
| defaultValue | default value if property does not exist |
|
inline |
Match properties from vector against existing map
|
overridevirtual |
Called when the bean should reload or refresh its state from persistent storage.
Implements lintel::PersistableBean.
| void lintel::PropertyService::setPropertyChangeBus | ( | const std::shared_ptr< IEventBus > & | bus, |
| const std::string & | subscriberName | ||
| ) |
Connect the change notification bus and subscribe for property changes.
| bus | the event bus view used for notifications |
| subscriberName | a name unique to this process |
|
staticconstexpr |
Event bus topic carrying property change notifications.
|
staticconstexpr |
Event type of property change notifications.