Class Base#

Nested Relationships#

Nested Types#

Inheritance Relationships#

Base Type#

  • public std::enable_shared_from_this< Base >

Derived Types#

Class Documentation#

class Base : public std::enable_shared_from_this<Base>#

Common base class used by most simulation objects.

Subclassed by Karana::Collision::ContactForceBase, Karana::Core::LockingBase, Karana::Dynamics::NodeDeformationProvider, Karana::Dynamics::TimeKeeper, Karana::Dynamics::TimedEvent, Karana::Frame::Frame, Karana::KUtils::H5Writer, Karana::Models::KModelContinuousStates, Karana::Models::KModelDiscreteStates, Karana::Models::KModelParams, Karana::Models::KModelScratch, Karana::Scene::AbstractStaticGeometry, Karana::Scene::PhongMaterial, Karana::Scene::PhysicalMaterial, Karana::Scene::Scene, Karana::Scene::SceneNode, Karana::Scene::Texture

Public Functions

Base(std::string_view name, const ks_ptr<BaseContainer> &container = nullptr)#

Base class constructor.

Parameters:
  • name – Name for the base class.

  • container – The container to add the Base too. If none is specified, the default singleton container will be used.

virtual ~Base()#

Destructor.

Base(const Base &other)#

Copy constructor.

Parameters:

otherBase class to copy.

Base &operator=(const Base &other) noexcept#

Copy assignment operator.

Parameters:

otherBase class to copy.

Returns:

A reference to this object

Base(Base &&other)#

Move constructor.

Parameters:

otherBase class to move.

Base &operator=(Base &&other)#

Move assignment operator.

Parameters:

otherBase class to move.

Returns:

A reference to this object

const id_t &id() const#

id of this object.

Returns:

id of this object.

virtual const std::string &typeString() const noexcept#

Returns the type string of Base.

Returns:

The type string.

inline virtual bool isFinalized() const#

Checks is the params for the object have been initialized.

Returns:

True if the params have set up.

bool isZombie()#

Returns true if this object is a zombie, false otherwise. Note, only things derived from LockingBase can actually become zobmies.

Returns:

True if object is a zombie, false otherwise.

ks_ptr<Base> getPtr()#

Get a shared_ptr to self, enabled by the std::enabled_shared_from_this pattern.

Returns:

Shared pointer to this.

ks_ptr<const Base> getPtr() const#

Get a shared_ptr to self, enabled by the std::enabled_shared_from_this pattern.

Returns:

Const shared pointer to this.

const std::string &name() const noexcept#

Name of this object.

Returns:

Name of this object.

virtual std::string dumpString(const std::string &prefix = "", const dumpOptions *options = nullptr) const#

Return information about the object.

Parameters:
  • prefix – A string to use as prefix for each output line

  • options – Struct with options to tailor the output

Returns:

String with the information about the object.

inline void dump(const std::string &prefix = "", const dumpOptions *options = nullptr) const#

Print dumpString on std::cout.

Parameters:
  • prefix – A string to use as prefix for each output line

  • options – Struct with options to tailor the output

Protected Functions

virtual void _discard(ks_ptr<Base> &base)#

Discard the the object. Derived classes should implement this with the logic required to discard themselves if applicable.

Parameters:

base – - A pointer to the object to discard.

Protected Attributes

bool _zombie = false#

Indicates whether the object is in a zombie state.

std::string _name#

The name of the Base.

struct dumpOptions#

A struct with options to tailor the content from a dumpString() call.

This struct can be sub-classed by specialized classes to add custom options.

Subclassed by Karana::Core::LockingBase::dumpOptions

Public Functions

dumpOptions() = default#
inline dumpOptions &operator=(const dumpOptions &p)#

Copy assignment operator.

Parameters:

p – The dumpOptions to copy from.

Returns:

A reference to this.

inline dumpOptions(const dumpOptions &p)#

Copy constructor.

Parameters:

p – The dumpOptions to copy from.

inline virtual ~dumpOptions()#

Destructor.

Public Members

bool typeString = true#

include the typeString info

bool id = true#

include the tree id

bool refCount = true#

include the reference count

bool cacheDeps = true#

Report cache dependency info.