LTAPI
API to access LiveTraffic's aircraft information
|
Represents a dataRef and covers late binding. More...
#include <LTAPI.h>
Public Member Functions | |
LTDataRef (std::string _sDataRef) | |
Constructor, set the dataRef's name. More... | |
bool | needsInit () const |
bool | isValid () |
Found the dataRef and it contains formats we can work with? More... | |
bool | FindDataRef () |
Finds the dataRef (and would try again and again, no matter what bValid says) More... | |
XPLMDataTypeID | getDataRefTypes () const |
Get types supported by the dataRef. More... | |
bool | hasInt () const |
Is int a supported dataRef type? More... | |
bool | hasFloat () const |
Is float a supported dataRef type? More... | |
int | getInt () |
Get dataRef's integer value. Silently returns 0 if dataRef doesn't exist. More... | |
float | getFloat () |
Get dataRef's float value. Silently returns 0.0f if dataRef doesn't exist. More... | |
bool | getBool () |
Gets dataRef's integer value and returns if it is not zero. More... | |
int | getData (void *pOut, int inOffset, int inMaxBytes) |
Gets dataRef's binary data. More... | |
void | set (int i) |
Writes an integer value to the dataRef. More... | |
void | set (float f) |
Writes a float vlue to the dataRef. More... | |
Static Public Attributes | |
static constexpr XPLMDataTypeID | usefulTypes |
Defines which types to work with to become valid More... | |
Protected Attributes | |
std::string | sDataRef |
dataRef name, passed in via constructor More... | |
XPLMDataRef | dataRef = NULL |
dataRef identifier returned by X-Plane More... | |
XPLMDataTypeID | dataTypes = xplmType_Unknown |
supported data types More... | |
bool | bValid = true |
does this object have a valid binding to a dataRef already? More... | |
Represents a dataRef and covers late binding.
Late binding is important: We read another plugin's dataRefs. The other plugin (here: LiveTraffic) needs to register the dataRefs first before we can find them. So we would potentially fail if we search for them during startup (like when declaring statically). With this wrapper we still can do static declaration because the actual call to XPLMFindDataRef happens only the first time we actually access it.
LTDataRef::LTDataRef | ( | std::string | _sDataRef | ) |
Constructor, set the dataRef's name.
bool LTDataRef::FindDataRef | ( | ) |
Finds the dataRef (and would try again and again, no matter what bValid says)
|
inline |
Gets dataRef's integer value and returns if it is not zero.
int LTDataRef::getData | ( | void * | pOut, |
int | inOffset, | ||
int | inMaxBytes | ||
) |
Gets dataRef's binary data.
|
inline |
Get types supported by the dataRef.
float LTDataRef::getFloat | ( | ) |
Get dataRef's float value. Silently returns 0.0f if dataRef doesn't exist.
int LTDataRef::getInt | ( | ) |
Get dataRef's integer value. Silently returns 0 if dataRef doesn't exist.
|
inline |
Is float
a supported dataRef type?
|
inline |
Is int
a supported dataRef type?
bool LTDataRef::isValid | ( | ) |
Found the dataRef and it contains formats we can work with?
|
inline |
void LTDataRef::set | ( | float | f | ) |
Writes a float vlue to the dataRef.
void LTDataRef::set | ( | int | i | ) |
Writes an integer value to the dataRef.
|
protected |
does this object have a valid binding to a dataRef already?
|
protected |
dataRef identifier returned by X-Plane
|
protected |
supported data types
|
protected |
dataRef name, passed in via constructor
|
staticconstexpr |
Defines which types to work with to become valid