00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef PSTATMONITOR_H
00016 #define PSTATMONITOR_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "pStatClientData.h"
00021 #include "pStatView.h"
00022
00023 #include "referenceCount.h"
00024 #include "pointerTo.h"
00025 #include "luse.h"
00026
00027 #include "pmap.h"
00028
00029 class PStatCollectorDef;
00030 class PStatServer;
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 class PStatMonitor : public ReferenceCount {
00044 public:
00045
00046
00047 PStatMonitor(PStatServer *server);
00048 virtual ~PStatMonitor();
00049
00050 void hello_from(const string &hostname, const string &progname);
00051 void bad_version(const string &hostname, const string &progname,
00052 int client_major, int client_minor,
00053 int server_major, int server_minor);
00054 void set_client_data(PStatClientData *client_data);
00055
00056
00057
00058
00059 bool is_alive() const;
00060 void close();
00061
00062 INLINE PStatServer *get_server();
00063 INLINE const PStatClientData *get_client_data() const;
00064 INLINE string get_collector_name(int collector_index);
00065 const LRGBColor &get_collector_color(int collector_index);
00066
00067 INLINE bool is_client_known() const;
00068 INLINE string get_client_hostname() const;
00069 INLINE string get_client_progname() const;
00070
00071 PStatView &get_view(int thread_index);
00072 PStatView &get_level_view(int collector_index, int thread_index);
00073
00074
00075
00076
00077
00078 virtual string get_monitor_name()=0;
00079
00080 virtual void initialized();
00081 virtual void got_hello();
00082 virtual void got_bad_version(int client_major, int client_minor,
00083 int server_major, int server_minor);
00084 virtual void new_collector(int collector_index);
00085 virtual void new_thread(int thread_index);
00086 virtual void new_data(int thread_index, int frame_number);
00087
00088 virtual void lost_connection();
00089 virtual void idle();
00090 virtual bool has_idle();
00091
00092 virtual bool is_thread_safe();
00093
00094 virtual void user_guide_bars_changed();
00095
00096 protected:
00097 PStatServer *_server;
00098
00099 private:
00100 PT(PStatClientData) _client_data;
00101
00102 bool _client_known;
00103 string _client_hostname;
00104 string _client_progname;
00105
00106 typedef pmap<int, PStatView> Views;
00107 Views _views;
00108 typedef pmap<int, Views> LevelViews;
00109 LevelViews _level_views;
00110
00111 typedef pmap<int, LRGBColor> Colors;
00112 Colors _colors;
00113 };
00114
00115 #include "pStatMonitor.I"
00116
00117 #endif