VR-Forces 4.3.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
featuresDebugger.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2013 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <features/featureSet.h>
14 
16 
18 
19 #include <tbb/queuing_rw_mutex.h>
20 #include <tbb/recursive_mutex.h>
21 
22 #include <boost/ptr_container/ptr_map.hpp>
23 
24 #include <ostream>
25 
29 
30 namespace MAKVRinTerra
31 {
32  class DtSharedMemoryFeaturesDebugDrawer;
33 
34  template <typename FS>
35  class DtPagingFeatureSet;
36 
38  : public boost::enable_shared_from_this<DtFeaturesDebugger>
39  , public DtSubCommandManager
40  {
41  public:
42  typedef boost::shared_ptr<DtFeaturesDebugger> Ptr;
43 
46  DtFeaturesDebugger(const std::string& name, DtConsoleCommandManager* manager = 0);
47 
48  virtual ~DtFeaturesDebugger();
49 
51 
52  DtFeaturesDebugger& operator[](const std::string& key);
53  const DtFeaturesDebugger& operator[](const std::string& key) const;
55 
56  virtual bool executeCommands(const std::string&);
57 
60  {
61  public:
62  friend class DtFeaturesDebugger;
63 
64  typedef boost::shared_ptr<Record> Ptr;
65 
66  typedef std::vector<std::string> CommandSequence;
67  typedef CommandSequence::const_iterator CommandIterator;
68 
70  explicit Record(DtFeatureSet*, bool enable=true);
71 
72  virtual ~Record();
73 
74  virtual const DtFeatureSet& featureSet() const;
75  virtual std::string name() const;
76 
77  virtual CommandIterator executeCommand(
78  CommandIterator, CommandIterator, std::ostream&);
79  virtual bool executeCommand(const std::string&, std::ostream&);
80 
81  virtual void executeListCommand(std::ostream&);
82 
83  virtual CommandIterator executeInfoCommand(
84  CommandIterator, CommandIterator, std::ostream&);
85  virtual void executeInfoCommand(std::ostream&);
86  virtual bool executeInfoCommand(const std::string&, std::ostream&);
87 
88  virtual CommandIterator executeDrawCommand(
89  CommandIterator, CommandIterator, std::ostream&);
90  virtual bool executeDrawCommand(const std::string&, std::ostream&);
91 
92  virtual void clear();
93 
95  virtual Record& setDrawing(bool enable);
96 
97  Record& command(const std::string&);
98  Record& command(const std::string&, std::ostream&);
99  Record& drawCommand(const std::string&);
100  Record& drawCommand(const std::string&, std::ostream&);
101 
102  virtual Record& addDrawingFeatureSet(
103  DtFeatureSet*,
104  const std::string& name,
105  bool enable = false);
106 
107  template <typename F>
108  Record& addDrawingFeatureSet(
110  const std::string& name,
111  bool enable = false)
112  {
113  return addDrawingFeatureSet(DtFeatureSet::Wrap(fs), name, enable);
114  }
115 
116  virtual Record& setMemoryType(DtDebugDrawerNameManager::MemoryType);
117 
118  protected:
119  struct DrawingSet
120  {
121  explicit DrawingSet(DtFeatureSet* fs, bool enable);
122 
123  boost::scoped_ptr<DtFeatureSet> featureSet;
124  bool enable;
125  };
126 
127  typedef tbb::recursive_mutex Mutex;
128  mutable Mutex mutex;
129 
130  boost::scoped_ptr<DtFeatureSet> myFeatureSet;
131 
132  typedef boost::ptr_multimap<const std::string, DrawingSet> FeatureSetMap;
134 
135  boost::shared_ptr<DtSharedMemoryFeaturesDebugDrawer> drawer;
137 
138  private:
140  };
141 
142  virtual Record::Ptr add(Record*);
143 
148  template <typename F>
149  Record& add(DtFeatureSetTemplate<F>* fs, bool enable = true)
150  {
151  return *add(new Record(DtFeatureSet::Wrap(fs), enable));
152  }
153 
155  bool runCommand(DtString);
156 
158  DtString helpText(const DtString&) const;
159 
160  protected:
161  typedef std::vector<Record::Ptr> RecordVector;
162 
163  virtual RecordVector getMatchingRecords(
165 
166  typedef tbb::queuing_rw_mutex Mutex;
167  mutable Mutex myMutex;
168 
171 
172  typedef std::map<std::string, Ptr> SubDebuggers;
174  };
175 }

Document ID: Generated on Wed Jul 29 00:55:00 EDT 2015 from SVN revision 155257
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)