PandaSystem

class PandaSystem

This class is used as a namespace to group several global properties of Panda. Application developers can use this class to query the runtime version or capabilities of the current Panda environment.

Inheritance diagram

Inheritance diagram of PandaSystem

void add_system(std::string const &system)

Intended for use by each subsystem to register itself at startup.

static std::string get_build_date(void)

Returns a string representing the date and time at which this version of Panda (or at least dtool) was compiled, if available.

Deprecated

static TypeHandle get_class_type(void)
static std::string get_compiler(void)

Returns a string representing the compiler that was used to generate this version of Panda, if it is available, or “unknown” if it is not.

static std::string get_distributor(void)

Returns the string defined by the distributor of this version of Panda, or “homebuilt” if this version was built directly from the sources by the end- user. This is a completely arbitrary string.

static std::string get_git_commit(void)

Returns a string representing the git commit hash that this source tree is based on, or the empty string if it has not been specified at build time.

static PandaSystem *get_global_ptr(void)

Returns the global PandaSystem object.

static int get_major_version(void)

Returns the major version number of the current version of Panda. This is the first number of the dotted triple returned by get_version_string(). It changes very rarely.

static int get_memory_alignment(void)

Returns the memory alignment that Panda’s allocators are using.

static int get_minor_version(void)

Returns the minor version number of the current version of Panda. This is the second number of the dotted triple returned by get_version_string(). It changes with each release that introduces new features.

std::size_t get_num_systems(void) const

Returns the number of Panda subsystems that have registered themselves. This can be used with get_system() to iterate through the entire list of available Panda subsystems.

static std::string get_platform(void)

Returns a string representing the runtime platform that we are currently running on. This will be something like “win32” or “osx_i386” or “linux_amd64”.

static int get_sequence_version(void)

Returns the sequence version number of the current version of Panda. This is the third number of the dotted triple returned by get_version_string(). It changes with bugfix updates and very minor feature updates.

std::string get_system(std::size_t n) const

Returns the nth Panda subsystem that has registered itself. This list will be sorted in alphabetical order.

std::string get_system_tag(std::string const &system, std::string const &tag) const

Returns the value associated with the indicated tag for the given system. This provides a standard way to query each subsystem’s advertised capabilities. The set of tags and values are per-system and implementation-defined.

The return value is the empty string if the indicated system is undefined or if does not define the indicated tag.

static std::string get_version_string(void)

Returns the current version of Panda, expressed as a string, e.g. “1.0.0”. The string will end in the letter “c” if this build does not represent an official version.

bool has_system(std::string const &system) const

Returns true if the current version of Panda claims to have the indicated subsystem installed, false otherwise. The set of available subsystems is implementation defined.

bool heap_trim(std::size_t pad)

Attempts to release memory back to the system, if possible. The pad argument is the minimum amount of unused memory to keep in the heap (against future allocations). Any memory above that may be released to the system, reducing the memory size of this process. There is no guarantee that any memory may be released.

Returns true if any memory was actually released, false otherwise.

static bool is_official_version(void)

Returns true if current version of Panda claims to be an “official” version, that is, one that was compiled by an official distributor of Panda using a specific version of the panda source tree. If this is true, there will not be a “c” at the end of the version string returned by get_version_string().

Note that we must take the distributor’s word for it here.

void output(std::ostream &out) const
void set_system_tag(std::string const &system, std::string const &tag, std::string const &value)

Intended for use by each subsystem to register its set of capabilities at startup.

void write(std::ostream &out) const