Panda3D
Loading...
Searching...
No Matches
pandaSystem.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file pandaSystem.h
10 * @author drose
11 * @date 2005-01-26
12 */
13
14#ifndef PANDASYSTEM_H
15#define PANDASYSTEM_H
16
17#include "dtoolbase.h"
18#include "pmap.h"
19#include "pvector.h"
20
21/**
22 * This class is used as a namespace to group several global properties of
23 * Panda. Application developers can use this class to query the runtime
24 * version or capabilities of the current Panda environment.
25 */
26class EXPCL_DTOOL_DTOOLUTIL PandaSystem {
27protected:
30
31PUBLISHED:
32 static std::string get_version_string();
33 static std::string get_package_version_string();
34 static std::string get_package_host_url();
35 static std::string get_p3d_coreapi_version_string();
36
37 static int get_major_version();
38 static int get_minor_version();
39 static int get_sequence_version();
40 static bool is_official_version();
41
42 static int get_memory_alignment();
43
44 static std::string get_distributor();
45 static std::string get_compiler();
46 static std::string get_build_date();
47 static std::string get_git_commit();
48
49 static std::string get_platform();
50
51 MAKE_PROPERTY(version_string, get_version_string);
52 MAKE_PROPERTY(major_version, get_major_version);
53 MAKE_PROPERTY(minor_version, get_minor_version);
54 MAKE_PROPERTY(sequence_version, get_sequence_version);
55 MAKE_PROPERTY(official_version, is_official_version);
56
57 MAKE_PROPERTY(memory_alignment, get_memory_alignment);
58
59 MAKE_PROPERTY(distributor, get_distributor);
60 MAKE_PROPERTY(compiler, get_compiler);
61 MAKE_PROPERTY(build_date, get_build_date);
62 MAKE_PROPERTY(git_commit, get_git_commit);
63
64 MAKE_PROPERTY(platform, get_platform);
65
66 bool has_system(const std::string &system) const;
67 size_t get_num_systems() const;
68 std::string get_system(size_t n) const;
69 MAKE_SEQ(get_systems, get_num_systems, get_system);
70 MAKE_SEQ_PROPERTY(systems, get_num_systems, get_system);
71
72 std::string get_system_tag(const std::string &system, const std::string &tag) const;
73
74 void add_system(const std::string &system);
75 void set_system_tag(const std::string &system, const std::string &tag,
76 const std::string &value);
77
78 bool heap_trim(size_t pad);
79
80 void output(std::ostream &out) const;
81 void write(std::ostream &out) const;
82
83 static PandaSystem *get_global_ptr();
84
85private:
86 void reset_system_names();
87
88 void set_package_version_string(const std::string &package_version_string);
89 void set_package_host_url(const std::string &package_host_url);
90
94
95 Systems _systems;
96 SystemNames _system_names;
97 bool _system_names_dirty;
98
99 std::string _package_version_string;
100 std::string _package_host_url;
101
102 static PandaSystem *_global_ptr;
103
104public:
105 static TypeHandle get_class_type() {
106 return _type_handle;
107 }
108 static void init_type() {
109 register_type(_type_handle, "PandaSystem");
110 }
111
112private:
113 static TypeHandle _type_handle;
114
115 friend class ConfigPageManager;
116};
117
118inline std::ostream &operator << (std::ostream &out, const PandaSystem &ps) {
119 ps.output(out);
120 return out;
121}
122
123#endif
A global object that maintains the set of ConfigPages everywhere in the world, and keeps them in sort...
This class is used as a namespace to group several global properties of Panda.
Definition pandaSystem.h:26
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
This is our own Panda specialization on the default STL map.
Definition pmap.h:49
This is our own Panda specialization on the default STL vector.
Definition pvector.h:42
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...