esp::metadata::managers::SceneDatasetAttributesManager class

Base classes

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

Constructors, destructors, conversion operators

SceneDatasetAttributesManager(PhysicsAttributesManager::ptr physicsAttributesMgr, PbrShaderAttributesManager::ptr pbrShaderAttributesMgr) explicit

Public functions

auto createObject(const std::string& attributesTemplateHandle, bool registerTemplate = true) -> attributes::SceneDatasetAttributes::ptr override
Creates an instance of a dataset template described by passed string. For dataset templates, this a file name.
void setValsFromJSONDoc(attributes::SceneDatasetAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override
Method to take an existing attributes and set its values from passed json config file.
void setCurrPhysicsManagerAttributesHandle(const std::string& handle)
This will set the current physics manager attributes that is governing the world that this SceneDatasetAttributesManager's datasets will be created in. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, PhysicsManagerAttributes defaults can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.
void setDefaultPbrShaderAttributesHandle(const std::string& pbrHandle)
This will set the current default PBR/IBL Shader configuration attributes. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, the default esp::metadata::attributes::PbrShaderAttributes can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.
void finalizeAttrPathsBeforeRegister(const attributes::SceneDatasetAttributes::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 functions

void validateMap(const std::string& dsDir, const std::string& jsonTag, std::map<std::string, std::string>& map)
This will validate a loaded dataset map with file location values from the dataset config, by attempting to either verify those locations are valid files, or else prefix the given location with the dataset root directory.
template<typename U>
void readDatasetJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jsonConfig, const U& attrMgr, std::map<std::string, std::string>* strKeyMap = nullptr)
Verify a particular subcell exists within the dataset_config.JSON file, and if so, handle reading the possible JSON sub-cells it might hold, using the passed AbstractAttributesManager for the dataset being processed.
template<typename U>
void readDatasetConfigsJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jCell, const U& attrMgr)
This will parse an individual element in a "configs" cell array in the dataset_config.JSON file.
auto initNewObjectInternal(const std::string& handleName, bool builtFromConfig) -> attributes::SceneDatasetAttributes::ptr override
Used Internally. Create and configure newly-created dataset 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, 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.
void resetFinalize() override
Any dataset-attributes-specific resetting that needs to happen on reset.
auto preRegisterObjectFinalize(attributes::SceneDatasetAttributes::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.

Protected variables

std::string physicsManagerAttributesHandle_
Name of currently used physicsManagerAttributes.
std::string defaultPbrShaderAttributesHandle_
Name of currently used default PbrShaderAttributes.
PhysicsAttributesManager::ptr physicsAttributesManager_
Reference to PhysicsAttributesManager to give access to default physics manager attributes settings when esp::metadata::attributes::SceneDatasetAttributes are created within Dataset.
PbrShaderAttributesManager::ptr pbrShaderAttributesManager_
Reference to the PbrShaderAttributesManager to give access to various PBR/IBL Shader configuration parameters and settings.

Function documentation

attributes::SceneDatasetAttributes::ptr esp::metadata::managers::SceneDatasetAttributesManager::createObject(const std::string& attributesTemplateHandle, bool registerTemplate = true) override

Creates an instance of a dataset template described by passed string. For dataset templates, this a file name.

Parameters
attributesTemplateHandle the origin of the desired dataset 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 newly-created template.

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

void esp::metadata::managers::SceneDatasetAttributesManager::setValsFromJSONDoc(attributes::SceneDatasetAttributes::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::SceneDatasetAttributesManager::setCurrPhysicsManagerAttributesHandle(const std::string& handle)

This will set the current physics manager attributes that is governing the world that this SceneDatasetAttributesManager's datasets will be created in. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, PhysicsManagerAttributes defaults can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.

Parameters
handle The string handle referencing the esp::metadata::attributes::PhysicsManagerAttributes governing the current esp::physics::PhysicsManager.

void esp::metadata::managers::SceneDatasetAttributesManager::setDefaultPbrShaderAttributesHandle(const std::string& pbrHandle)

This will set the current default PBR/IBL Shader configuration attributes. This is used so that upon creation of new esp::metadata::attributes::SceneDatasetAttributes, the default esp::metadata::attributes::PbrShaderAttributes can be set in the esp::metadata::attributes::SceneDatasetAttributes before any scene-specific values are set.

Parameters
pbrHandle The string handle referencing the esp::metadata::attributes::PbrShaderAttributes used to configure the current PBR/IBL shader for all objects, unless overridden in Scene Instances.

void esp::metadata::managers::SceneDatasetAttributesManager::finalizeAttrPathsBeforeRegister(const attributes::SceneDatasetAttributes::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.

void esp::metadata::managers::SceneDatasetAttributesManager::validateMap(const std::string& dsDir, const std::string& jsonTag, std::map<std::string, std::string>& map) protected

This will validate a loaded dataset map with file location values from the dataset config, by attempting to either verify those locations are valid files, or else prefix the given location with the dataset root directory.

Parameters
dsDir the dataset's root directory
jsonTag the appropriate tag for the map being read
map A ref to the dataset's map that is being populated.

template<typename U>
void esp::metadata::managers::SceneDatasetAttributesManager::readDatasetJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jsonConfig, const U& attrMgr, std::map<std::string, std::string>* strKeyMap = nullptr) protected

Verify a particular subcell exists within the dataset_config.JSON file, and if so, handle reading the possible JSON sub-cells it might hold, using the passed AbstractAttributesManager for the dataset being processed.

Parameters
dsDir The root directory of the dataset attributes being built.
tag The name of the JSON cell being processed - corresponds to what type of data is being loaded from dataset configuration (i.e. stages, objects, etc)
jsonConfig The sub cell in the json document being processed.
attrMgr The dataset's attributes manager for tag 's data.
strKeyMap

template<typename U>
void esp::metadata::managers::SceneDatasetAttributesManager::readDatasetConfigsJSONCell(const std::string& dsDir, const char* tag, const io::JsonGenericValue& jCell, const U& attrMgr) protected

This will parse an individual element in a "configs" cell array in the dataset_config.JSON file.

Parameters
dsDir
tag The name of the JSON cell being processed - corresponds to what type of data is being loaded from dataset configuration (i.e. stages, objects, etc)
jCell The sub cell within the "configs" array in the json document being processed.
attrMgr The dataset's attributes manager for tag 's data.

attributes::SceneDatasetAttributes::ptr esp::metadata::managers::SceneDatasetAttributesManager::initNewObjectInternal(const std::string& handleName, bool builtFromConfig) override protected

Used Internally. Create and configure newly-created dataset attributes with any default values, before any specific values are set.

Parameters
handleName handle name to be assigned to dataset attributes
builtFromConfig Whether this SceneDatasetAttributes 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 SceneDatasetAttributes pointer, with only default values set.

void esp::metadata::managers::SceneDatasetAttributesManager::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::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::SceneDatasetAttributesManager::preRegisterObjectFinalize(attributes::SceneDatasetAttributes::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::SceneDatasetAttributesManager::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.