class
SensorAttributesManager
Base classes
-
template<class T, ManagedObjectAccess Access>class AbstractAttributesManager<attributes::AbstractSensorAttributes, ManagedObjectAccess::Copy>
- Class template defining responsibilities and functionality for managing esp::
metadata:: attributes:: AbstractAttributes constructs.
Public static variables
-
static const std::
map<sensor::SensorSubType, const std:: string> SenssorAttrsTypeNamesMap - Constant Map holding names of concrete SensorAttributes classes, keyed by SensorSubtype enum values used to denote them.
Constructors, destructors, conversion operators
Public functions
-
template<typename T>auto createAttributesFromSensorSpec(const sensor::SensorSpec::ptr& sensorSpec, bool registerTemplate = true) -> std::
shared_ptr<T> - Create an attributes from a SensorSpec.
-
auto createObject(const std::
string& sensorClassName, bool registerTemplate = true) -> attributes::AbstractSensorAttributes::ptr override - Should only be called internally. Creates an instance of a sensor attributes template described by the passed string.
-
auto buildObjectFromJSONDoc(const std::
string& filename, const io::JsonGenericValue& jsonConfig) -> attributes::AbstractSensorAttributes::ptr override - Parse passed JSON Document specifically for esp::
metadata:: attributes:: AbstractSensorAttributes object. It always returns a valid esp:: metadata:: attributes:: AbstractSensorAttributes shared_ptr object. - void setValsFromJSONDoc(attributes::AbstractSensorAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override
- Method to take an existing attributes and set its values from passed json config file.
- void finalizeAttrPathsBeforeRegister(const attributes::AbstractSensorAttributes::ptr& attributes) const override
- This function will be called to finalize attributes' paths before registration, moving fully qualified paths to the appropriate hidden attribute fields. This can also be called without registration to make sure the paths specified in an attributes are properly configured.
Protected types
-
using Map_Of_SensorTypeCtors = std::
unordered_map<std:: string, attributes::AbstractSensorAttributes::ptr(SensorAttributesManager::*)()> - Define a map type referencing function pointers to createSensorAttributes() keyed by esp::sensor::SensorSubType corresponding to sensor classes being instanced,.
Protected functions
- auto createAttributesFromSensorSpecInternal(const sensor::SensorSpec::ptr& sensorSpec, bool registerTemplate) -> attributes::AbstractSensorAttributes::ptr
- Internal only. Create an attributes from a SensorSpec.
-
auto initNewObjectInternal(const std::
string& handleName, bool builtFromConfig) -> attributes::AbstractSensorAttributes::ptr override - Used Internally. Create and configure newly-created attributes with any default values, before any specific values are set.
-
template<typename T>auto createSensorAttributes() -> attributes::AbstractSensorAttributes::ptr
- Build a shared pointer to the appropriate attributes for passed object type as defined in PrimObjTypes, where each entry except PrimObjTypes::
END_PRIM_OBJ_TYPES corresponds to a Magnum Primitive type. -
void deleteObjectInternalFinalize(int templateID,
const std::
string& templateHandle) override - This method will perform any necessary updating that is AbstractAttributesManager-specific upon template removal, such as removing a specific template handle from the list of file-based template handles in ObjectAttributesManager. This should only be called esp::
core:: managedContainers:: ManagedContainerBase. -
auto preRegisterObjectFinalize(attributes::AbstractSensorAttributes::ptr object,
const std::
string& objectHandle, bool forceRegistration) -> core:: managedContainers:: ManagedObjectPreregistration override - This method will perform any essential updating to the managed object before registration is performed. If this updating fails, registration will also fail. In the case of SensorAttributes, it will verify the handle syntax and uniqueness.
-
void postRegisterObjectHandling(int objectID,
const std::
string& objectHandle) override - Not required for this manager.
- void resetFinalize() override
- Any AbstractSensorAttributes-attributes-specific resetting that needs to happen on ManagedContainerBase::reset().
Protected variables
-
Map_
Of_ SensorTypeCtors sensorTypeConstructorMap_ - Map of function pointers to instantiate a sennsor attributes object,.
Function documentation
template<typename T>
std:: shared_ptr<T> esp:: metadata:: managers:: SensorAttributesManager:: createAttributesFromSensorSpec(const sensor::SensorSpec::ptr& sensorSpec,
bool registerTemplate = true)
Create an attributes from a SensorSpec.
Parameters | |
---|---|
sensorSpec | The SensorSpec holding the values to use to create a sensor. |
registerTemplate | whether to add this template to the library. If the user is going to edit this template, this should be false - any subsequent editing will require re-registration. Defaults to true. If specified as true, then this function returns a copy of the registered template. |
Returns | a reference to the desired template. |
TODO : Once SensorSpecs are removed, this should be removed as well.
attributes::AbstractSensorAttributes::ptr esp:: metadata:: managers:: SensorAttributesManager:: createObject(const std:: string& sensorClassName,
bool registerTemplate = true) override
Should only be called internally. Creates an instance of a sensor attributes template described by the passed string.
Parameters | |
---|---|
sensorClassName | A string descriptor of the sensor attributes template to be created. |
registerTemplate | whether to add this template to the library. If the user is going to edit this template, this should be false - any subsequent editing will require re-registration. Defaults to true. If specified as true, then this function returns a copy of the registered template. |
Returns | a reference to the desired template. |
attributes::AbstractSensorAttributes::ptr esp:: metadata:: managers:: SensorAttributesManager:: buildObjectFromJSONDoc(const std:: string& filename,
const io::JsonGenericValue& jsonConfig) override
Parse passed JSON Document specifically for esp::
Parameters | |
---|---|
filename | the name of the file describing the sensor attributes |
jsonConfig | json document to parse |
Returns | a reference to the desired template. |
TODO : currently do not support file-based Sensor attributes.
void esp:: metadata:: managers:: SensorAttributesManager:: setValsFromJSONDoc(attributes::AbstractSensorAttributes::ptr attribs,
const io::JsonGenericValue& jsonConfig) override
Method to take an existing attributes and set its values from passed json config file.
Parameters | |
---|---|
attribs | (out) an existing attributes to be modified. |
jsonConfig | json document to parse |
void esp:: metadata:: managers:: SensorAttributesManager:: finalizeAttrPathsBeforeRegister(const attributes::AbstractSensorAttributes::ptr& attributes) const override
This function will be called to finalize attributes' paths before registration, moving fully qualified paths to the appropriate hidden attribute fields. This can also be called without registration to make sure the paths specified in an attributes are properly configured.
Parameters | |
---|---|
attributes | The attributes to be filtered. |
attributes::AbstractSensorAttributes::ptr esp:: metadata:: managers:: SensorAttributesManager:: createAttributesFromSensorSpecInternal(const sensor::SensorSpec::ptr& sensorSpec,
bool registerTemplate) protected
Internal only. Create an attributes from a SensorSpec.
Parameters | |
---|---|
sensorSpec | The SensorSpec holding the values to use to create a sensor. |
registerTemplate | whether to add this template to the library. If the user is going to edit this template, this should be false - any subsequent editing will require re-registration. Defaults to true. If specified as true, then this function returns a copy of the registered template. |
Returns | a reference to the desired template. |
TODO : Once SensorSpecs are removed, this should be removed as well.
attributes::AbstractSensorAttributes::ptr esp:: metadata:: managers:: SensorAttributesManager:: initNewObjectInternal(const std:: string& handleName,
bool builtFromConfig) override protected
Used Internally. Create and configure newly-created attributes with any default values, before any specific values are set.
Parameters | |
---|---|
handleName | handle name to be assigned to attributes |
builtFromConfig | Whether this AbstractSensorAttributes is being built from a config file (i.e. handleName is the name of a configuration file) or from some other source. |
Returns | Newly created but unregistered AbstractSensorAttributes pointer, with only default values set. |
void esp:: metadata:: managers:: SensorAttributesManager:: deleteObjectInternalFinalize(int templateID,
const std:: string& templateHandle) override protected
This method will perform any necessary updating that is AbstractAttributesManager-specific upon template removal, such as removing a specific template handle from the list of file-based template handles in ObjectAttributesManager. This should only be called esp::
Parameters | |
---|---|
templateID | the ID of the template to remove |
templateHandle | the string key of the attributes desired. |
core:: managedContainers:: ManagedObjectPreregistration esp:: metadata:: managers:: SensorAttributesManager:: preRegisterObjectFinalize(attributes::AbstractSensorAttributes::ptr object,
const std:: string& objectHandle,
bool forceRegistration) override protected
This method will perform any essential updating to the managed object before registration is performed. If this updating fails, registration will also fail. In the case of SensorAttributes, it will verify the handle syntax and uniqueness.
Parameters | |
---|---|
object | the managed object to be registered |
objectHandle | the name to register the managed object with. Expected to be valid. |
forceRegistration | Should register object even if conditional registration checks fail. |
Returns | Whether the preregistration has succeeded and what handle to use to register the object if it has. |
void esp:: metadata:: managers:: SensorAttributesManager:: postRegisterObjectHandling(int objectID,
const std:: string& objectHandle) override protected
Not required for this manager.
Parameters | |
---|---|
objectID | the ID of the successfully registered managed object |
objectHandle | The name of the managed object |
This method will perform any final manager-related handling after successfully registering an object.
See esp::attributes::managers::ObjectAttributesManager for an example.