Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | Friends | List of all members
PandaSystem Class Reference

This class is used as a namespace to group several global properties of Panda. More...

#include "pandaSystem.h"

Public Member Functions

void add_system (const std::string &system)
 Intended for use by each subsystem to register itself at startup. More...
 
size_t get_num_systems () const
 
std::string get_system (size_t n) const
 
std::string get_system_tag (const std::string &system, const std::string &tag) const
 Returns the value associated with the indicated tag for the given system. More...
 
bool has_system (const std::string &system) const
 Returns true if the current version of Panda claims to have the indicated subsystem installed, false otherwise. More...
 
bool heap_trim (size_t pad)
 Attempts to release memory back to the system, if possible. More...
 
void output (std::ostream &out) const
 
void set_system_tag (const std::string &system, const std::string &tag, const std::string &value)
 Intended for use by each subsystem to register its set of capabilities at startup. More...
 
void write (std::ostream &out) const
 

Static Public Member Functions

static std::string get_build_date ()
 
static TypeHandle get_class_type ()
 
static std::string get_compiler ()
 
static std::string get_distributor ()
 
static std::string get_git_commit ()
 
static PandaSystemget_global_ptr ()
 Returns the global PandaSystem object. More...
 
static int get_major_version ()
 
static int get_memory_alignment ()
 
static int get_minor_version ()
 
static std::string get_p3d_coreapi_version_string ()
 Returns the current version of Panda's Core API, expressed as a string of dot-delimited integers. More...
 
static std::string get_package_host_url ()
 Returns the URL of the download server that provides the Panda3D distributable package currently running. More...
 
static std::string get_package_version_string ()
 Returns the version of the Panda3D distributable package that provides this build of Panda. More...
 
static std::string get_platform ()
 
static int get_sequence_version ()
 
static std::string get_version_string ()
 
static void init_type ()
 
static bool is_official_version ()
 

Public Attributes

 get_build_date
 Returns a string representing the date and time at which this version of Panda (or at least dtool) was compiled, if available. More...
 
 get_compiler
 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. More...
 
 get_distributor
 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. More...
 
 get_git_commit
 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. More...
 
 get_major_version
 Returns the major version number of the current version of Panda. More...
 
 get_memory_alignment
 Returns the memory alignment that Panda's allocators are using. More...
 
 get_minor_version
 Returns the minor version number of the current version of Panda. More...
 
 get_num_systems
 Returns the number of Panda subsystems that have registered themselves. More...
 
 get_platform
 Returns a string representing the runtime platform that we are currently running on. More...
 
 get_sequence_version
 Returns the sequence version number of the current version of Panda. More...
 
 get_system
 Returns the nth Panda subsystem that has registered itself. More...
 
 get_version_string
 Returns the current version of Panda, expressed as a string, e.g. More...
 
 is_official_version
 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. More...
 

Friends

class ConfigPageManager
 

Detailed Description

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.

Definition at line 26 of file pandaSystem.h.

Member Function Documentation

◆ add_system()

void PandaSystem::add_system ( const std::string &  system)

◆ get_global_ptr()

PandaSystem * PandaSystem::get_global_ptr ( )
static

◆ get_p3d_coreapi_version_string()

string PandaSystem::get_p3d_coreapi_version_string ( )
static

Returns the current version of Panda's Core API, expressed as a string of dot-delimited integers.

There are usually four integers in this version, but this is not guaranteed.

The Core API is used during the runtime (plugin) environment only. This may be the empty string if the current version of Panda is not built to provide a particular Core API, which will be the normal case in a development SDK. However, you should not use this method to determine whether you are running in a runtime environment or not.

Definition at line 143 of file pandaSystem.cxx.

◆ get_package_host_url()

string PandaSystem::get_package_host_url ( )
static

Returns the URL of the download server that provides the Panda3D distributable package currently running.

This can be used, along with the get_package_version_string(), to uniquely identify the running version of Panda among distributable Panda versions.

See get_package_version_string() for more information.

This string is set explicitly at compilation time. Normally, it should be set to a nonempty string only when building a Panda3D package for distribution.

Definition at line 123 of file pandaSystem.cxx.

References get_global_ptr().

◆ get_package_version_string()

string PandaSystem::get_package_version_string ( )
static

Returns the version of the Panda3D distributable package that provides this build of Panda.

When the currently-executing version of Panda was loaded from a distributable package, such as via the browser plugin, then this string will be nonempty and will contain the corresponding version string. You can build applications that use this particular version of Panda by requesting it in the pdef file, using "panda3d", this version string, and the download host provided by get_package_host_url().

If this string is empty, then the currently-executing Panda was built independently, and is not part of a distributable package.

This string is set explicitly at compilation time. Normally, it should be set to a nonempty string only when building a Panda3D package for distribution.

Definition at line 102 of file pandaSystem.cxx.

References get_global_ptr().

◆ get_system_tag()

string PandaSystem::get_system_tag ( const std::string &  system,
const std::string &  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.

Definition at line 340 of file pandaSystem.cxx.

◆ has_system()

bool PandaSystem::has_system ( const std::string &  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.

Definition at line 297 of file pandaSystem.cxx.

◆ heap_trim()

bool PandaSystem::heap_trim ( 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.

Definition at line 393 of file pandaSystem.cxx.

◆ set_system_tag()

void PandaSystem::set_system_tag ( const std::string &  system,
const std::string &  tag,
const std::string &  value 
)

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

Definition at line 371 of file pandaSystem.cxx.

Referenced by init_libandroiddisplay(), init_libegldisplay(), init_libFmodAudio(), init_libglxdisplay(), init_libOpenALAudio(), init_libosxdisplay(), and init_libwgldisplay().

Member Data Documentation

◆ get_build_date

string PandaSystem::get_build_date

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

Definition at line 61 of file pandaSystem.h.

◆ get_compiler

string PandaSystem::get_compiler

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.

Definition at line 60 of file pandaSystem.h.

◆ get_distributor

string PandaSystem::get_distributor

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.

Definition at line 59 of file pandaSystem.h.

◆ get_git_commit

string PandaSystem::get_git_commit

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.

Definition at line 62 of file pandaSystem.h.

◆ get_major_version

int PandaSystem::get_major_version

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.

Definition at line 52 of file pandaSystem.h.

◆ get_memory_alignment

int PandaSystem::get_memory_alignment

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

Definition at line 57 of file pandaSystem.h.

◆ get_minor_version

int PandaSystem::get_minor_version

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.

Definition at line 53 of file pandaSystem.h.

◆ get_num_systems

size_t PandaSystem::get_num_systems

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.

Definition at line 69 of file pandaSystem.h.

◆ get_platform

string PandaSystem::get_platform

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".

Definition at line 64 of file pandaSystem.h.

◆ get_sequence_version

int PandaSystem::get_sequence_version

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.

Definition at line 54 of file pandaSystem.h.

◆ get_system

string PandaSystem::get_system

Returns the nth Panda subsystem that has registered itself.

This list will be sorted in alphabetical order.

Definition at line 69 of file pandaSystem.h.

◆ get_version_string

string PandaSystem::get_version_string

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.

Definition at line 51 of file pandaSystem.h.

◆ is_official_version

bool PandaSystem::is_official_version

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.

Definition at line 55 of file pandaSystem.h.


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