esp::metadata::attributes::AbstractAttributes class

Base class for all implemented attributes. Inherits from esp::core::AbstractFileBasedManagedObject so the attributes can be managed by a esp::core::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 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 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.

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
directory where files used to construct attributes can be found.
auto getFileDirectory() const -> std::string override
void setID(int ID) override
Unique ID referencing attributes.
auto getID() const -> int override
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 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.
auto getNumUserDefinedConfigurations() 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.

Protected functions

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 AttributesBase 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 AttributesBase 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 AttributesBase 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>
void setSubAttributesInternal(std::shared_ptr<T>& objInst, std::deque<int>& availableIDs, const std::shared_ptr<Configuration>& subAttrConfig, const std::string& objInstNamePrefix)
Add the passed shared pointer to AbstractAttributes , objInst , to the appropriate sub-config using the passed name.
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 AttributesBase 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 AttributesBase 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>
void esp::metadata::attributes::AbstractAttributes::setSubAttributesInternal(std::shared_ptr<T>& objInst, std::deque<int>& availableIDs, const std::shared_ptr<Configuration>& subAttrConfig, const std::string& objInstNamePrefix) protected

Add the passed shared pointer to AbstractAttributes , objInst , to the appropriate sub-config using the passed name.

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().

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.