00001 // Filename: pStatClientData.h 00002 // Created by: drose (11Jul00) 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 PSTATCLIENTDATA_H 00020 #define PSTATCLIENTDATA_H 00021 00022 #include <pandatoolbase.h> 00023 00024 #include "pStatThreadData.h" 00025 00026 #include <pStatClientVersion.h> 00027 #include <referenceCount.h> 00028 #include <pointerTo.h> 00029 00030 #include "pvector.h" 00031 00032 class PStatReader; 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Class : PStatClientData 00036 // Description : The data associated with a particular client, but not 00037 // with any one particular frame or thread: the list of 00038 // collectors and threads, for instance. 00039 //////////////////////////////////////////////////////////////////// 00040 class PStatClientData : public PStatClientVersion { 00041 public: 00042 PStatClientData(PStatReader *reader); 00043 ~PStatClientData(); 00044 00045 bool is_alive() const; 00046 void close(); 00047 00048 int get_num_collectors() const; 00049 bool has_collector(int index) const; 00050 const PStatCollectorDef &get_collector_def(int index) const; 00051 string get_collector_name(int index) const; 00052 string get_collector_fullname(int index) const; 00053 void set_collector_has_level(int index, bool flag); 00054 bool get_collector_has_level(int index) const; 00055 00056 int get_num_threads() const; 00057 bool has_thread(int index) const; 00058 string get_thread_name(int index) const; 00059 const PStatThreadData *get_thread_data(int index) const; 00060 00061 int get_child_distance(int parent, int child) const; 00062 00063 00064 void add_collector(PStatCollectorDef *def); 00065 void define_thread(int thread_index, const string &name = string()); 00066 00067 void record_new_frame(int thread_index, int frame_number, 00068 PStatFrameData *frame_data); 00069 private: 00070 void slot_collector(int collector_index); 00071 00072 00073 private: 00074 bool _is_alive; 00075 PStatReader *_reader; 00076 00077 class Collector { 00078 public: 00079 PStatCollectorDef *_def; 00080 bool _is_level; 00081 }; 00082 00083 typedef pvector<Collector> Collectors; 00084 Collectors _collectors; 00085 00086 class Thread { 00087 public: 00088 string _name; 00089 PT(PStatThreadData) _data; 00090 }; 00091 typedef pvector<Thread> Threads; 00092 Threads _threads; 00093 00094 static PStatCollectorDef _null_collector; 00095 friend class PStatReader; 00096 }; 00097 00098 #endif 00099