Computer Assited Medical Intervention Tool Kit  version 5.0
MultiComponent Class Reference

A multi-component stores other components, hence providing a way to have an tree representation of components. Isn't that tricky? More...

#include <MultiComponent.h>

+ Inheritance diagram for MultiComponent:
+ Collaboration diagram for MultiComponent:

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

Protected Attributes

std::vector< Component * > components
 List of sub component. More...
 
- Protected Attributes inherited from Component
Propertiesproperties
 

Additional Inherited Members

- Protected Member Functions inherited from Component
void removeFromParents ()
 this tell the parent components that this component is removed from memory. More...
 
void deleteProperties ()
 delete the "properties" pointer and set it to NULL More...
 

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 components.

◆ MultiComponent() [2/2]

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

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

References components.

◆ ~MultiComponent()

MultiComponent::~MultiComponent ( )
override

delete all the subcomponents (call the deleteAllSubComponents method)

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

+ Here is the call graph for this function:

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(), components, Component::isExclusive(), and Component::setExclusive().

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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().

+ Here is the caller graph for this function:

◆ 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 components, and Component::isInstanceOf().

Referenced by PhysicalModel::getComponentByName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNumberOfCells()

unsigned int MultiComponent::getNumberOfCells ( ) const
overridevirtual

get the total nr of cell of the component

Implements Component.

References components.

Referenced by PhysicalModel::getNumberOfCells().

+ Here is the caller graph for this function:

◆ getNumberOfSubComponents()

unsigned int MultiComponent::getNumberOfSubComponents ( ) const
inline

return the number of subcomponents

References components.

Referenced by PMLExplorerWidget::buildMultiComponentTreeWidgetItem(), PMLExplorerWidget::createMCPropertyList(), PhysicalModel::getNumberOfExclusiveComponents(), PhysicalModel::getNumberOfInformativeComponents(), PhysicalModel::optimizeIndexes(), PMLComponent::parseMultiComponent(), PMLComponent::selectMC(), xmlPrint(), and PhysicalModel::xmlPrint().

+ Here is the caller graph for this function:

◆ getSubComponent()

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

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

References components.

Referenced by PMLExplorerWidget::buildMultiComponentTreeWidgetItem(), PhysicalModel::getExclusiveComponent(), PhysicalModel::getInformativeComponent(), PhysicalModel::optimizeIndexes(), PMLComponent::parseMultiComponent(), and PMLComponent::selectMC().

+ Here is the caller graph for this function:

◆ 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 components, and Component::removeParentMultiComponent().

+ Here is the call graph for this function:

◆ 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ 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, Properties::getField(), Component::getName(), getNumberOfSubComponents(), Properties::getString(), Properties::numberOfFields(), and Component::properties.

Referenced by PhysicalModel::xmlPrint().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ components


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