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