Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

pandatool/src/pstatserver/pStatMonitor.h

Go to the documentation of this file.
00001 // Filename: pStatMonitor.h
00002 // Created by:  drose (08Jul00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
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 //       Class : PStatMonitor
00037 // Description : This is an abstract class that presents the interface
00038 //               to any number of different front-ends for the stats
00039 //               monitor.  One of these will be created by the
00040 //               PStatMonitor as each client is connected; this class
00041 //               is responsible for opening up a new strip-chart graph
00042 //               or whatever is appropriate.  It defines a number of
00043 //               empty virtual functions that will be called as new
00044 //               data becomes available.
00045 ////////////////////////////////////////////////////////////////////
00046 class PStatMonitor : public ReferenceCount {
00047 public:
00048   // The following functions are primarily for use by internal classes
00049   // to set up the monitor.
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   // The following functions are for use by user code to determine
00061   // information about the client data available.
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   // The following virtual methods may be overridden by a derived
00078   // monitor class to customize behavior.
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

Generated on Fri May 2 03:21:36 2003 for Panda-Tool by doxygen1.3