15 #include "pandaSystem.h"
16 #include "pandaVersion.h"
17 #include "dtool_platform.h"
32 _systems(get_class_type())
34 _system_names_dirty =
false;
38 _package_version_string = PANDA_PACKAGE_VERSION_STR;
39 _package_host_url = PANDA_PACKAGE_HOST_URL;
41 #ifdef STDFLOAT_DOUBLE
42 add_system(
"stdfloat-double");
48 set_system_tag(
"eigen",
"vectorize",
"1");
50 set_system_tag(
"eigen",
"vectorize",
"0");
54 #ifdef USE_MEMORY_DLMALLOC
55 set_system_tag(
"system",
"malloc",
"dlmalloc");
56 #elif defined(USE_MEMORY_PTMALLOC2)
57 set_system_tag(
"system",
"malloc",
"ptmalloc2");
59 set_system_tag(
"system",
"malloc",
"malloc");
82 return PANDA_VERSION_STR;
111 return PANDA_PACKAGE_VERSION_STR;
136 return PANDA_PACKAGE_HOST_URL;
160 #ifndef P3D_COREAPI_VERSION_STR
163 return P3D_COREAPI_VERSION_STR;
177 return PANDA_MAJOR_VERSION;
191 return PANDA_MINOR_VERSION;
205 return PANDA_SEQUENCE_VERSION;
223 #ifdef PANDA_OFFICIAL_VERSION
240 return PANDA_DISTRIBUTOR;
252 #if defined(_MSC_VER)
255 strm <<
"MSC v." << _MSC_VER;
261 strm <<
" 64 bit (Intel)";
263 strm <<
" 32 bit (Intel)";
265 #elif defined(_M_IA64)
266 strm <<
" 64 bit (Itanium)";
267 #elif defined(_M_AMD64)
268 strm <<
" 64 bit (AMD64)";
273 #elif defined(__clang__)
276 return "Clang " __clang_version__;
278 #elif defined(__GNUC__)
280 return "GCC " __VERSION__;
297 return __DATE__
" " __TIME__;
309 #ifdef PANDA_GIT_COMMIT_STR
310 return PANDA_GIT_COMMIT_STR;
326 return DTOOL_PLATFORM;
339 Systems::const_iterator si;
340 si = _systems.find(system);
341 return (si != _systems.end());
354 return _systems.size();
366 if (n < 0 || n >= (
int)_systems.size()) {
370 if (_system_names_dirty) {
374 return _system_names[n];
392 Systems::const_iterator si;
393 si = _systems.find(system);
394 if (si != _systems.end()) {
396 SystemTags::const_iterator ti;
398 if (ti != tags.end()) {
414 bool inserted = _systems.insert(Systems::value_type(system,
SystemTags(get_class_type()))).second;
416 _system_names_dirty =
true;
428 const string &value) {
429 pair<Systems::iterator, bool> result;
430 result = _systems.insert(Systems::value_type(system,
SystemTags(get_class_type())));
432 _system_names_dirty =
true;
467 output(ostream &out)
const {
477 write(ostream &out)
const {
483 out <<
"Optional systems:\n";
484 for (Systems::const_iterator si = _systems.begin();
485 si != _systems.end();
487 out <<
" " << (*si).first <<
"\n";
488 const SystemTags &tags = (*si).second;
489 SystemTags::const_iterator ti;
490 for (ti = tags.begin(); ti != tags.end(); ++ti) {
491 out <<
" " << (*ti).first <<
" " << (*ti).second <<
"\n";
519 reset_system_names() {
520 _system_names.clear();
521 _system_names.reserve(_systems.size());
523 Systems::const_iterator si;
524 for (si = _systems.begin(); si != _systems.end(); ++si) {
525 _system_names.push_back((*si).first);
528 _system_names_dirty =
false;
544 set_package_version_string(
const string &package_version_string) {
545 _package_version_string = PANDA_PACKAGE_VERSION_STR;
546 if (_package_version_string.empty()) {
547 _package_version_string = package_version_string;
564 set_package_host_url(
const string &package_host_url) {
565 _package_host_url = PANDA_PACKAGE_HOST_URL;
566 if (_package_host_url.empty()) {
567 _package_host_url = package_host_url;
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
This class is used as a namespace to group several global properties of Panda.
static string 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.
static string get_version_string()
Returns the current version of Panda, expressed as a string, e.g.
static int get_major_version()
Returns the major version number of the current version of Panda.
static string get_p3d_coreapi_version_string()
Returns the current version of Panda's Core API, expressed as a string of dot-delimited integers...
static string get_package_version_string()
Returns the version of the Panda3D distributable package that provides this build of Panda...
bool has_system(const string &system) const
Returns true if the current version of Panda claims to have the indicated subsystem installed...
string get_system_tag(const string &system, const string &tag) const
Returns the value associated with the indicated tag for the given system.
void add_system(const string &system)
Intended for use by each subsystem to register itself at startup.
static string get_compiler()
Returns a string representing the compiler that was used to generate this version of Panda...
int get_num_systems() const
Returns the number of Panda subsystems that have registered themselves.
bool heap_trim(size_t pad)
Attempts to release memory back to the system, if possible.
static string get_build_date()
Returns a string representing the date and time at which this version of Panda (or at least dtool) wa...
string get_system(int n) const
Returns the nth Panda subsystem that has registered itself.
static int get_minor_version()
Returns the minor version number of the current version of Panda.
static string get_distributor()
Returns the string defined by the distributor of this version of Panda, or "homebuilt" if this versio...
TypeHandle is the identifier used to differentiate C++ class types.
static bool is_official_version()
Returns true if current version of Panda claims to be an "official" version, that is...
static string get_platform()
Returns a string representing the runtime platform that we are currently running on.
bool heap_trim(size_t pad)
Attempts to release memory back to the system, if possible.
static int get_sequence_version()
Returns the sequence version number of the current version of Panda.
void set_system_tag(const string &system, const string &tag, const string &value)
Intended for use by each subsystem to register its set of capabilities at startup.
static string get_package_host_url()
Returns the URL of the download server that provides the Panda3D distributable package currently runn...