esp::metadata::attributes::AbstractAttributes class

Base class for all implemented attributes. Inherits from esp::core::managedContainers::AbstractFileBasedManagedObject so the attributes can be managed by a esp::core::managedContainers::ManagedContainer.

Base classes

class esp::core::managedContainers::AbstractFileBasedManagedObject
class esp::core::config::Configuration
This class holds Configuration data in a map of ConfigValues, and also supports nested Configurations via a map of smart pointers to this type.

Derived classes

class AbstractObjectAttributes
base attributes object holding attributes shared by all esp::metadata::attributes::ObjectAttributes and esp::metadata::attributes::StageAttributes objects; Should be treated as abstract - should never be instanced directly
class AbstractPrimitiveAttributes
class ArticulatedObjectAttributes
attributes class describing essential and default quantities used to instantiate an Articulated object
class LightInstanceAttributes
This class describes an instance of a light - its template name, location/direction, color, intensity, type and other parameters if appropriate.
class LightLayoutAttributes
This class describes a lighting layout, consisting of a series of lights.
class PbrShaderAttributes
attributes class describing essential and default quantities and settings for configuring PBR shader calculations.
class PhysicsManagerAttributes
attributes class describing essential and default quantities used to instantiate a physics manager.
class SceneDatasetAttributes
class SceneInstanceAttributes
class SceneObjectInstanceAttributes
This class describes an instance of a stage, object or articulated object in a scene - its template name, translation from the origin, rotation, motiontype, and other values required to instantiate the construct described.
class SemanticAttributes
This class describes the semantic attributes for a specific scene. This includes semantic region description and annotation.
class SemanticVolumeAttributes
This class describes the attributes describing some Semantic Volume. Currently only used for region annotations.

Constructors, destructors, conversion operators

AbstractAttributes(const std::string& attributesClassKey, const std::string& handle)
AbstractAttributes(const AbstractAttributes& otr) defaulted
AbstractAttributes(AbstractAttributes&& otr) defaulted noexcept
~AbstractAttributes() defaulted override

Public functions

auto operator=(const AbstractAttributes& otr) -> AbstractAttributes& defaulted
auto operator=(AbstractAttributes&& otr) -> AbstractAttributes& defaulted noexcept
auto writeToJsonObject(io::JsonAllocator& allocator) const -> io::JsonGenericValue override
Support writing to JSON object as required by esp::core::managedContainers::AbstractFileBasedManagedObject.
auto getClassKey() const -> std::string override
Get this attributes' class. Should only be set from constructor. Used as key in constructor function pointer maps in AttributesManagers.
void setHandle(const std::string& handle) override
Set this attributes name/origin. Some attributes derive their own names based on their state, such as AbstractPrimitiveAttributes; in such cases this should be overridden with NOP.
auto getHandle() const -> std::string override
void setFileDirectory(const std::string& fileDirectory) override
Set the directory where files used to construct ManagedObject can be found.
auto getFileDirectory() const -> std::string override
Get directory where files used to construct ManagedObject can be found.
void setActualFilename(const std::string& fullFileName) override
Set the fully qualified filename of the file used to create or most recently save this ManagedObject.
auto getActualFilename() const -> std::string override
Get the fully qualified filename of the file used to create or most recently save this ManagedObject.
void setID(int ID) override
Set the unique ID referencing attributes.
auto getID() const -> int override
Get the unique ID referencing attributes.
auto getUserConfiguration() const -> std::shared_ptr<Configuration>
Gets a smart pointer reference to a copy of the user-specified configuration data from config file. Habitat does not parse or process this data, but it will be available to the user via python bindings for each object.
auto getUserConfigurationView() const -> std::shared_ptr<const Configuration>
Gets a const smart pointer reference to a view of the user-specified configuration data from config file. Habitat does not parse or process this data, but it will be available to the user via python bindings for each object.
auto editUserConfiguration() -> std::shared_ptr<Configuration>
Gets a smart pointer reference to the actual user-specified configuration data from config file. Habitat does not parse or process this data, but it will be available to the user via python bindings for each object. This method is for editing the configuration.
void setUserConfiguration(std::shared_ptr<Configuration>& userAttr)
Move an existing user_defined subconfiguration into this configuration, overwriting the existing copy if it exists. Habitat does not parse or process this data, but it will be available to the user via python bindings for each object. This method is for editing the configuration.
auto getNumUserDefinedConfigurations() const -> int
Returns the number of user-defined values (within the "user-defined" sub-ConfigurationGroup) this attributes has.
auto getTotalNumUserDefinedConfigurations() const -> int
Returns the number of user-defined values (within the "user-defined" sub-ConfigurationGroup) this attributes has.
auto getObjectInfoHeader() const -> std::string override
Retrieve a comma-separated string holding the header values for the info returned for this managed object.
auto getObjectInfo() const -> std::string override
Retrieve a comma-separated informational string about the contents of this managed object.
auto getFilePathsAreDirty() const -> bool
Check whether filepath-based fields have been set by user input but have not been verified to exist (such verification occurs when the attributes is registered.)
void setFilePathsAreClean()
Clear the flag that specifies that filepath-based fields have been set but not verfified to exist (such verification occurs when the attributes is registered.)
auto isAttrSaved() const -> bool override
Get whether this ManagedObject has been saved to disk in its current state. Only applicable to registered ManagedObjects.

Protected functions

void setFileSaveStatus(bool _isSaved) override
Set this ManagedObject's save status (i.e. whether it matches its version on disk or not)
void setFilePathsAreDirty()
Used internally only. Set the flag that specifies a filepath-based field has been set to some value but has not yet been verified to exist (such verification occurs when the attributes is registered.)
template<class T>
auto getSubAttributesListInternal(const std::shared_ptr<Configuration>& subAttrConfig) const -> std::vector<std::shared_ptr<const T>>
return a vector of shared pointers to const AbstractAttributes sub-configurations.
template<class T>
void copySubconfigIntoMe(const std::shared_ptr<Configuration>& srcSubAttrConfig, const std::shared_ptr<Configuration>& destSubAttrConfig)
This function is specifcially designed to copy sub-subconfigs whilst retaining their full type. Any AbstractAttributes object that gets stored as a subconfig Configuration will retain its full type the config owning it gets copy constructed, in which case the copy will not retain its AbstractFileBasedManagedObject interface characteristics. This function is provided so that any AbstractAttributes object that is copied will have its sub-subconfigs copied with appropriate type.
auto getNumSubAttributesInternal(const std::string& subConfigNamePrefix, const std::shared_ptr<Configuration>& subAttrConfig) const -> int
Return the number of SubAttribute Configurations with passed key subConfigNamePrefix in name.
template<class T>
auto getNamedSubAttributesInternal(const std::string& name, const std::shared_ptr<Configuration>& subAttrConfig) const -> std::shared_ptr<const T>
Returns a shared pointer to the named AbstractAttributes sub-configurations member of the passed subAttrConfig.
template<class T>
auto removeNamedSubAttributesInternal(const std::string& name, std::deque<int>& availableIDs, const std::shared_ptr<Configuration>& subAttrConfig) -> std::shared_ptr<T>
Removes and returns a shared pointer to the named AbstractAttributes sub-configurations member of the passed subAttrConfig. The object's ID is freed as part of this process, to be used by other objects.
template<class T>
auto setSubAttributesInternal(std::shared_ptr<T>& objInst, std::deque<int>& availableIDs, const std::shared_ptr<Configuration>& subAttrConfig, const std::string& objInstNamePrefix, bool verifyUnique) -> bool
Add the passed shared pointer to AbstractAttributes , objInst , to the passed sub-config building a name from the passed objInstNamePrefix .
auto getObjectInfoHeaderInternal() const -> std::string virtual
Retrieve a comma-separated string holding the header values for the info returned for this managed object, type-specific.
auto getObjectInfoInternal() const -> std::string virtual
Retrieve a comma-separated informational string about the contents of this managed object, type-specific.
void setClassKey(const std::string& attributesClassKey) override
Set this attributes' class. Should only be set from constructor. Used as key in constructor function pointer maps in AttributesManagers.

Function documentation

void esp::metadata::attributes::AbstractAttributes::setHandle(const std::string& handle) override

Set this attributes name/origin. Some attributes derive their own names based on their state, such as AbstractPrimitiveAttributes; in such cases this should be overridden with NOP.

Parameters
handle the handle to set.

template<class T>
std::vector<std::shared_ptr<const T>> esp::metadata::attributes::AbstractAttributes::getSubAttributesListInternal(const std::shared_ptr<Configuration>& subAttrConfig) const protected

return a vector of shared pointers to const AbstractAttributes sub-configurations.

Parameters
subAttrConfig The subconfiguration from which to aquire the subconfigs.

template<class T>
void esp::metadata::attributes::AbstractAttributes::copySubconfigIntoMe(const std::shared_ptr<Configuration>& srcSubAttrConfig, const std::shared_ptr<Configuration>& destSubAttrConfig) protected

This function is specifcially designed to copy sub-subconfigs whilst retaining their full type. Any AbstractAttributes object that gets stored as a subconfig Configuration will retain its full type the config owning it gets copy constructed, in which case the copy will not retain its AbstractFileBasedManagedObject interface characteristics. This function is provided so that any AbstractAttributes object that is copied will have its sub-subconfigs copied with appropriate type.

Parameters
srcSubAttrConfig The source of the copy, which retains appropriate type.
destSubAttrConfig The destination of the copy.

int esp::metadata::attributes::AbstractAttributes::getNumSubAttributesInternal(const std::string& subConfigNamePrefix, const std::shared_ptr<Configuration>& subAttrConfig) const protected

Return the number of SubAttribute Configurations with passed key subConfigNamePrefix in name.

Parameters
subConfigNamePrefix Name tag to look for to count subconfig.
subAttrConfig

template<class T>
std::shared_ptr<T> esp::metadata::attributes::AbstractAttributes::removeNamedSubAttributesInternal(const std::string& name, std::deque<int>& availableIDs, const std::shared_ptr<Configuration>& subAttrConfig) protected

Removes and returns a shared pointer to the named AbstractAttributes sub-configurations member of the passed subAttrConfig. The object's ID is freed as part of this process, to be used by other objects.

Parameters
name The name of the object to remove.
availableIDs A deque of the IDs that this configuration has available for these types of Subconfigurations to use.
subAttrConfig The

template<class T>
bool esp::metadata::attributes::AbstractAttributes::setSubAttributesInternal(std::shared_ptr<T>& objInst, std::deque<int>& availableIDs, const std::shared_ptr<Configuration>& subAttrConfig, const std::string& objInstNamePrefix, bool verifyUnique) protected

Add the passed shared pointer to AbstractAttributes , objInst , to the passed sub-config building a name from the passed objInstNamePrefix .

Parameters
objInst The subAttributes Configuration pointer
availableIDs The ids available that can be used for the passed attributes
subAttrConfig The subconfig to place objInst in.
objInstNamePrefix The prefix to use to construct the key to store the instance in the subconfig. If empty, will use objInst->getHandle().
verifyUnique Verify that the new subconfiguration holds unique data (i.e. no other subconfig exists that has the same data). If this is true and the passed objInst is not unique, it will not be saved.
Returns whether the passed objInst was added. Only returns false if verifyUnique is true and the objInst is not unique.

void esp::metadata::attributes::AbstractAttributes::setClassKey(const std::string& attributesClassKey) override protected

Set this attributes' class. Should only be set from constructor. Used as key in constructor function pointer maps in AttributesManagers.

Parameters
attributesClassKey the string handle corresponding to the constructors used to make copies of this object in copy constructor map.