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>
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... | |
Cell * | getCell (unsigned int) const override |
get cell by order number (not cell index) More... | |
Component * | getComponentByName (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... | |
Component * | getSubComponent (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... | |
MultiComponent * | getParentMultiComponent (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... | |
PhysicalModel * | getPhysicalModel () const |
get the physical model More... | |
Properties * | getProperties () |
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 | |
Properties * | properties |
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... | |
A multi-component stores other components, hence providing a way to have an tree representation of components. Isn't that tricky?
MultiComponent::MultiComponent | ( | PhysicalModel * | p | ) |
Default Constructor.
References components.
MultiComponent::MultiComponent | ( | PhysicalModel * | p, |
std::string | n | ||
) |
constructor that allows one to name the structure (provides a name)
References components.
|
override |
delete all the subcomponents (call the deleteAllSubComponents method)
References deleteAllSubComponents(), Component::deleteProperties(), and Component::removeFromParents().
|
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().
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().
|
overridevirtual |
|
inline |
conveniant method to get the sub component of the name given in parameter
References components, and Component::isInstanceOf().
Referenced by PhysicalModel::getComponentByName().
|
overridevirtual |
get the total nr of cell of the component
Implements Component.
References components.
Referenced by PhysicalModel::getNumberOfCells().
|
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().
|
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().
|
inlineoverridevirtual |
return true only if the parameter is equal to "MultiComponent"
Implements Component.
|
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.
|
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
c | the ptr to the structure to remove |
References components, and Component::removeParentMultiComponent().
|
overridevirtual |
set the physical model (recursively)
Reimplemented from Component.
References components, and Component::setPhysicalModel().
Referenced by PhysicalModel::setExclusiveComponents(), and PhysicalModel::setInformativeComponents().
|
overridevirtual |
set the state of a visibility mode in all the sub component.
Implements Component.
References components.
|
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().
|
protected |
List of sub component.
Referenced by addSubComponent(), deleteAllSubComponents(), getCell(), getComponentByName(), getNumberOfCells(), getNumberOfSubComponents(), getSubComponent(), isVisible(), MultiComponent(), removeSubComponent(), setPhysicalModel(), setVisible(), and xmlPrint().