FlightGear next
|
#include "config.h"
#include <simgear/compiler.h>
#include <simgear/structure/exception.hxx>
#include <simgear/props/props_io.hxx>
#include <simgear/misc/strutils.hxx>
#include <simgear/timing/sg_time.hxx>
#include <simgear/misc/sg_path.hxx>
#include <simgear/scene/model/particles.hxx>
#include <simgear/sound/soundmgr.hxx>
#include <GUI/gui.h>
#include "globals.hxx"
#include "fg_props.hxx"
Go to the source code of this file.
Functions | |
static const char * | getLoggingClasses () |
void | setLoggingClasses (const char *c) |
Set the logging classes. | |
static const char * | getLoggingPriority () |
Get the logging priority. | |
void | setLoggingPriority (const char *p) |
Set the logging priority. | |
static double | getElapsedTime_sec () |
Return the number of milliseconds elapsed since simulation started. | |
static const char * | getDateString () |
Return the current Zulu time. | |
static void | setDateString (const char *date_string) |
Set the current Zulu time. | |
static const char * | getGMTString () |
Return the GMT as a string. | |
static SGPropertyNode_ptr | initDoubleNode (const std::string &path, const double v) |
bool | fgSaveFlight (std::ostream &output, bool write_all) |
Save the current state of the simulator to a stream. | |
bool | fgLoadFlight (std::istream &input) |
Restore the current state of the simulator from a stream. | |
bool | fgLoadProps (const std::string &path, SGPropertyNode *props, bool in_fg_root, int default_mode) |
Load properties from a file. | |
SGPropertyNode * | fgGetNode (const char *path, bool create) |
Get a property node. | |
SGPropertyNode * | fgGetNode (const char *path, int index, bool create) |
Get a property node with separate index. | |
bool | fgHasNode (const char *path) |
Test whether a given node exists. | |
void | fgAddChangeListener (SGPropertyChangeListener *listener, const char *path) |
Add a listener to a node. | |
void | fgAddChangeListener (SGPropertyChangeListener *listener, const char *path, int index) |
Add a listener to a node. | |
bool | fgGetBool (const char *name, bool defaultValue) |
Get a bool value for a property. | |
int | fgGetInt (const char *name, int defaultValue) |
Get an int value for a property. | |
long | fgGetLong (const char *name, long defaultValue) |
Get a long value for a property. | |
float | fgGetFloat (const char *name, float defaultValue) |
Get a float value for a property. | |
double | fgGetDouble (const char *name, double defaultValue) |
Get a double value for a property. | |
std::string | fgGetString (const char *name, const char *defaultValue) |
Get a string value for a property. | |
bool | fgSetBool (const char *name, bool val) |
Set a bool value for a property. | |
bool | fgSetInt (const char *name, int val) |
Set an int value for a property. | |
bool | fgSetLong (const char *name, long val) |
Set a long value for a property. | |
bool | fgSetFloat (const char *name, float val) |
Set a float value for a property. | |
bool | fgSetDouble (const char *name, double val) |
Set a double value for a property. | |
bool | fgSetString (const char *name, const char *val) |
Set a string value for a property. | |
void | fgSetArchivable (const char *name, bool state) |
Set the state of the archive attribute for a property. | |
void | fgSetReadable (const char *name, bool state) |
Set the state of the read attribute for a property. | |
void | fgSetWritable (const char *name, bool state) |
Set the state of the write attribute for a property. | |
void | fgUntie (const char *name) |
Untie a property from an external data source. | |
void | fgUntieIfDefined (const std::string &name) |
@brfief variant of the above which doesn't warn if the property does not exist | |
Variables | |
SGSubsystemMgr::Registrant< FGProperties > | registrantFGProperties |
void fgAddChangeListener | ( | SGPropertyChangeListener * | listener, |
const char * | path ) |
Add a listener to a node.
listener | The listener to add to the node. |
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
Definition at line 513 of file fg_props.cxx.
void fgAddChangeListener | ( | SGPropertyChangeListener * | listener, |
const char * | path, | ||
int | index ) |
Add a listener to a node.
listener | The listener to add to the node. |
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
Definition at line 519 of file fg_props.cxx.
bool fgGetBool | ( | const char * | name, |
bool | defaultValue = false ) |
Get a bool value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getBoolValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 526 of file fg_props.cxx.
double fgGetDouble | ( | const char * | name, |
double | defaultValue = 0.0 ) |
Get a double value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getDoubleValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 550 of file fg_props.cxx.
float fgGetFloat | ( | const char * | name, |
float | defaultValue = 0.0 ) |
Get a float value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getFloatValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 544 of file fg_props.cxx.
int fgGetInt | ( | const char * | name, |
int | defaultValue = 0 ) |
Get an int value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getIntValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 532 of file fg_props.cxx.
long fgGetLong | ( | const char * | name, |
long | defaultValue = 0L ) |
Get a long value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getLongValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 538 of file fg_props.cxx.
SGPropertyNode * fgGetNode | ( | const char * | path, |
bool | create = false ) |
Get a property node.
path | The path of the node, relative to root. |
create | true to create the node if it doesn't exist. |
Definition at line 495 of file fg_props.cxx.
SGPropertyNode * fgGetNode | ( | const char * | path, |
int | index, | ||
bool | create = false ) |
Get a property node with separate index.
This method separates the index from the path string, to make it easier to iterate through multiple components without using sprintf to add indices. For example, fgGetNode("foo[1]/bar", 3) will return the same result as fgGetNode("foo[1]/bar[3]").
path | The path of the node, relative to root. |
index | The index for the last member of the path (overrides any given in the string). |
create | true to create the node if it doesn't exist. |
Definition at line 501 of file fg_props.cxx.
std::string fgGetString | ( | const char * | name, |
const char * | defaultValue = "" ) |
Get a string value for a property.
This method is convenient but inefficient. It should be used infrequently (i.e. for initializing, loading, saving, etc.), not in the main loop. If you need to get a value frequently, it is better to look up the node itself using fgGetNode and then use the node's getStringValue() method, to avoid the lookup overhead.
name | The property name. |
defaultValue | The default value to return if the property does not exist. |
Definition at line 556 of file fg_props.cxx.
bool fgHasNode | ( | const char * | path | ) |
Test whether a given node exists.
path | The path of the node, relative to root. |
Definition at line 507 of file fg_props.cxx.
bool fgLoadFlight | ( | std::istream & | input | ) |
Restore the current state of the simulator from a stream.
Load a flight from disk.
Definition at line 448 of file fg_props.cxx.
bool fgLoadProps | ( | const std::string & | path, |
SGPropertyNode * | props, | ||
bool | in_fg_root = true, | ||
int | default_mode = 0 ) |
Load properties from a file.
file | The relative or absolute filename. |
props | The property node to load the properties into. |
in_fg_root | If true, look for the file relative to $FG_ROOT; otherwise, look for the file relative to the current working directory. |
Definition at line 469 of file fg_props.cxx.
bool fgSaveFlight | ( | std::ostream & | output, |
bool | write_all ) |
Save the current state of the simulator to a stream.
Save a flight to disk.
Definition at line 424 of file fg_props.cxx.
void fgSetArchivable | ( | const char * | name, |
bool | state = true ) |
Set the state of the archive attribute for a property.
If the archive attribute is true, the property will be written when a flight is saved; if it is false, the property will be skipped.
A warning message will be printed if the property does not exist.
Definition at line 598 of file fg_props.cxx.
bool fgSetBool | ( | const char * | name, |
bool | val ) |
Set a bool value for a property.
Assign a bool value to a property. If the property does not yet exist, it will be created and its type will be set to BOOL; if it has a type of UNKNOWN, the type will also be set to BOOL; otherwise, the bool value will be converted to the property's type.
Definition at line 562 of file fg_props.cxx.
bool fgSetDouble | ( | const char * | name, |
double | val ) |
Set a double value for a property.
Assign a double value to a property. If the property does not yet exist, it will be created and its type will be set to DOUBLE; if it has a type of UNKNOWN, the type will also be set to DOUBLE; otherwise, the double value will be converted to the property's type.
Definition at line 586 of file fg_props.cxx.
bool fgSetFloat | ( | const char * | name, |
float | val ) |
Set a float value for a property.
Assign a float value to a property. If the property does not yet exist, it will be created and its type will be set to FLOAT; if it has a type of UNKNOWN, the type will also be set to FLOAT; otherwise, the bool value will be converted to the property's type.
Definition at line 580 of file fg_props.cxx.
bool fgSetInt | ( | const char * | name, |
int | val ) |
Set an int value for a property.
Assign an int value to a property. If the property does not yet exist, it will be created and its type will be set to INT; if it has a type of UNKNOWN, the type will also be set to INT; otherwise, the bool value will be converted to the property's type.
Definition at line 568 of file fg_props.cxx.
bool fgSetLong | ( | const char * | name, |
long | val ) |
Set a long value for a property.
Assign a long value to a property. If the property does not yet exist, it will be created and its type will be set to LONG; if it has a type of UNKNOWN, the type will also be set to LONG; otherwise, the bool value will be converted to the property's type.
Definition at line 574 of file fg_props.cxx.
void fgSetReadable | ( | const char * | name, |
bool | state = true ) |
Set the state of the read attribute for a property.
If the read attribute is true, the property value will be readable; if it is false, the property value will always be the default value for its type.
A warning message will be printed if the property does not exist.
Definition at line 610 of file fg_props.cxx.
bool fgSetString | ( | const char * | name, |
const char * | val ) |
Set a string value for a property.
Assign a string value to a property. If the property does not yet exist, it will be created and its type will be set to STRING; if it has a type of UNKNOWN, the type will also be set to STRING; otherwise, the string value will be converted to the property's type.
Definition at line 592 of file fg_props.cxx.
void fgSetWritable | ( | const char * | name, |
bool | state = true ) |
Set the state of the write attribute for a property.
If the write attribute is true, the property value may be modified (depending on how it is tied); if the write attribute is false, the property value may not be modified.
A warning message will be printed if the property does not exist.
Definition at line 622 of file fg_props.cxx.
void fgUntie | ( | const char * | name | ) |
Untie a property from an external data source.
Classes should use this function to release control of any properties they are managing.
Definition at line 634 of file fg_props.cxx.
void fgUntieIfDefined | ( | const std::string & | name | ) |
@brfief variant of the above which doesn't warn if the property does not exist
Definition at line 651 of file fg_props.cxx.
|
static |
Return the current Zulu time.
Definition at line 161 of file fg_props.cxx.
|
static |
Return the number of milliseconds elapsed since simulation started.
Definition at line 151 of file fg_props.cxx.
|
static |
Return the GMT as a string.
Definition at line 223 of file fg_props.cxx.
|
static |
Definition at line 55 of file fg_props.cxx.
|
static |
Get the logging priority.
Definition at line 74 of file fg_props.cxx.
|
static |
Definition at line 288 of file fg_props.cxx.
|
static |
Set the current Zulu time.
Definition at line 183 of file fg_props.cxx.
void setLoggingClasses | ( | const char * | c | ) |
Set the logging classes.
Definition at line 65 of file fg_props.cxx.
void setLoggingPriority | ( | const char * | p | ) |
Set the logging priority.
Definition at line 100 of file fg_props.cxx.
SGSubsystemMgr::Registrant<FGProperties> registrantFGProperties |
Definition at line 413 of file fg_props.cxx.