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;
39 #ifdef STDFLOAT_DOUBLE
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");
62 set_system_tag(
"system",
"malloc",
"malloc");
65 #ifdef _LIBCPP_VERSION
66 set_system_tag(
"system",
"stdlib",
"libc++");
67 #elif defined(__GLIBCXX__)
68 set_system_tag(
"system",
"stdlib",
"libstdc++");
86 return PANDA_VERSION_STR;
110 return PANDA_PACKAGE_VERSION_STR;
131 return PANDA_PACKAGE_HOST_URL;
150 #ifndef P3D_COREAPI_VERSION_STR
153 return P3D_COREAPI_VERSION_STR;
164 return PANDA_MAJOR_VERSION;
174 return PANDA_MINOR_VERSION;
184 return PANDA_SEQUENCE_VERSION;
198 #ifdef PANDA_OFFICIAL_VERSION
210 return MEMORY_HOOK_ALIGNMENT;
220 return PANDA_DISTRIBUTOR;
229 #if defined(_MSC_VER)
231 std::ostringstream strm;
232 strm <<
"MSC v." << _MSC_VER;
238 strm <<
" 64 bit (Intel)";
240 strm <<
" 32 bit (Intel)";
242 #elif defined(_M_IA64)
243 strm <<
" 64 bit (Itanium)";
244 #elif defined(_M_AMD64)
245 strm <<
" 64 bit (AMD64)";
250 #elif defined(__clang__)
253 return "Clang " __clang_version__;
255 #elif defined(__GNUC__)
257 return "GCC " __VERSION__;
271 #ifdef PANDA_BUILD_DATE_STR
272 return PANDA_BUILD_DATE_STR;
274 return __DATE__
" " __TIME__;
284 #ifdef PANDA_GIT_COMMIT_STR
285 return PANDA_GIT_COMMIT_STR;
298 return DTOOL_PLATFORM;
308 Systems::const_iterator si;
309 si = _systems.find(system);
310 return (si != _systems.end());
320 return _systems.size();
329 if (n >= _systems.size()) {
333 if (_system_names_dirty) {
337 return _system_names[n];
351 Systems::const_iterator si;
352 si = _systems.find(system);
353 if (si != _systems.end()) {
355 SystemTags::const_iterator ti;
357 if (ti != tags.end()) {
370 bool inserted = _systems.insert(Systems::value_type(system,
SystemTags(get_class_type()))).second;
372 _system_names_dirty =
true;
382 const string &value) {
383 std::pair<Systems::iterator, bool> result;
384 result = _systems.insert(Systems::value_type(system,
SystemTags(get_class_type())));
386 _system_names_dirty =
true;
414 output(std::ostream &out)
const {
422 write(std::ostream &out)
const {
428 out <<
"Optional systems:\n";
429 for (Systems::const_iterator si = _systems.begin();
430 si != _systems.end();
432 out <<
" " << (*si).first <<
"\n";
433 const SystemTags &tags = (*si).second;
434 SystemTags::const_iterator ti;
435 for (ti = tags.begin(); ti != tags.end(); ++ti) {
436 out <<
" " << (*ti).first <<
" " << (*ti).second <<
"\n";
447 if (_global_ptr ==
nullptr) {
460 reset_system_names() {
461 _system_names.clear();
462 _system_names.reserve(_systems.size());
464 Systems::const_iterator si;
465 for (si = _systems.begin(); si != _systems.end(); ++si) {
466 _system_names.push_back((*si).first);
469 _system_names_dirty =
false;
480 set_package_version_string(
const string &package_version_string) {
481 _package_version_string = PANDA_PACKAGE_VERSION_STR;
482 if (_package_version_string.empty()) {
483 _package_version_string = package_version_string;
495 set_package_host_url(
const string &package_host_url) {
496 _package_host_url = PANDA_PACKAGE_HOST_URL;
497 if (_package_host_url.empty()) {
498 _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.