esp::metadata::managers::LightLayoutAttributesManager class

Base classes

template<class T, ManagedObjectAccess Access>
class AbstractAttributesManager<attributes::LightLayoutAttributes, ManagedObjectAccess::Copy>
Class template defining responsibilities and functionality for managing esp::metadata::attributes::AbstractAttributes constructs.

Constructors, destructors, conversion operators

LightLayoutAttributesManager()

Public functions

auto createObject(const std::string& lightConfigName, bool registerTemplate = false) -> attributes::LightLayoutAttributes::ptr override
Creates one or more instances of LightLayoutAttributes based on the whether lightConfigName is a file or a not. If it is a file it will consider the contents of that file a layout and will use the file name as the layout name and load all the attributes described and assign them to that layout. File-based loads will automatically register, regardless of what registerTemplate is.
void setValsFromJSONDoc(attributes::LightLayoutAttributes::ptr lightAttribs, const io::JsonGenericValue& jsonConfig) override
Function to take an existing LightLayoutAttributes and set its values from passed json config file.
void setLightInstanceValsFromJSONDoc(const attributes::LightInstanceAttributes::ptr& lightInstAttribs, const io::JsonGenericValue& jsonConfig)
Function to take an existing LightInstanceAttributes and set its values from passed json config file.
auto createLightSetupFromAttributes(const std::string& lightConfigName) -> gfx::LightSetup
This will create a gfx::LightSetup object based on the LightLayoutAttributes referenced by the passed name.
void finalizeAttrPathsBeforeRegister(const attributes::LightLayoutAttributes::ptr& attributes) const override
Not required for this manager.

Protected functions

auto initNewObjectInternal(const std::string& handleName, bool builtFromConfig) -> attributes::LightLayoutAttributes::ptr override
Used Internally. Create and configure newly-created attributes with any default values, before any specific values are set.
void deleteObjectInternalFinalize(int templateID, const std::string& templateHandle) override
This method will perform any necessary updating that is AbstractAttributesManager-specific upon template removal. This should only be called from esp::core::managedContainers::ManagedContainerBase.
auto preRegisterObjectFinalize(attributes::LightLayoutAttributes::ptr object, const std::string& objectHandle, bool forceRegistration) -> core::managedContainers::ManagedObjectPreregistration override
Not required for this manager.
void postRegisterObjectHandling(int objectID, const std::string& objectHandle) override
Not required for this manager.
void resetFinalize() override
Any lights-attributes-specific resetting that needs to happen on reset.

Function documentation

attributes::LightLayoutAttributes::ptr esp::metadata::managers::LightLayoutAttributesManager::createObject(const std::string& lightConfigName, bool registerTemplate = false) override

Creates one or more instances of LightLayoutAttributes based on the whether lightConfigName is a file or a not. If it is a file it will consider the contents of that file a layout and will use the file name as the layout name and load all the attributes described and assign them to that layout. File-based loads will automatically register, regardless of what registerTemplate is.

Parameters
lightConfigName The configuration file to parse, or the name of the single light's attributes to create.
registerTemplate whether to add this template to the library. Defaults to false - overridden if lightConfigName is a JSON file.
Returns a reference to the created light attributes.

If a template/layout exists with this handle, this existing template/layout will be overwritten with the newly created one if registerTemplate is true.

void esp::metadata::managers::LightLayoutAttributesManager::setValsFromJSONDoc(attributes::LightLayoutAttributes::ptr lightAttribs, const io::JsonGenericValue& jsonConfig) override

Function to take an existing LightLayoutAttributes and set its values from passed json config file.

Parameters
lightAttribs (out) an existing attributes to be modified.
jsonConfig json document to parse

void esp::metadata::managers::LightLayoutAttributesManager::setLightInstanceValsFromJSONDoc(const attributes::LightInstanceAttributes::ptr& lightInstAttribs, const io::JsonGenericValue& jsonConfig)

Function to take an existing LightInstanceAttributes and set its values from passed json config file.

Parameters
lightInstAttribs (out) an existing attributes to be modified.
jsonConfig json document to parse

gfx::LightSetup esp::metadata::managers::LightLayoutAttributesManager::createLightSetupFromAttributes(const std::string& lightConfigName)

This will create a gfx::LightSetup object based on the LightLayoutAttributes referenced by the passed name.

Parameters
lightConfigName the name of the LightLayoutAttributes to be used to create the LightSetup.
Returns The lightSetup defined by the attributes, or an empty LightSetup.

void esp::metadata::managers::LightLayoutAttributesManager::finalizeAttrPathsBeforeRegister(const attributes::LightLayoutAttributes::ptr& attributes) const override

Not required for this manager.

Parameters
attributes The attributes to be filtered.

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.

attributes::LightLayoutAttributes::ptr esp::metadata::managers::LightLayoutAttributesManager::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 LightLayoutAttributes is being built from a config file, or from some other source (i.e. handleName contains config file name)
Returns Newly created but unregistered LightLayoutAttributes pointer, with only default values set.

void esp::metadata::managers::LightLayoutAttributesManager::deleteObjectInternalFinalize(int templateID, const std::string& templateHandle) override protected

This method will perform any necessary updating that is AbstractAttributesManager-specific upon template removal. This should only be called from esp::core::managedContainers::ManagedContainerBase.

Parameters
templateID the ID of the template to remove
templateHandle the string key of the attributes desired.

core::managedContainers::ManagedObjectPreregistration esp::metadata::managers::LightLayoutAttributesManager::preRegisterObjectFinalize(attributes::LightLayoutAttributes::ptr object, const std::string& objectHandle, bool forceRegistration) override protected

Not required for this manager.

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.

This method will perform any essential updating to the managed object before registration is performed. If this updating fails, registration will also fail.

void esp::metadata::managers::LightLayoutAttributesManager::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.