template<class T>
PhysicsObjectBaseManager class
Class template defining responsibilities and functionality for managineg object wrappers specializing esp::
Template parameters | |
---|---|
T | the type of managed physics object wrapper a particular specialization of this class works with. Must inherit from esp:: |
Base classes
-
template<class T, ManagedObjectAccess Access>class esp::core::managedContainers::ManagedContainer<T, core::managedContainers::ManagedObjectAccess::Copy>
- Class template defining responsibilities and functionality for managing esp::
core:: managedContainers:: AbstractManagedObject constructs.
Public types
-
using ObjWrapperPtr = std::
shared_ptr<T>
Constructors, destructors, conversion operators
-
PhysicsObjectBaseManager(const std::
string& objType) explicit - ~PhysicsObjectBaseManager() defaulted override
Public functions
-
void setPhysicsManager(std::
weak_ptr<physics:: PhysicsManager> physMgr) - set the weak reference to the physics manager that owns this wrapper manager
-
auto createObject(const std::
string& objectTypeName, bool registerObject = false) -> ObjWrapperPtr override - Creates an empty esp::
physics:: AbstractManagedPhysicsObject of the type managed by this manager.
Protected types
-
using Map_Of_ManagedObjTypeCtors = std::
map<std:: string, ObjWrapperPtr(PhysicsObjectBaseManager<T>::*)()> - Define a map type referencing function pointers to createRigidObjectWrapper() keyed by string names of classes being instanced, as defined in PrimitiveNames3DMap.
Protected functions
- void resetFinalize() override
- Any physics-object-wrapper-specific resetting that needs to happen on reset.
-
template<typename U>auto createPhysicsObjectWrapper() -> ObjWrapperPtr
- Build a shared pointer to a ManagedRigidObject wrapper around an appropriately cast esp::
physics:: RigidObject, either the base kinematic version, or one built to support a dynamic library. -
auto initNewObjectInternal(const std::
string& objectTypeName, bool builtFromConfig) -> ObjWrapperPtr override - Used Internally. Create and configure newly-created managed object with any default values, before any specific values are set.
-
auto preRegisterObjectFinalize(ObjWrapperPtr 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.
-
auto getPhysicsManager() const -> std::
shared_ptr<esp:: physics:: PhysicsManager> - return a reference to physicsManager_, or null ptr if it does not exist anymore. This is necessary since a reference of this manager may linger in python after simulator/physicsManager get clobbered/rebuilt.
Protected variables
-
std::
weak_ptr<esp:: physics:: PhysicsManager> weakPhysManager_ - Weak reference to owning physics manager.
-
Map_
Of_ ManagedObjTypeCtors managedObjTypeConstructorMap_ - Map of function pointers to instantiate a esp::
physics:: AbstractManagedPhysicsObject wrapper object, keyed by the wrapper's class name. A ManagedRigidObject wrapper of the appropriate type is instanced by accessing the constructor map with the appropriate classname.
Function documentation
template<class T>
ObjWrapperPtr esp:: physics:: PhysicsObjectBaseManager<T>:: createObject(const std:: string& objectTypeName,
bool registerObject = false) override
Creates an empty esp::
Parameters | |
---|---|
objectTypeName | Class name of the wrapper to create. This will be used as a key in managedObjTypeConstructorMap_ . |
registerObject | whether to add this managed object to the library or not. If the user is going to edit this managed object, this should be false. Defaults to true. If specified as true, then this function returns a copy of the registered managed object. |
Returns | a reference to the desired managed object. |
template<class T>
ObjWrapperPtr esp:: physics:: PhysicsObjectBaseManager<T>:: initNewObjectInternal(const std:: string& objectTypeName,
bool builtFromConfig) override protected
Used Internally. Create and configure newly-created managed object with any default values, before any specific values are set.
Parameters | |
---|---|
objectTypeName | Used to determine what kind of Rigid Object wrapper to make (either kinematic or dynamic-library-specific) |
builtFromConfig | Unused for wrapper objects. All wrappers are constructed from scratch. |
Returns | Newly created but unregistered ManagedObject pointer, with only default values set. |
template<class T>
core:: managedContainers:: ManagedObjectPreregistration esp:: physics:: PhysicsObjectBaseManager<T>:: preRegisterObjectFinalize(ObjWrapperPtr 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 | Will 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.
template<class T>
void esp:: physics:: PhysicsObjectBaseManager<T>:: 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.