Computer Assisted Medical Intervention Tool Kit  version 6.0
Loading...
Searching...
No Matches
MultiComponent Class Reference

A multi-component stores other components, hence providing a way to have an tree representation of components. More...

#include <MultiComponent.h>

Public Member Functions

void addSubComponent (Component *)
 add a component in the list of subcomponents (and set the isExclusive flag accordingly to the state of this MultiComponent)
void deleteAllSubComponents ()
 this method free all the sub-components (i.e.
CellgetCell (unsigned int) const override
 get cell by order number (not cell index)
ComponentgetComponentByName (const std::string)
 conveniant method to get the sub component of the name given in parameter
unsigned int getNumberOfCells () const override
 get the total nr of cell of the component
unsigned int getNumberOfSubComponents () const
 return the number of subcomponents
ComponentgetSubComponent (const unsigned int) const
 get a subcomponent by its order number (index in the list of subcomponents)
bool isInstanceOf (const char *) const override
 return true only if the parameter is equal to "MultiComponent"
bool isVisible (const RenderingMode::Mode mode) const override
 return the state of a visibility mode in all the sub component (if at least one sub component is visible for this mode, it will return true; if none are visible it will return false).
 MultiComponent (PhysicalModel *)
 Default Constructor.
 MultiComponent (PhysicalModel *, std::string)
 constructor that allows one to name the structure (provides a name)
void removeSubComponent (Component *c)
 Remove a component from the list.
void setPhysicalModel (PhysicalModel *) override
 set the physical model (recursively)
void setVisible (const RenderingMode::Mode mode, const bool b) override
 set the state of a visibility mode in all the sub component.
void xmlPrint (std::ostream &) const override
 print to an output stream in "pseaudo" XML format (do nothing if there are no sub components).
 ~MultiComponent () override
 delete all the subcomponents (call the deleteAllSubComponents method)
Public Member Functions inherited from Component
 Component (PhysicalModel *, std::string n="")
 Default constructor, a component needs to know the PM it is in.
const std::string getName () const
 get the name of the component
bool isExclusive () const
 tell if this component is exclusive or not
void setExclusive (const bool)
 set the exclusive flag
void setName (const std::string)
 set the name of the component
virtual ~Component ()
 Virtual destructor needed here as this is an abstract class (pure virtual).
std::vector< MultiComponent * > getAllParentMultiComponents ()
 get the list of all the Multi Component that are using this Component
unsigned int getNumberOfParentMultiComponents () const
 get the number of MultiComponent that are using this Component (= nr of parent component)
MultiComponentgetParentMultiComponent (unsigned int)
 get a particular MultiComponent that is using this Component (a particular parent component)
void addParentMultiComponent (MultiComponent *)
 add a particular parent MultiComponent in the list
void removeParentMultiComponent (MultiComponent *)
 remove a particular parent MultiComponent
PhysicalModelgetPhysicalModel () const
 get the physical model
PropertiesgetProperties ()
 get the component structural properties (guarantied to be non nullptr)

Protected Attributes

std::vector< Component * > components
 List of sub component.
Propertiesproperties

Additional Inherited Members

void removeFromParents ()
 this tell the parent components that this component is removed from memory.
void deleteProperties ()
 delete the "properties" pointer and set it to nullptr

Detailed Description

A multi-component stores other components, hence providing a way to have an tree representation of components.

Isn't that tricky?

Note
To delete and free the memory of all the sub components, you have to call the deleteAllSubComponents() method.

Constructor & Destructor Documentation

◆ MultiComponent() [1/2]

MultiComponent::MultiComponent ( PhysicalModel * p)

Default Constructor.

References Component::Component(), and components.

Referenced by getComponentByName().

◆ MultiComponent() [2/2]

MultiComponent::MultiComponent ( PhysicalModel * p,
std::string n )

constructor that allows one to name the structure (provides a name)

References Component::Component(), and components.

◆ ~MultiComponent()

MultiComponent::~MultiComponent ( )
override

delete all the subcomponents (call the deleteAllSubComponents method)

References deleteAllSubComponents(), Component::deleteProperties(), and Component::removeFromParents().

Member Function Documentation

◆ addSubComponent()

void MultiComponent::addSubComponent ( Component * c)
inline

add a component in the list of subcomponents (and set the isExclusive flag accordingly to the state of this MultiComponent)

References Component::addParentMultiComponent(), Component::Component(), components, Component::isExclusive(), and Component::setExclusive().

Referenced by CreateSC::apply(), SofaSimulator::createPml(), PMLTransform::generateExternalSurface(), and PMLComponentExtension::save().

◆ deleteAllSubComponents()

void MultiComponent::deleteAllSubComponents ( )

this method free all the sub-components (i.e.

delete all the sub component and clear the list). After this methode getNumberOfSubComponents should return 0

References components.

Referenced by ~MultiComponent().

◆ getCell()

Cell * MultiComponent::getCell ( unsigned int cellOrderNr) const
overridevirtual

get cell by order number (not cell index)

Implements Component.

References components.

◆ getComponentByName()

Component * MultiComponent::getComponentByName ( const std::string n)
inline

conveniant method to get the sub component of the name given in parameter

References Component::Component(), components, Component::isInstanceOf(), and MultiComponent().

◆ getNumberOfCells()

unsigned int MultiComponent::getNumberOfCells ( ) const
overridevirtual

get the total nr of cell of the component

Implements Component.

References components.

◆ getNumberOfSubComponents()

unsigned int MultiComponent::getNumberOfSubComponents ( ) const
inline

return the number of subcomponents

References components.

Referenced by PMLComponent::selectMC(), and xmlPrint().

◆ getSubComponent()

Component * MultiComponent::getSubComponent ( const unsigned int i) const
inline

get a subcomponent by its order number (index in the list of subcomponents)

References Component::Component(), and components.

Referenced by PMLComponent::selectMC().

◆ isInstanceOf()

bool MultiComponent::isInstanceOf ( const char * className) const
inlineoverridevirtual

return true only if the parameter is equal to "MultiComponent"

Implements Component.

◆ isVisible()

bool MultiComponent::isVisible ( const RenderingMode::Mode mode) const
overridevirtual

return the state of a visibility mode in all the sub component (if at least one sub component is visible for this mode, it will return true; if none are visible it will return false).

Implements Component.

References components.

◆ removeSubComponent()

void MultiComponent::removeSubComponent ( Component * c)
inline

Remove a component from the list.

Becareful: this method DOES NOT delete the object and/or free the memory. This method ask the component c to remove this multicomponent from the list of its parent component

Parameters
cthe ptr to the structure to remove
See also
removeAllSubComponent()

References Component::Component(), components, and Component::removeParentMultiComponent().

◆ setPhysicalModel()

void MultiComponent::setPhysicalModel ( PhysicalModel * pm)
overridevirtual

set the physical model (recursively)

Reimplemented from Component.

References components, and Component::setPhysicalModel().

Referenced by PhysicalModel::setExclusiveComponents(), and PhysicalModel::setInformativeComponents().

◆ setVisible()

void MultiComponent::setVisible ( const RenderingMode::Mode mode,
const bool b )
overridevirtual

set the state of a visibility mode in all the sub component.

Implements Component.

References components.

◆ xmlPrint()

void MultiComponent::xmlPrint ( std::ostream & o) const
overridevirtual

print to an output stream in "pseaudo" XML format (do nothing if there are no sub components).

Implements Component.

References components, Component::getName(), getNumberOfSubComponents(), and Component::properties.

Member Data Documentation

◆ components


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