Hopsan
ConnectionAssistant Class Reference

Public Member Functions

 ConnectionAssistant (ComponentSystem *pComponentSystem)
 
bool mergeNodeConnection (Port *pPort1, Port *pPort2)
 
bool splitNodeConnection (Port *pPort1, Port *pPort2)
 
void determineWhereToStoreNodeAndStoreIt (Node *pNode)
 Find the system highest up in the model hierarchy for the ports connected to this node and store the node there.
 
void clearSysPortNodeTypeIfEmpty (Port *pPort)
 Helpfunction that clears the nodetype in empty systemports, It will not clear the type if the port is not empty or if the port is not a systemport.
 
bool ensureNotCrossConnecting (Port *pPort1, Port *pPort2)
 
bool ensureSameNodeType (Port *pPort1, Port *pPort2)
 
bool ensureConnectionOK (Node *pNode, Port *pPort1, Port *pPort2)
 
PortifMultiportAddSubport (Port *pMaybeMultiport)
 Detects if a port is a multiport and then adds and returns a subport.
 
void ifMultiportPrepareDissconnect (Port *pMaybeMultiport1, Port *pMaybeMultiport2, Port *&rpActualPort1, Port *&rpActualPort2)
 
void ifMultiportCleanupAfterConnect (Port *pMaybeMultiport, Port **ppActualPort, const bool wasSucess)
 
void ifMultiportCleanupAfterDissconnect (Port *pMaybeMultiport, Port **ppActualPort, const bool wasSucess)
 

Member Function Documentation

◆ determineWhereToStoreNodeAndStoreIt()

void determineWhereToStoreNodeAndStoreIt ( Node * pNode)

Find the system highest up in the model hierarchy for the ports connected to this node and store the node there.

Parameters
[in]pNodeThe node to store

◆ ensureConnectionOK()

bool ensureConnectionOK ( Node * pNode,
Port * pPort1,
Port * pPort2 )

◆ ifMultiportAddSubport()

Port * ifMultiportAddSubport ( Port * pMaybeMultiport)

Detects if a port is a multiport and then adds and returns a subport.

Parameters
[in]pMaybeMultiportA pointer to the port that may be a multiport
Returns
A pointer to a new subport in the multiport, or the pMaybeMultiport itself if it was not a multiport

◆ ifMultiportCleanupAfterConnect()

void ifMultiportCleanupAfterConnect ( Port * pMaybeMultiport,
Port ** ppActualPort,
const bool wasSucess )

◆ ifMultiportCleanupAfterDissconnect()

void ifMultiportCleanupAfterDissconnect ( Port * pMaybeMultiport,
Port ** ppActualPort,
const bool wasSucess )

◆ mergeNodeConnection()

bool mergeNodeConnection ( Port * pPort1,
Port * pPort2 )
Note
requires that input ports are not multiports (they can be subports in multiports)

◆ splitNodeConnection()

bool splitNodeConnection ( Port * pPort1,
Port * pPort2 )
Note
Requires that the input ports are not multiports