Hopsan
|
This class gives access to HopsanCore for model and externalLib loading as well as component creation and simulation. More...
#include <HopsanEssentials.h>
Public Member Functions | |
HopsanEssentials () | |
HopsanEssentials Constructor. | |
~HopsanEssentials () | |
HopsanEssentials Destructor. | |
const char * | getCoreVersion () const |
Returns the HopsanCore version as a string. | |
const char * | getCoreBuildTime () const |
Returns the HopsanCore build date and time. | |
const char * | getCoreCompiler () const |
Get compiler info from core. | |
bool | isCore64Bit () const |
Check if core is compiled 64-bit. | |
bool | isCoreDebugCompiled () const |
Component * | createComponent (const HString &rTypeName) |
Creates a component with the specified key-value and returns a pointer to this component. | |
ComponentSystem * | createComponentSystem () |
Creates a ComponentSystem. | |
ConditionalComponentSystem * | createConditionalComponentSystem () |
Creates a ConditionalComponentSystem. | |
void | removeComponent (Component *pComponent) |
void | removeNode (Node *pNode) |
bool | hasComponent (const HString &rType) const |
Check if a component with given typename exist in the ComponentFactory. | |
bool | reserveComponentTypeName (const HString &rTypeName) |
Reserves a component TypeName in the component factory map. | |
const std::vector< HString > | getRegisteredComponentTypes () const |
Returns a vector containing all registered component types. | |
Node * | createNode (const HString &rNodeType) |
Creates a Node of given node type. | |
const std::vector< HString > | getRegisteredNodeTypes () const |
Returns a vector containing all registered node types. | |
bool | haveQuantity (const HString &rQuantity) const |
Check if a quantity name is registered. | |
HopsanCoreMessageHandler * | getCoreMessageHandler () |
Returns a pointer to the core message handler, do NOT use this function to get messages. | |
void | getMessage (HString &rMessage, HString &rType, HString &rTag) |
Get the message waiting on the message queue. | |
size_t | checkMessage () |
Check if there are any messages waiting in the queue. | |
size_t | getNumInfoMessages () const |
Returns the number of waiting info messages on the message queue. | |
size_t | getNumWarningMessages () const |
Returns the number of waiting warning messages on the message queue. | |
size_t | getNumErrorMessages () const |
Returns the number of waiting error messages on the message queue. | |
size_t | getNumFatalMessages () const |
Returns the number of waiting fatal messages on the message queue. | |
size_t | getNumDebugMessages () const |
Returns the number of waiting debug messages on the message queue. | |
bool | openCoreLogFile (const char *absoluteFilePath) |
Opens the HopsanCore runtime log file, if not already opened. | |
bool | loadExternalComponentLib (const char *path) |
Loads an external component library. | |
bool | unLoadExternalComponentLib (const char *path) |
Unloads an external component library. | |
void | getExternalComponentLibNames (std::vector< HString > &rLibNames) |
Get the libNames of the currently loaded libs (the names compiled into libs) | |
void | getExternalLibraryContents (const char *libPath, std::vector< HString > &rComponents, std::vector< HString > &rNodes) |
Get the contents (components and nodes) registered by an external library. | |
void | getLibPathForComponentType (const HString &rTypeName, HString &rLibPath) |
Returns the path to the library file from where specified component is loaded. | |
ComponentSystem * | loadHMFModelFile (const char *filePath, double &rStartTime, double &rStopTime) |
This function is used to load a HMF file. | |
ComponentSystem * | loadHMFModel (const std::vector< unsigned char > xmlVector) |
ComponentSystem * | loadHMFModel (const char *xmlString, double &rStartTime, double &rStopTime) |
This function is used to load a HMF model from a string. | |
SimulationHandler * | getSimulationHandler () |
This class gives access to HopsanCore for model and externalLib loading as well as component creation and simulation.
~HopsanEssentials | ( | ) |
HopsanEssentials Destructor.
size_t checkMessage | ( | ) |
Check if there are any messages waiting in the queue.
Creates a component with the specified key-value and returns a pointer to this component.
[in] | rTypeName | The unique type identifier of the component to create |
<
ComponentSystem * createComponentSystem | ( | ) |
Creates a ComponentSystem.
ConditionalComponentSystem * createConditionalComponentSystem | ( | ) |
Creates a ConditionalComponentSystem.
Creates a Node of given node type.
[in] | rNodeType | The type of node to create |
void getExternalComponentLibNames | ( | std::vector< HString > & | rLibNames | ) |
Get the libNames of the currently loaded libs (the names compiled into libs)
[out] | rLibNames | A reference to the vector that will contain the lib names |
void getExternalLibraryContents | ( | const char * | libPath, |
std::vector< HString > & | rComponents, | ||
std::vector< HString > & | rNodes ) |
Get the contents (components and nodes) registered by an external library.
[in] | libPath | Path to the external library |
[out] | rComponents | A reference to the vector that will contain the component names |
[out] | rNodes | A reference to the vector that will contain the node names |
Returns the path to the library file from where specified component is loaded.
rTypeName | Type name of component |
rLibPath | Reference string where path is stored |
Get the message waiting on the message queue.
[out] | rMessage | A reference to the message string |
[out] | rType | A reference to the message type string |
[out] | rTag | A reference to the message type Tag |
bool hasComponent | ( | const HString & | rType | ) | const |
Check if a component with given typename exist in the ComponentFactory.
[in] | rType | The typename to check |
bool haveQuantity | ( | const HString & | rQuantity | ) | const |
Check if a quantity name is registered.
[in] | rQuantity | The name of the quantity |
bool isCore64Bit | ( | ) | const |
Check if core is compiled 64-bit.
bool loadExternalComponentLib | ( | const char * | path | ) |
Loads an external component library.
[in] | path | The path to the library DLL or SO file |
ComponentSystem * loadHMFModel | ( | const char * | xmlString, |
double & | rStartTime, | ||
double & | rStopTime ) |
This function is used to load a HMF model from a string.
[in] | xmlString | The model xml string |
[out] | rStartTime | A reference to the starttime variable |
[out] | rStopTime | A reference to the stoptime variable |
ComponentSystem * loadHMFModelFile | ( | const char * | filePath, |
double & | rStartTime, | ||
double & | rStopTime ) |
This function is used to load a HMF file.
[in] | filePath | The name (path) of the HMF file |
[out] | rStartTime | A reference to the starttime variable |
[out] | rStopTime | A reference to the stoptime variable |
bool openCoreLogFile | ( | const char * | absoluteFilePath | ) |
Opens the HopsanCore runtime log file, if not already opened.
[in] | absoluteFilePath | The file path of the log file |
void removeComponent | ( | Component * | pComponent | ) |
bool reserveComponentTypeName | ( | const HString & | rTypeName | ) |
Reserves a component TypeName in the component factory map.
[in] | rTypeName | The TypeName to reserve |
bool unLoadExternalComponentLib | ( | const char * | path | ) |
Unloads an external component library.
[in] | path | The path to the library DLL or SO file to unload |