Panda3D
 All Classes Functions Variables Enumerations
pStatClientData.h
1 // Filename: pStatClientData.h
2 // Created by: drose (11Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PSTATCLIENTDATA_H
16 #define PSTATCLIENTDATA_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "pStatThreadData.h"
21 
22 #include "pStatClientVersion.h"
23 #include "referenceCount.h"
24 #include "pointerTo.h"
25 #include "bitArray.h"
26 
27 #include "pvector.h"
28 #include "vector_int.h"
29 
30 class PStatReader;
31 
32 ////////////////////////////////////////////////////////////////////
33 // Class : PStatClientData
34 // Description : The data associated with a particular client, but not
35 // with any one particular frame or thread: the list of
36 // collectors and threads, for instance.
37 ////////////////////////////////////////////////////////////////////
39 public:
41  ~PStatClientData();
42 
43  bool is_alive() const;
44  void close();
45 
46  int get_num_collectors() const;
47  bool has_collector(int index) const;
48  const PStatCollectorDef &get_collector_def(int index) const;
49  string get_collector_name(int index) const;
50  string get_collector_fullname(int index) const;
51  bool set_collector_has_level(int index, int thread_index, bool flag);
52  bool get_collector_has_level(int index, int thread_index) const;
53 
54  int get_num_toplevel_collectors() const;
55  int get_toplevel_collector(int index) const;
56 
57  int get_num_threads() const;
58  bool has_thread(int index) const;
59  string get_thread_name(int index) const;
60  const PStatThreadData *get_thread_data(int index) const;
61 
62  int get_child_distance(int parent, int child) const;
63 
64 
66  void define_thread(int thread_index, const string &name = string());
67 
68  void record_new_frame(int thread_index, int frame_number,
69  PStatFrameData *frame_data);
70 private:
71  void slot_collector(int collector_index);
72  void update_toplevel_collectors();
73 
74 private:
75  bool _is_alive;
76  PStatReader *_reader;
77 
78  class Collector {
79  public:
80  PStatCollectorDef *_def;
81  BitArray _is_level;
82  };
83 
85  Collectors _collectors;
86 
87  typedef vector_int ToplevelCollectors;
88  ToplevelCollectors _toplevel_collectors;
89 
90  class Thread {
91  public:
92  string _name;
93  PT(PStatThreadData) _data;
94  };
95  typedef pvector<Thread> Threads;
96  Threads _threads;
97 
98  static PStatCollectorDef _null_collector;
99  friend class PStatReader;
100 };
101 
102 #endif
103 
string get_thread_name(int index) const
Returns the name of the indicated thread.
void add_collector(PStatCollectorDef *def)
Adds a new collector definition to the dataset.
int get_child_distance(int parent, int child) const
Returns the number of Collectors between the indicated parent and the child Collector in the relation...
string get_collector_name(int index) const
Returns the name of the indicated collector.
void close()
Closes the client connection if it is open.
bool set_collector_has_level(int index, int thread_index, bool flag)
Indicates whether the given collector has level data (and consequently, whether it should appear on t...
The data associated with a particular client, but not with any one particular frame or thread: the li...
int get_num_collectors() const
Returns the total number of collectors the Data knows about.
string get_collector_fullname(int index) const
Returns the &quot;full name&quot; of the indicated collector.
void record_new_frame(int thread_index, int frame_number, PStatFrameData *frame_data)
Makes room for and stores a new frame&#39;s worth of data associated with some particular thread (which m...
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise...
bool has_thread(int index) const
Returns true if the indicated thread has been defined by the client already, false otherwise...
A dynamic array with an unlimited number of bits.
Definition: bitArray.h:42
This is the class that does all the work for handling communications from a single Panda client...
Definition: pStatReader.h:44
Records the version number of a particular client.
const PStatCollectorDef & get_collector_def(int index) const
Returns the nth collector definition.
bool is_alive() const
Returns true if the data is actively getting filled by a connected client, or false if the client has...
Contains the raw timing and level data for a single frame.
A collection of FrameData structures for recently-received frames within a particular thread...
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
const PStatThreadData * get_thread_data(int index) const
Returns the data associated with the indicated thread.
bool get_collector_has_level(int index, int thread_index) const
Returns whether the given collector has level data (and consequently, whether it should appear on the...
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
int get_num_threads() const
Returns the total number of threads the Data knows about.
Defines the details about the Collectors: the name, the suggested color, etc.
void define_thread(int thread_index, const string &name=string())
Adds a new thread definition to the dataset.