15#include "pandaVersion.h"
30 _systems(get_class_type())
32 _system_names_dirty =
false;
36 _package_version_string = PANDA_PACKAGE_VERSION_STR;
37 _package_host_url = PANDA_PACKAGE_HOST_URL;
40 add_system(
"stdfloat-double");
46 set_system_tag(
"eigen",
"vectorize",
"1");
48 set_system_tag(
"eigen",
"vectorize",
"0");
51 set_system_tag(
"eigen",
"avx",
"1");
53 set_system_tag(
"eigen",
"avx",
"0");
57#ifdef USE_MEMORY_DLMALLOC
58 set_system_tag(
"system",
"malloc",
"dlmalloc");
59#elif defined(USE_MEMORY_PTMALLOC2)
60 set_system_tag(
"system",
"malloc",
"ptmalloc2");
61#elif defined(USE_MEMORY_MIMALLOC)
62 set_system_tag(
"system",
"malloc",
"mimalloc");
64 set_system_tag(
"system",
"malloc",
"malloc");
68 set_system_tag(
"system",
"stdlib",
"libc++");
69#elif defined(__GLIBCXX__)
70 set_system_tag(
"system",
"stdlib",
"libstdc++");
88 return PANDA_VERSION_STR;
112 return PANDA_PACKAGE_VERSION_STR;
133 return PANDA_PACKAGE_HOST_URL;
152#ifndef P3D_COREAPI_VERSION_STR
155 return P3D_COREAPI_VERSION_STR;
166 return PANDA_MAJOR_VERSION;
176 return PANDA_MINOR_VERSION;
186 return PANDA_SEQUENCE_VERSION;
200#ifdef PANDA_OFFICIAL_VERSION
212 return MEMORY_HOOK_ALIGNMENT;
222 return PANDA_DISTRIBUTOR;
233 std::ostringstream strm;
234 strm <<
"MSC v." << _MSC_VER;
240 strm <<
" 64 bit (Intel)";
242 strm <<
" 32 bit (Intel)";
244#elif defined(_M_IA64)
245 strm <<
" 64 bit (Itanium)";
246#elif defined(_M_AMD64)
247 strm <<
" 64 bit (AMD64)";
252#elif defined(__clang__)
255 return "Clang " __clang_version__;
257#elif defined(__GNUC__)
259 return "GCC " __VERSION__;
273#ifdef PANDA_BUILD_DATE_STR
274 return PANDA_BUILD_DATE_STR;
276 return __DATE__
" " __TIME__;
286#ifdef PANDA_GIT_COMMIT_STR
287 return PANDA_GIT_COMMIT_STR;
300 return DTOOL_PLATFORM;
310 Systems::const_iterator si;
311 si = _systems.find(system);
312 return (si != _systems.end());
322 return _systems.size();
331 if (n >= _systems.size()) {
335 if (_system_names_dirty) {
339 return _system_names[n];
353 Systems::const_iterator si;
354 si = _systems.find(system);
355 if (si != _systems.end()) {
357 SystemTags::const_iterator ti;
359 if (ti != tags.end()) {
372 bool inserted = _systems.insert(Systems::value_type(system,
SystemTags(get_class_type()))).second;
374 _system_names_dirty =
true;
384 const string &value) {
385 std::pair<Systems::iterator, bool> result;
386 result = _systems.insert(Systems::value_type(system,
SystemTags(get_class_type())));
388 _system_names_dirty =
true;
416output(std::ostream &out)
const {
424write(std::ostream &out)
const {
430 out <<
"Optional systems:\n";
431 for (Systems::const_iterator si = _systems.begin();
432 si != _systems.end();
434 out <<
" " << (*si).first <<
"\n";
435 const SystemTags &tags = (*si).second;
436 SystemTags::const_iterator ti;
437 for (ti = tags.begin(); ti != tags.end(); ++ti) {
438 out <<
" " << (*ti).first <<
" " << (*ti).second <<
"\n";
449 if (_global_ptr ==
nullptr) {
462reset_system_names() {
463 _system_names.clear();
464 _system_names.reserve(_systems.size());
466 Systems::const_iterator si;
467 for (si = _systems.begin(); si != _systems.end(); ++si) {
468 _system_names.push_back((*si).first);
471 _system_names_dirty =
false;
482set_package_version_string(
const string &package_version_string) {
483 _package_version_string = PANDA_PACKAGE_VERSION_STR;
484 if (_package_version_string.empty()) {
485 _package_version_string = package_version_string;
497set_package_host_url(
const string &package_host_url) {
498 _package_host_url = PANDA_PACKAGE_HOST_URL;
499 if (_package_host_url.empty()) {
500 _package_host_url = package_host_url;
bool heap_trim(size_t pad)
Attempts to release memory back to the system, if possible.
This class is used as a namespace to group several global properties of Panda.
get_num_systems
Returns the number of Panda subsystems that have registered themselves.
get_sequence_version
Returns the sequence version number of the current version of Panda.
get_build_date
Returns a string representing the date and time at which this version of Panda (or at least dtool) wa...
is_official_version
Returns true if current version of Panda claims to be an "official" version, that is,...
get_system
Returns the nth Panda subsystem that has registered itself.
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.
get_major_version
Returns the major version number of the current version of Panda.
get_platform
Returns a string representing the runtime platform that we are currently running on.
get_memory_alignment
Returns the memory alignment that Panda's allocators are using.
get_version_string
Returns the current version of Panda, expressed as a string, e.g.
get_git_commit
Returns a string representing the git commit hash that this source tree is based on,...
static std::string get_package_host_url()
Returns the URL of the download server that provides the Panda3D distributable package currently runn...
get_minor_version
Returns the minor version number of the current version of Panda.
get_distributor
Returns the string defined by the distributor of this version of Panda, or "homebuilt" if this versio...
get_compiler
Returns a string representing the compiler that was used to generate this version of Panda,...
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
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.
void add_system(const std::string &system)
Intended for use by each subsystem to register itself at startup.
bool has_system(const std::string &system) const
Returns true if the current version of Panda claims to have the indicated subsystem installed,...
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.
static std::string get_package_version_string()
Returns the version of the Panda3D distributable package that provides this build of Panda.
bool heap_trim(size_t pad)
Attempts to release memory back to the system, if possible.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.