XPMP2
X-Plane multiplayer library 2 - using instancing
|
Represents a CSL model as it is saved on disk. More...
#include <CSLModels.h>
Classes | |
struct | MatchCritTy |
Combines match-relevant fields (beside ICAO a/c type) More... | |
Public Types | |
typedef std::vector< MatchCritTy > | MatchCritVecTy |
Vector of match-relevant fields. More... | |
Public Member Functions | |
CSLModel () | |
Constructor. More... | |
CSLModel (CSLModel &&o)=default | |
Generate standard move constructor. More... | |
CSLModel & | operator= (CSLModel &&o)=default |
virtual | ~CSLModel () |
Destructor frees resources. More... | |
void | AddMatchCriteria (const std::string &_type, const MatchCritTy &_matchCrit, int lnNr) |
Set the a/c type model and add other match criteria. More... | |
void | CompModelName () |
Puts together the model name string from a path component and shortId More... | |
bool | IsValid () const |
Minimum requirement for using this object is: id, type, path. More... | |
const std::string & | GetShortId () const |
short id, just an arbitrary label read from xsb_aircraft.txt::OBJ8_AIRCRAFT More... | |
const std::string & | GetId () const |
full id: package name / shortId, expected to be unique More... | |
const std::string & | GetModelName () const |
name, formed by last part of path plus id (human readable, but not guaranteed to be unique) More... | |
const std::string & | GetIcaoType () const |
ICAO aircraft type this model represents: xsb_aircraft.txt::ICAO More... | |
const std::string & | GetIcaoAirline () const |
ICAO Airline code this model represents: xsb_aircraft.txt::AIRLINE More... | |
const std::string & | GetLivery () const |
Livery code this model represents: xsb_aircraft.txt::LIVERY More... | |
int | GetRelatedGrp () const |
"related" group for this model (a group of alike plane models), or 0 More... | |
std::string | GetKeyString () const |
compiles the string used as key in the CSL model map More... | |
const Doc8643 & | GetDoc8643 () const |
Classification (like "L2P" or "L4J") and WTC (like "H" or "L/M") More... | |
const char * | GetWTC () const |
Wake turbulence category. More... | |
char | GetClassType () const |
char | GetClassNumEng () const |
int | GetNumEngines () const |
char | GetClassEngType () const |
bool | HasRotor () const |
float | GetVertOfs () const |
Vertical Offset to be applied to aircraft model. More... | |
ObjLoadStateTy | GetObjState () const |
(Minimum) )State of the X-Plane objects: Is it being loaded or available? More... | |
bool | IsObjInvalid () const |
(Minimum) )State of the X-Plane object: Is it invalid? More... | |
std::list< XPLMObjectRef > | GetAllObjRefs () |
Try get ALL object handles, only returns anything if it is the complete list. More... | |
void | IncRefCnt () |
Increase the reference counter for Aircraft usage. More... | |
void | DecRefCnt () |
Decrease the reference counter for Aircraft usage. More... | |
unsigned | GetRefCnt () const |
Current reference counter. More... | |
Static Public Member Functions | |
static float | GarbageCollection (float inElapsedSinceLastCall, float inElapsedTimeSinceLastFlightLoop, int inCounter, void *inRefcon) |
Unload all objects which haven't been used for a while. More... | |
Public Attributes | |
std::string | shortId |
short id, just an arbitrary label read from xsb_aircraft.txt::OBJ8_AIRCRAFT More... | |
std::string | cslId |
full id: package name / shortId, expected to be unique More... | |
std::string | modelName |
name, formed by last part of path plus id More... | |
std::uint16_t | pkgHash = 0 |
simple hash of package name, for easy matching in networked setup More... | |
MatchCritVecTy | vecMatchCrit |
further match-relevant fields like airline and livery can be a list More... | |
listCSLObjTy | listObj |
list of objects representing this model More... | |
float | vertOfs = 3.0f |
Vertical offset to be applied [m]. More... | |
bool | bVertOfsReadFromFile = true |
Shall we try reading vertOfs from the OBJ8 file if we need this a/c? More... | |
std::string | xsbAircraftPath |
Path to the xsb_aircraft.txt file from where this model is loaded. More... | |
int | xsbAircraftLn = 0 |
Line number in the xsb_aircraft.txt file where the model definition starts. More... | |
Protected Member Functions | |
void | Unload () |
Unload all objects. More... | |
float | FetchVertOfsFromObjFile () const |
Read the obj files to fill CSLModel::vertOfs. More... | |
Protected Attributes | |
std::string | icaoType |
ICAO aircraft type this model represents: xsb_aircraft.txt::ICAO More... | |
const Doc8643 * | doc8643 = nullptr |
Proper Doc8643 entry for this model. More... | |
int | related = 0 |
"related" group for this model (a group of alike plane models), or 0 More... | |
unsigned | refCnt = 0 |
Reference counter: Number of Aircraft actively using this model. More... | |
float | refZeroTs = 0.0f |
Time point when refCnt reached 0 (used in garbage collection, in terms of XP's total running time) More... | |
std::future< float > | futVertOfs |
future for asynchronously reading vertOfs More... | |
Represents a CSL model as it is saved on disk.
typedef std::vector<MatchCritTy> XPMP2::CSLModel::MatchCritVecTy |
Vector of match-relevant fields.
|
inline |
Constructor.
|
default |
Generate standard move constructor.
|
virtual |
Destructor frees resources.
void XPMP2::CSLModel::AddMatchCriteria | ( | const std::string & | _type, |
const MatchCritTy & | _matchCrit, | ||
int | lnNr | ||
) |
Set the a/c type model and add other match criteria.
Also fills doc8643
and related
. Keeps most significant match criteria only (if "DLH/-" and "DLH/D-ABCD" are defined, then only "DLH/D-ABCD" is kept as that covers the "DLH/-" case, too)
void XPMP2::CSLModel::CompModelName | ( | ) |
Puts together the model name string from a path component and shortId
void XPMP2::CSLModel::DecRefCnt | ( | ) |
Decrease the reference counter for Aircraft usage.
|
protected |
Read the obj files to fill CSLModel::vertOfs.
|
static |
Unload all objects which haven't been used for a while.
std::list< XPLMObjectRef > XPMP2::CSLModel::GetAllObjRefs | ( | ) |
Try get ALL object handles, only returns anything if it is the complete list.
This starts async loading of all objects.
|
inline |
|
inline |
|
inline |
|
inline |
Classification (like "L2P" or "L4J") and WTC (like "H" or "L/M")
|
inline |
ICAO Airline code this model represents: xsb_aircraft.txt::AIRLINE
|
inline |
ICAO aircraft type this model represents: xsb_aircraft.txt::ICAO
|
inline |
full id: package name / shortId, expected to be unique
std::string XPMP2::CSLModel::GetKeyString | ( | ) | const |
compiles the string used as key in the CSL model map
|
inline |
Livery code this model represents: xsb_aircraft.txt::LIVERY
|
inline |
name, formed by last part of path plus id (human readable, but not guaranteed to be unique)
|
inline |
ObjLoadStateTy XPMP2::CSLModel::GetObjState | ( | ) | const |
(Minimum) )State of the X-Plane objects: Is it being loaded or available?
|
inline |
Current reference counter.
|
inline |
"related" group for this model (a group of alike plane models), or 0
|
inline |
short id, just an arbitrary label read from xsb_aircraft.txt::OBJ8_AIRCRAFT
|
inline |
Vertical Offset to be applied to aircraft model.
|
inline |
Wake turbulence category.
|
inline |
|
inline |
Increase the reference counter for Aircraft usage.
|
inline |
(Minimum) )State of the X-Plane object: Is it invalid?
|
inline |
Minimum requirement for using this object is: id, type, path.
|
protected |
Unload all objects.
bool XPMP2::CSLModel::bVertOfsReadFromFile = true |
Shall we try reading vertOfs from the OBJ8 file if we need this a/c?
std::string XPMP2::CSLModel::cslId |
full id: package name / shortId, expected to be unique
|
protected |
future for asynchronously reading vertOfs
|
protected |
ICAO aircraft type this model represents: xsb_aircraft.txt::ICAO
listCSLObjTy XPMP2::CSLModel::listObj |
list of objects representing this model
std::string XPMP2::CSLModel::modelName |
name, formed by last part of path plus id
std::uint16_t XPMP2::CSLModel::pkgHash = 0 |
simple hash of package name, for easy matching in networked setup
|
protected |
Reference counter: Number of Aircraft actively using this model.
|
protected |
Time point when refCnt reached 0 (used in garbage collection, in terms of XP's total running time)
|
protected |
"related" group for this model (a group of alike plane models), or 0
std::string XPMP2::CSLModel::shortId |
short id, just an arbitrary label read from xsb_aircraft.txt::OBJ8_AIRCRAFT
MatchCritVecTy XPMP2::CSLModel::vecMatchCrit |
further match-relevant fields like airline and livery can be a list
float XPMP2::CSLModel::vertOfs = 3.0f |
Vertical offset to be applied [m].
int XPMP2::CSLModel::xsbAircraftLn = 0 |
Line number in the xsb_aircraft.txt file where the model definition starts.
std::string XPMP2::CSLModel::xsbAircraftPath |
Path to the xsb_aircraft.txt file from where this model is loaded.