SOFA API  014b24ea
Open source framework for multi-physics simuation
SofaComponentNodeModel Class Reference

#include <SofaComponentNodeModel.h>

Inheritance diagram for SofaComponentNodeModel:

Detailed Description

This Class is a NodeDataModel specialisation to represent a Sofa component on the QtNodes graph. It will take a SOFA BaseObject as target and parse all Data, storing Data, Links and connections with parents components.

Protected Attributes

QString m_caption
 caption to be display on the Graph More...
 
QString m_uniqName
 unique name to refer to this node More...
 
bool debugNodeGraph
 parameter to activate graph logs. False by default. More...
 
std::vector< std::pair< QString, QString > > m_data
 Vector of Data/port hold by this component/Node. vector of pair{DataName, DataType}. More...
 
std::vector< std::shared_ptr< SofaComponentNodeData > > m_Nodedata
 vector of SofaComponentNodeData class holding pointer to the Data. To replace More...
 
std::map< QString, std::pair< QString, QString > > m_dataConnections
 Map to store all connection between this node and other. map.key = this data name, map.value = pair{ComponentName, DataName}. More...
 
sofa::core::objectmodel::BaseObjectm_SofaObject
 Pointer to the sofa object. More...
 

Public Member Functions

 SofaComponentNodeModel (std::string name="EmptyNode")
 Default empty Object constructor with 0 Data. More...
 
 SofaComponentNodeModel (sofa::core::objectmodel::BaseObject *_sofaObject, bool debugMode=false)
 constructor with a Sofa BaseObject as target More...
 
virtual ~SofaComponentNodeModel ()
 
QString caption () const override
 Interface for caption. More...
 
void setCaption (std::string str)
 
QString name () const override
 Interface for name. More...
 
size_t getNbrData ()
 Return the number of Data. More...
 
size_t getNbrConnections ()
 Return the number of connection with other Node components. More...
 
const std::map< QString, std::pair< QString, QString > > & getDataConnections ()
 return the list of connections More...
 
QtNodes::PortIndex getDataInputId (const QString &dataName)
 Return the PortIndex of a Data given its Name. More...
 
unsigned int nPorts (PortType portType) const override
 
NodeDataType dataType (PortType portType, PortIndex portIndex) const override
 Override method to give the type of Data per Port. More...
 
std::shared_ptr< NodeData > outData (PortIndex port) override
 Override method to return the NodeData given a port. More...
 
void setInData (std::shared_ptr< NodeData > data, int port) override
 Override method to set input Data. More...
 
QWidgetembeddedWidget () override
 Override method for more advance node gui. Not yet used. More...
 

Protected Member Functions

void parseSofaObjectData ()
 } More...
 

Attribute details

bool SofaComponentNodeModel::debugNodeGraph
protected

parameter to activate graph logs. False by default.

QString SofaComponentNodeModel::m_caption
protected

caption to be display on the Graph

std::vector< std::pair < QString, QString> > SofaComponentNodeModel::m_data
protected

Vector of Data/port hold by this component/Node. vector of pair{DataName, DataType}.

std::map<QString, std::pair < QString, QString> > SofaComponentNodeModel::m_dataConnections
protected

Map to store all connection between this node and other. map.key = this data name, map.value = pair{ComponentName, DataName}.

std::vector< std::shared_ptr<SofaComponentNodeData> > SofaComponentNodeModel::m_Nodedata
protected

vector of SofaComponentNodeData class holding pointer to the Data. To replace

See also
m_data when api is validated.
sofa::core::objectmodel::BaseObject* SofaComponentNodeModel::m_SofaObject
protected

Pointer to the sofa object.

QString SofaComponentNodeModel::m_uniqName
protected

unique name to refer to this node

Constructor details

SofaComponentNodeModel::SofaComponentNodeModel ( std::string  name = "EmptyNode")

Default empty Object constructor with 0 Data.

SofaComponentNodeModel::SofaComponentNodeModel ( sofa::core::objectmodel::BaseObject _sofaObject,
bool  debugMode = false 
)

constructor with a Sofa BaseObject as target

virtual SofaComponentNodeModel::~SofaComponentNodeModel ( )
inlinevirtual

Function details

QString SofaComponentNodeModel::caption ( ) const
inlineoverride

Interface for caption.

NodeDataType SofaComponentNodeModel::dataType ( PortType  portType,
PortIndex  portIndex 
) const
override

Override method to give the type of Data per Port.

QWidget* SofaComponentNodeModel::embeddedWidget ( )
inlineoverride

Override method for more advance node gui. Not yet used.

const std::map<QString, std::pair < QString, QString> >& SofaComponentNodeModel::getDataConnections ( )
inline

return the list of connections

See also
m_dataConnections
QtNodes::PortIndex SofaComponentNodeModel::getDataInputId ( const QString &  dataName)

Return the PortIndex of a Data given its Name.

size_t SofaComponentNodeModel::getNbrConnections ( )
inline

Return the number of connection with other Node components.

size_t SofaComponentNodeModel::getNbrData ( )
inline

Return the number of Data.

QString SofaComponentNodeModel::name ( ) const
inlineoverride

Interface for name.

unsigned int SofaComponentNodeModel::nPorts ( PortType  portType) const
override

Interface for QtNodes { Override method to return the number of ports

std::shared_ptr< NodeData > SofaComponentNodeModel::outData ( PortIndex  port)
override

Override method to return the NodeData given a port.

void SofaComponentNodeModel::parseSofaObjectData ( )
protected

}

Internal method to parse all Data of a Sofa component and create the corresponding ports

void SofaComponentNodeModel::setCaption ( std::string  str)
inline
void SofaComponentNodeModel::setInData ( std::shared_ptr< NodeData >  data,
int  port 
)
override

Override method to set input Data.