esp::metadata::managers::PhysicsAttributesManager class

Base classes

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

Constructors, destructors, conversion operators

PhysicsAttributesManager()

Public functions

auto createObject(const std::string& physicsFilename = ESP_DEFAULT_PHYSICS_CONFIG_REL_PATH, bool registerTemplate = true) -> attributes::PhysicsManagerAttributes::ptr override
Creates an instance of a physics world template described by passed string. For physics templates, this a file name. Parses global physics simulation parameters (such as timestep, gravity, simulator implementation) from the specified configuration file.
void setValsFromJSONDoc(attributes::PhysicsManagerAttributes::ptr attribs, const io::JsonGenericValue& jsonConfig) override
Method to take an existing attributes and set its values from passed json config file.

Protected functions

auto initNewObjectInternal(const std::string& handleName, bool builtFromConfig) -> attributes::PhysicsManagerAttributes::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 attributesManager-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 registerObjectFinalize(attributes::PhysicsManagerAttributes::ptr physicsAttributesTemplate, const std::string& physicsAttributesHandle, bool forceRegistration) -> int override
Add a copy of the esp::metadata::attributes::PhysicsManagerAttributes shared_ptr object to the objectLibrary_.
void resetFinalize() override
Any physics-attributes-specific resetting that needs to happen on reset.

Function documentation

attributes::PhysicsManagerAttributes::ptr esp::metadata::managers::PhysicsAttributesManager::createObject(const std::string& physicsFilename = ESP_DEFAULT_PHYSICS_CONFIG_REL_PATH, bool registerTemplate = true) override

Creates an instance of a physics world template described by passed string. For physics templates, this a file name. Parses global physics simulation parameters (such as timestep, gravity, simulator implementation) from the specified configuration file.

Parameters
physicsFilename The configuration file to parse. Defaults to the file location ESP_DEFAULT_PHYSICS_CONFIG_REL_PATH set by cmake.
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 physics simulation meta data object parsed from the specified configuration file.

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::PhysicsAttributesManager::setValsFromJSONDoc(attributes::PhysicsManagerAttributes::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

attributes::PhysicsManagerAttributes::ptr esp::metadata::managers::PhysicsAttributesManager::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 PhysicsManagerAttributes 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 PhysicsManagerAttributes pointer, with only default values set.

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

This method will perform any necessary updating that is attributesManager-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.

int esp::metadata::managers::PhysicsAttributesManager::registerObjectFinalize(attributes::PhysicsManagerAttributes::ptr physicsAttributesTemplate, const std::string& physicsAttributesHandle, bool forceRegistration) override protected

Add a copy of the esp::metadata::attributes::PhysicsManagerAttributes shared_ptr object to the objectLibrary_.

Parameters
physicsAttributesTemplate The attributes template.
physicsAttributesHandle The key for referencing the template in the objectLibrary_.
forceRegistration Will register object even if conditional registration checks fail.
Returns The index in the objectLibrary_ of object template.