Panda3D
pandaSystem.h
1 // Filename: pandaSystem.h
2 // Created by: drose (26Jan05)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PANDASYSTEM_H
16 #define PANDASYSTEM_H
17 
18 #include "dtoolbase.h"
19 #include "pmap.h"
20 #include "pvector.h"
21 
22 ////////////////////////////////////////////////////////////////////
23 // Class : PandaSystem
24 // Description : This class is used as a namespace to group several
25 // global properties of Panda. Application developers
26 // can use this class to query the runtime version or
27 // capabilities of the current Panda environment.
28 ////////////////////////////////////////////////////////////////////
29 class EXPCL_DTOOL PandaSystem {
30 protected:
31  PandaSystem();
32  ~PandaSystem();
33 
34 PUBLISHED:
35  static string get_version_string();
36  static string get_package_version_string();
37  static string get_package_host_url();
38  static string get_p3d_coreapi_version_string();
39 
40  static int get_major_version();
41  static int get_minor_version();
42  static int get_sequence_version();
43  static bool is_official_version();
44 
45  static string get_distributor();
46  static string get_compiler();
47  static string get_build_date();
48  static string get_git_commit();
49 
50  static string get_platform();
51 
52  bool has_system(const string &system) const;
53  int get_num_systems() const;
54  string get_system(int n) const;
55  MAKE_SEQ(get_systems, get_num_systems, get_system);
56 
57  string get_system_tag(const string &system, const string &tag) const;
58 
59  void add_system(const string &system);
60  void set_system_tag(const string &system, const string &tag,
61  const string &value);
62 
63  bool heap_trim(size_t pad);
64 
65  void output(ostream &out) const;
66  void write(ostream &out) const;
67 
68  static PandaSystem *get_global_ptr();
69 
70 private:
71  void reset_system_names();
72 
73  void set_package_version_string(const string &package_version_string);
74  void set_package_host_url(const string &package_host_url);
75 
79 
80  Systems _systems;
81  SystemNames _system_names;
82  bool _system_names_dirty;
83 
84  string _package_version_string;
85  string _package_host_url;
86 
87  static PandaSystem *_global_ptr;
88 
89 public:
90  static TypeHandle get_class_type() {
91  return _type_handle;
92  }
93  static void init_type() {
94  register_type(_type_handle, "PandaSystem");
95  }
96 
97 private:
98  static TypeHandle _type_handle;
99 
100  friend class ConfigPageManager;
101 };
102 
103 inline ostream &operator << (ostream &out, const PandaSystem &ps) {
104  ps.output(out);
105  return out;
106 }
107 
108 #endif
109 
110 
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:29
A global object that maintains the set of ConfigPages everywhere in the world, and keeps them in sort...
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85