AGX Dynamics 2.42.3.0
Loading...
Searching...
No Matches
agxPowerLine::Unit Class Reference

Pure virtual class. More...

#include <Unit.h>

+ Inheritance diagram for agxPowerLine::Unit:

Public Member Functions

 Unit ()
 Constructor.
 
void addNotification (agxPowerLine::PowerLine *powerLine)
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxPowerLine::Unit)
 
void attach (agx::RigidBody *body)
 Define which body in the simulation this Unit is attached to.
 
agx::String buildDimensionsName () const
 
virtual bool connect (agxPowerLine::Connector *connector)
 Connect the unit to a connector.
 
virtual bool connect (agxPowerLine::Side mySide, agxPowerLine::Side connectorSide, agxPowerLine::Connector *connector)
 Connect the unit to a connector, specifying the side of each.
 
virtual bool connect (agxPowerLine::Side mySide, agxPowerLine::Side otherSide, agxPowerLine::Unit *other)
 
virtual bool connect (agxPowerLine::Unit *otherUnit)
 Connect the unit to another unit.
 
virtual bool disconnect (agxPowerLine::Unit *unit)
 
void disconnectAll ()
 
agxPowerLine::PhysicalDimension * getActiveDimension (size_t index)
 
const agxPowerLine::PhysicalDimension * getActiveDimension (size_t index) const
 
virtual agxPowerLine::DimensionAndSide getConnectableDimension (agxPowerLine::PhysicalDimension::Type type, agxPowerLine::Side side)
 
virtual void getConnectableDimensionTypes (agxPowerLine::PhysicalDimension::TypeVector &types, agxPowerLine::Side side) const
 
agxPowerLine::PhysicalDimension * getConnectableInputDimension (agxPowerLine::PhysicalDimension::Type type)
 
agxPowerLine::PhysicalDimension * getConnectableOutputDimension (agxPowerLine::PhysicalDimension::Type type)
 
void getConnectedUnits (UnitPtrSetVector &result, agxPowerLine::Side side)
 
size_t getConnectors (agxPowerLine::ConnectorPtrVector &result) const
 
size_t getConnectors (const agxPowerLine::Unit *unit, agxPowerLine::ConnectorPtrVector &result)
 Append all connectors connecting this Unit to the given Unit to the 'result' Vector.
 
agxPowerLine::PhysicalDimension * getDimension (agxPowerLine::PhysicalDimension::Type type)
 
const agxPowerLine::PhysicalDimension * getDimension (agxPowerLine::PhysicalDimension::Type type) const
 
agxPowerLine::PhysicalDimensionRefVector & getDimensions ()
 
const agxPowerLine::PhysicalDimensionRefVector & getDimensions () const
 
Connector * getFirstInputConnector (const agxPowerLine::Unit *unit) const
 
Connector * getFirstOutputConnector (const agxPowerLine::Unit *unit) const
 
bool getIgnoreForStoreRestoreStream () const
 
size_t getInputConnectors (agxPowerLine::ConnectorPtrVector &result) const
 
size_t getInputConnectors (const agxPowerLine::Unit *unit, agxPowerLine::ConnectorPtrVector &result)
 
size_t getNumActiveDimensions () const
 The number of non-null PhysicalDimension in this Unit, not including internal Units.
 
virtual size_t getNumConnectableDimensions (Side side) const
 
size_t getNumConnections () const
 
size_t getOutputConnectors (agxPowerLine::ConnectorPtrVector &result) const
 
size_t getOutputConnectors (const agxPowerLine::Unit *unit, agxPowerLine::ConnectorPtrVector &result)
 
void getOwnConnectedUnits (UnitPtrSetVector &unitSet, agxPowerLine::Side side, bool startFromCleanUnitSet=true) const
 
void getOwnConnectedUnits (UnitPtrSetVector &unitSet, bool startFromCleanUnitSet=true) const
 Constructs the set of Units connected to this Unit's own dimensions.
 
agxPowerLine::PowerLine * getPowerLine () const
 
agxPowerLine::Unit * getRoot () const
 
agxPowerLine::Side getSide (const Connector *connector) const
 
bool hasConnector (const Connector *connector) const
 
virtual bool isConnected (agxPowerLine::Unit *otherUnit) const
 
virtual bool isValid () const
 
virtual bool postRestore (agxStream::StorageStream &str)
 
virtual bool postStore (agxStream::StorageStream &str) const
 
void removeNotification (agxPowerLine::PowerLine *powerLine)
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual bool restore (agxStream::StorageStream &str) override
 Restores internal data from stream.
 
void setRoot (agxPowerLine::Unit *root)
 
void spreadRootToGraph ()
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual bool store (agxStream::StorageStream &str) const override
 Stores internal data into stream.
 
virtual bool vetoConnect (agxPowerLine::Connector *connector) const
 
- Public Member Functions inherited from agxPowerLine::SubGraph
 SubGraph ()
 
virtual bool addNotification (agxSDK::Simulation *simulation)=0
 
 AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE (agxPowerLine::SubGraph)
 
virtual void getConnectorsRecursive (ConnectorPtrVector &connectors)
 Fill the given vector with the Connectors that are held by this SubGraph.
 
Connector * getEnclosingConnector ()
 
const Connector * getEnclosingConnector () const
 
SubGraph * getEnclosingGraph ()
 
const SubGraph * getEnclosingGraph () const
 
Unit * getEnclosingUnit ()
 
const Unit * getEnclosingUnit () const
 
const agxPowerLine::ConnectorRefVector & getInternalConnectors () const
 
const agxPowerLine::UnitRefVector & getInternalUnits () const
 
const agx::Name & getName () const
 
SubGraph * getRootEnclosingGraph ()
 
const SubGraph * getRootEnclosingGraph () const
 
virtual void getUnitsRecursive (UnitPtrVector &units)
 Fill the given vector with the Units that are held by this SubGraph.
 
bool isEnclosedWithin (const SubGraph *component) const
 
virtual bool postUpdate (agx::Real timeStep)
 
virtual void prepareForRestore ()
 
virtual void prepareForStore ()
 
virtual bool preUpdate (agx::Real timeStep)
 
virtual bool removeNotification (agxUtil::ConstraintHolder *holder, agxSDK::Simulation *simulation)=0
 
virtual void restore (agxStream::InputArchive &in) override
 
virtual bool restore (agxStream::StorageStream &str)
 Restores internal data from stream.
 
void setName (const agx::Name &name)
 Set the name of this power line component.
 
void spreadPowerLineToGraph ()
 
virtual void store (agxStream::OutputArchive &out) const override
 
virtual bool store (agxStream::StorageStream &str) const
 Stores internal data into stream.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
- Public Member Functions inherited from agxStream::Serializable
virtual ~Serializable ()
 Destructor for normal C++ use but hidden from SWIG bindings.
 
virtual const char * getClassName () const
 
bool getEnableSerialization () const
 
bool getEnableUuidGeneration ()
 
agx::UInt32 getIndex () const
 This index is given at creation of this object.
 
virtual StorageAgent * getStorageAgent () const =0
 
agx::Uuid getUuid () const
 
bool isFinished () const
 
void setEnableSerialization (bool flag)
 Set to false to disable serialization of this object.
 
void setFinished ()
 Tells this class that it is restored correctly and should not be deleted during destruction of an Archive.
 
void setUuid (const agx::Uuid &uuid)
 Explicitly set a Uuid on a serializable object.
 

Protected Member Functions

virtual ~Unit ()
 
bool activateDimension (PhysicalDimension *dimension)
 
virtual bool hasValidInputConnection () const
 returns if it is possible to connect to this unit
 
void restorePre46 (agxStream::InputArchive &in)
 
void setPowerLine (PowerLine *powerLine)
 Point to the power line the unit is a part of.
 
- Protected Member Functions inherited from agxPowerLine::SubGraph
virtual ~SubGraph ()
 
void addInternalConnector (agxPowerLine::Connector *connector)
 
void addInternalUnit (agxPowerLine::Unit *unit)
 
void removeInternalConnector (agxPowerLine::Connector *connector)
 
void removeInternalUnit (agxPowerLine::Unit *unit)
 
agx::Bool replaceInternalUnit (agxPowerLine::Unit *oldUnit, agxPowerLine::Unit *newUnit)
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
- Protected Member Functions inherited from agxStream::Serializable
 Serializable ()
 Default constructor.
 
 Serializable (const Serializable &other)
 Copy constructor.
 
void generateUuid ()
 

Protected Attributes

agx::observer_ptr< agx::RigidBody > m_attachBody
 
PhysicalDimensionRefVector m_dimensions
 
bool m_ignoreMeForStoreRestoreStream
 
agxPowerLine::Unit * m_rootUnit
 
- Protected Attributes inherited from agxPowerLine::SubGraph
SubGraphObserver m_enclosingGraph
 
ConnectorRefVector m_internalConnectors
 
UnitRefVector m_internalUnits
 
agx::Name m_name
 
PowerLine * m_powerLine
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Public Member Functions inherited from agxStream::Serializable
static void setEnableUuidGeneration (bool flag)
 Specify if there should be UUID:s generated for each new Serializable object. By default it is enabled.
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 

Detailed Description

Pure virtual class.

Definition at line 71 of file Unit.h.

Constructor & Destructor Documentation

◆ Unit()

agxPowerLine::Unit::Unit ( )

Constructor.

◆ ~Unit()

virtual agxPowerLine::Unit::~Unit ( )
protectedvirtual

Member Function Documentation

◆ activateDimension()

bool agxPowerLine::Unit::activateDimension ( PhysicalDimension *  dimension)
protected

◆ addNotification()

void agxPowerLine::Unit::addNotification ( agxPowerLine::PowerLine *  powerLine)

◆ AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE()

agxPowerLine::Unit::AGXSTREAM_DECLARE_ABSTRACT_SERIALIZABLE ( agxPowerLine::Unit  )

◆ attach()

void agxPowerLine::Unit::attach ( agx::RigidBody *  body)

Define which body in the simulation this Unit is attached to.

If the body is nullptr the Unit is attached to world. This will override any parent body set to the power line the unit is a part of.

◆ buildDimensionsName()

agx::String agxPowerLine::Unit::buildDimensionsName ( ) const
Returns
A concatenation of the names of the bodies of the dimensions in this Unit.

◆ connect() [1/4]

virtual bool agxPowerLine::Unit::connect ( agxPowerLine::Connector *  connector)
virtual

Connect the unit to a connector.

Parameters
connector- a connector
Returns
true and connects if there are physical dimensions that match

◆ connect() [2/4]

virtual bool agxPowerLine::Unit::connect ( agxPowerLine::Side  mySide,
agxPowerLine::Side  connectorSide,
agxPowerLine::Connector *  connector 
)
virtual

Connect the unit to a connector, specifying the side of each.

Parameters
mySide- The side on this unit to connect.
connectorSide- The side on the connector to connect.
connector- The connector to connect.
Returns
True if the connection was made, false otherwise.

◆ connect() [3/4]

virtual bool agxPowerLine::Unit::connect ( agxPowerLine::Side  mySide,
agxPowerLine::Side  otherSide,
agxPowerLine::Unit *  other 
)
virtual

◆ connect() [4/4]

virtual bool agxPowerLine::Unit::connect ( agxPowerLine::Unit *  otherUnit)
virtual

Connect the unit to another unit.

Parameters
otherUnit- another unit.

◆ disconnect()

virtual bool agxPowerLine::Unit::disconnect ( agxPowerLine::Unit *  unit)
virtual

◆ disconnectAll()

void agxPowerLine::Unit::disconnectAll ( )

◆ getActiveDimension() [1/2]

agxPowerLine::PhysicalDimension * agxPowerLine::Unit::getActiveDimension ( size_t  index)
Returns
The index:th non-null PhysicalDimension in this Unit, not including internal Units, or nullptr.

◆ getActiveDimension() [2/2]

const agxPowerLine::PhysicalDimension * agxPowerLine::Unit::getActiveDimension ( size_t  index) const

◆ getConnectableDimension()

◆ getConnectableDimensionTypes()

◆ getConnectableInputDimension()

agxPowerLine::PhysicalDimension * agxPowerLine::Unit::getConnectableInputDimension ( agxPowerLine::PhysicalDimension::Type  type)
Returns
The dimension of the given types that accepts connections. Can be a PhysicalDimension owned by an internal Unit.

◆ getConnectableOutputDimension()

agxPowerLine::PhysicalDimension * agxPowerLine::Unit::getConnectableOutputDimension ( agxPowerLine::PhysicalDimension::Type  type)

◆ getConnectedUnits()

void agxPowerLine::Unit::getConnectedUnits ( UnitPtrSetVector &  result,
agxPowerLine::Side  side 
)

◆ getConnectors() [1/2]

size_t agxPowerLine::Unit::getConnectors ( agxPowerLine::ConnectorPtrVector &  result) const

◆ getConnectors() [2/2]

size_t agxPowerLine::Unit::getConnectors ( const agxPowerLine::Unit *  unit,
agxPowerLine::ConnectorPtrVector &  result 
)

Append all connectors connecting this Unit to the given Unit to the 'result' Vector.

Returns the index of the first Connector added. Will be one-past-end (result.size()) if no connectors are added.

Returns
The index of the first appended Connector.

◆ getDimension() [1/2]

agxPowerLine::PhysicalDimension * agxPowerLine::Unit::getDimension ( agxPowerLine::PhysicalDimension::Type  type)
Returns
The PhysicalDimension with the given type, or nullptr. Does not search internal Units.

◆ getDimension() [2/2]

const agxPowerLine::PhysicalDimension * agxPowerLine::Unit::getDimension ( agxPowerLine::PhysicalDimension::Type  type) const

◆ getDimensions() [1/2]

agxPowerLine::PhysicalDimensionRefVector & agxPowerLine::Unit::getDimensions ( )

◆ getDimensions() [2/2]

const agxPowerLine::PhysicalDimensionRefVector & agxPowerLine::Unit::getDimensions ( ) const
Returns
A vector containing the PhysicalDimensions in this Unit, not including internal Units.

◆ getFirstInputConnector()

Connector * agxPowerLine::Unit::getFirstInputConnector ( const agxPowerLine::Unit *  unit) const

◆ getFirstOutputConnector()

Connector * agxPowerLine::Unit::getFirstOutputConnector ( const agxPowerLine::Unit *  unit) const

◆ getIgnoreForStoreRestoreStream()

bool agxPowerLine::Unit::getIgnoreForStoreRestoreStream ( ) const

◆ getInputConnectors() [1/2]

size_t agxPowerLine::Unit::getInputConnectors ( agxPowerLine::ConnectorPtrVector &  result) const

◆ getInputConnectors() [2/2]

size_t agxPowerLine::Unit::getInputConnectors ( const agxPowerLine::Unit *  unit,
agxPowerLine::ConnectorPtrVector &  result 
)

◆ getNumActiveDimensions()

size_t agxPowerLine::Unit::getNumActiveDimensions ( ) const

The number of non-null PhysicalDimension in this Unit, not including internal Units.

◆ getNumConnectableDimensions()

virtual size_t agxPowerLine::Unit::getNumConnectableDimensions ( Side  side) const
virtual
Returns
The number of connectable PhysicalDimensions in this Unit, including internal.

◆ getNumConnections()

size_t agxPowerLine::Unit::getNumConnections ( ) const

◆ getOutputConnectors() [1/2]

size_t agxPowerLine::Unit::getOutputConnectors ( agxPowerLine::ConnectorPtrVector &  result) const

◆ getOutputConnectors() [2/2]

size_t agxPowerLine::Unit::getOutputConnectors ( const agxPowerLine::Unit *  unit,
agxPowerLine::ConnectorPtrVector &  result 
)

◆ getOwnConnectedUnits() [1/2]

void agxPowerLine::Unit::getOwnConnectedUnits ( UnitPtrSetVector &  unitSet,
agxPowerLine::Side  side,
bool  startFromCleanUnitSet = true 
) const

◆ getOwnConnectedUnits() [2/2]

void agxPowerLine::Unit::getOwnConnectedUnits ( UnitPtrSetVector &  unitSet,
bool  startFromCleanUnitSet = true 
) const

Constructs the set of Units connected to this Unit's own dimensions.

Does not consider internal units.

◆ getPowerLine()

agxPowerLine::PowerLine * agxPowerLine::Unit::getPowerLine ( ) const

◆ getRoot()

agxPowerLine::Unit * agxPowerLine::Unit::getRoot ( ) const

◆ getSide()

agxPowerLine::Side agxPowerLine::Unit::getSide ( const Connector *  connector) const

◆ hasConnector()

bool agxPowerLine::Unit::hasConnector ( const Connector *  connector) const

◆ hasValidInputConnection()

virtual bool agxPowerLine::Unit::hasValidInputConnection ( ) const
protectedvirtual

returns if it is possible to connect to this unit

◆ isConnected()

virtual bool agxPowerLine::Unit::isConnected ( agxPowerLine::Unit *  otherUnit) const
virtual
Returns
true if this is connected the other through a connector

◆ isValid()

virtual bool agxPowerLine::Unit::isValid ( ) const
virtual
Returns
True if the unit and its connections and constraints are valid.

◆ postRestore()

virtual bool agxPowerLine::Unit::postRestore ( agxStream::StorageStream &  str)
virtual

Reimplemented in agxDriveTrain::ElectricMotor.

◆ postStore()

virtual bool agxPowerLine::Unit::postStore ( agxStream::StorageStream &  str) const
virtual

Reimplemented in agxDriveTrain::ElectricMotor.

◆ removeNotification()

void agxPowerLine::Unit::removeNotification ( agxPowerLine::PowerLine *  powerLine)

◆ restore() [1/2]

virtual void agxPowerLine::Unit::restore ( agxStream::InputArchive &  in)
overridevirtual

◆ restore() [2/2]

◆ restorePre46()

void agxPowerLine::Unit::restorePre46 ( agxStream::InputArchive &  in)
protected

◆ setPowerLine()

void agxPowerLine::Unit::setPowerLine ( PowerLine *  powerLine)
protected

Point to the power line the unit is a part of.

◆ setRoot()

void agxPowerLine::Unit::setRoot ( agxPowerLine::Unit *  root)

◆ spreadRootToGraph()

void agxPowerLine::Unit::spreadRootToGraph ( )

◆ store() [1/2]

virtual void agxPowerLine::Unit::store ( agxStream::OutputArchive &  out) const
overridevirtual

◆ store() [2/2]

◆ vetoConnect()

virtual bool agxPowerLine::Unit::vetoConnect ( agxPowerLine::Connector *  connector) const
virtual

Member Data Documentation

◆ m_attachBody

agx::observer_ptr<agx::RigidBody> agxPowerLine::Unit::m_attachBody
protected

Definition at line 325 of file Unit.h.

◆ m_dimensions

PhysicalDimensionRefVector agxPowerLine::Unit::m_dimensions
protected

Definition at line 323 of file Unit.h.

◆ m_ignoreMeForStoreRestoreStream

bool agxPowerLine::Unit::m_ignoreMeForStoreRestoreStream
protected

Definition at line 327 of file Unit.h.

◆ m_rootUnit

agxPowerLine::Unit* agxPowerLine::Unit::m_rootUnit
protected

Definition at line 329 of file Unit.h.


The documentation for this class was generated from the following file: