Hopsan
|
Functions | |
template<typename T > | |
T * | getSafeConstantDataPtr (ComponentSystem *pSystem, Component *pComp, const HString &rConstantName) |
Help function to safely get the internal parameter data pointer from a subcomponent, the type needs to be known If parameter or component NULL, then error message instead of crash. | |
virtual bool | preInitialize () |
This function can be used to automate things prior to component initialization, only use this if you know what you are doing. | |
Component HOPSANCORE_DLLAPI * | createSafeComponent (ComponentSystem *pSystem, const HString &rType) |
Help function to create components and abort safely if that fails. | |
bool HOPSANCORE_DLLAPI | smartConnect (ComponentSystem *pSystem, Port *pPort1, Port *pPort2) |
Help function that only call connect if the ports are not already connected to each other. | |
bool HOPSANCORE_DLLAPI | smartDisconnect (ComponentSystem *pSystem, Port *pPort1, Port *pPort2) |
Help function that only call disconnect if the ports are connected to each other. | |
Variables | |
bool | mWarnIfUnusedSystemParameters |
This bool can be toggled off in programmed subsystems to avoid annoying warnings. | |
Component * createSafeComponent | ( | ComponentSystem * | pSystem, |
const HString & | rType ) |
Help function to create components and abort safely if that fails.
[in] | pSystem | A pointer to the system in which to create the component |
[in] | rType | A string with the unique type name of the component to create |
T * getSafeConstantDataPtr | ( | ComponentSystem * | pSystem, |
Component * | pComp, | ||
const HString & | rConstantName ) |
Help function to safely get the internal parameter data pointer from a subcomponent, the type needs to be known If parameter or component NULL, then error message instead of crash.
|
virtual |
This function can be used to automate things prior to component initialization, only use this if you know what you are doing.
One example of what you can do, is reconnecting internal connections in programmed subsystems
Reimplemented in ComponentSystem.
bool smartConnect | ( | ComponentSystem * | pSystem, |
Port * | pPort1, | ||
Port * | pPort2 ) |
Help function that only call connect if the ports are not already connected to each other.
[in] | pSystem | The system to handle the connection |
[in] | pPort1 | The first port to connect |
[in] | pPort2 | The other port to connect |
bool smartDisconnect | ( | ComponentSystem * | pSystem, |
Port * | pPort1, | ||
Port * | pPort2 ) |
Help function that only call disconnect if the ports are connected to each other.
[in] | pSystem | The system to handle the disconnection |
[in] | pPort1 | The first port to disconnect |
[in] | pPort2 | The other port to disconnect |