Panda3D
 All Classes Functions Variables Enumerations
pandaSystem.h
00001 // Filename: pandaSystem.h
00002 // Created by:  drose (26Jan05)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #ifndef PANDASYSTEM_H
00016 #define PANDASYSTEM_H
00017 
00018 #include "dtoolbase.h"
00019 #include "pmap.h"
00020 #include "pvector.h"
00021 
00022 ////////////////////////////////////////////////////////////////////
00023 //       Class : PandaSystem
00024 // Description : This class is used as a namespace to group several
00025 //               global properties of Panda.  Application developers
00026 //               can use this class to query the runtime version or
00027 //               capabilities of the current Panda environment.
00028 ////////////////////////////////////////////////////////////////////
00029 class EXPCL_DTOOL PandaSystem {
00030 protected:
00031   PandaSystem();
00032   ~PandaSystem();
00033 
00034 PUBLISHED:
00035   static string get_version_string();
00036   static string get_package_version_string();
00037   static string get_package_host_url();
00038   static string get_p3d_coreapi_version_string();
00039 
00040   static int get_major_version();
00041   static int get_minor_version();
00042   static int get_sequence_version();
00043   static bool is_official_version();
00044   
00045   static string get_distributor();
00046   static string get_compiler();
00047   static string get_build_date();
00048 
00049   static string get_platform();
00050 
00051   bool has_system(const string &system) const;
00052   int get_num_systems() const;
00053   string get_system(int n) const;
00054 
00055   string get_system_tag(const string &system, const string &tag) const;
00056 
00057   void add_system(const string &system);
00058   void set_system_tag(const string &system, const string &tag,
00059                       const string &value);
00060 
00061   bool heap_trim(size_t pad);
00062 
00063   void output(ostream &out) const;
00064   void write(ostream &out) const;
00065 
00066   static PandaSystem *get_global_ptr();
00067 
00068 private:
00069   void reset_system_names();
00070 
00071   void set_package_version_string(const string &package_version_string);
00072   void set_package_host_url(const string &package_host_url);
00073 
00074   typedef pmap<string, string> SystemTags;
00075   typedef pmap<string, SystemTags> Systems;
00076   typedef pvector<string> SystemNames;
00077 
00078   Systems _systems;
00079   SystemNames _system_names;
00080   bool _system_names_dirty;
00081 
00082   string _package_version_string;
00083   string _package_host_url;
00084 
00085   static PandaSystem *_global_ptr;
00086 
00087 public:
00088   static TypeHandle get_class_type() {
00089     return _type_handle;
00090   }
00091   static void init_type() {
00092     register_type(_type_handle, "PandaSystem");
00093   }
00094 
00095 private:
00096   static TypeHandle _type_handle;
00097 
00098   friend class ConfigPageManager;
00099 };
00100 
00101 inline ostream &operator << (ostream &out, const PandaSystem &ps) {
00102   ps.output(out);
00103   return out;
00104 }
00105 
00106 #endif
00107 
00108   
 All Classes Functions Variables Enumerations