My Project
 All Classes Functions
Public Member Functions | List of all members
EnjoLib::ModuleMessaging Class Reference

Lets obtaining variables from other modules, that were exposed by them. More...

#include <ModuleMessaging.hpp>

Public Member Functions

Result< bool > GetBool (const char *moduleName, const char *varName)
 Returns a bool.
 
Result< int > GetInt (const char *moduleName, const char *varName)
 Returns an int.
 
Result< double > GetDouble (const char *moduleName, const char *varName)
 Returns a double.
 
Result< VECTOR3 > GetVECTOR3 (const char *moduleName, const char *varName)
 Returns a VECTOR3.
 
Result< MATRIX3 > GetMATRIX3 (const char *moduleName, const char *varName)
 Returns a MATRIX3.
 
Result< MATRIX4 > GetMATRIX4 (const char *moduleName, const char *varName)
 Returns a MATRIX4.
 

Detailed Description

Lets obtaining variables from other modules, that were exposed by them.

Provided that you know the name of a module that exposes a variable, and its type, you may use the public methods of this class to receive them. Be sure to check for Result<T>::isSuccess, to make sure that the variable was even exposed. If it weren't, then the variable's default value is returned. For example:

#include <EnjoLib/ModuleMessaging.hpp>
void BurnTimeMFD::HandlerGetFromTransX()
{
using namespace EnjoLib;
Result<double> dvRes = ModuleMessaging().GetDouble("TransX", "dv");
Result<double> IManualRes = ModuleMessaging().GetDouble("TransX", "TBurn");
if (dvRes.isSuccess && IManualRes.isSuccess) // Are both values exposed?
{
IsArmed=IsEngaged=false;
mode = BURNMODE_MAN;
dv = dvRes.value;
if (IManualRes.value > 0) // We're not interested in negative times
{
IManual = IManualRes.value;
HandlerAutoBurn();
}
}
}

The documentation for this class was generated from the following files: