vtkSMTrace.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: vtkSMTrace.h
5 
6  Copyright (c) Kitware, Inc.
7  All rights reserved.
8  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
59 #ifndef vtkSMTrace_h
60 #define vtkSMTrace_h
61 
62 #include "vtkRemotingServerManagerModule.h" // needed for exports
63 #include "vtkSMObject.h"
64 #include "vtkSmartPointer.h" // needed for iVar
65 
66 #include <vector> // for std::vector
67 
68 class vtkSMProxy;
69 class vtkSmartPyObject;
70 
72 {
73 public:
74  static vtkSMTrace* New();
75  vtkTypeMacro(vtkSMTrace, vtkSMObject);
76  void PrintSelf(ostream& os, vtkIndent indent) override;
77 
82  static vtkSMTrace* GetActiveTracer() { return vtkSMTrace::ActiveTracer.GetPointer(); }
83 
94  static vtkSMTrace* StartTrace(const char* preamble = nullptr);
95 
100  static std::string StopTrace();
101 
103 
108  vtkSetMacro(TraceXMLDefaults, bool);
109  vtkGetMacro(TraceXMLDefaults, bool);
111 
113 
117  vtkSetMacro(LogTraceToStdout, bool);
118  vtkGetMacro(LogTraceToStdout, bool);
120 
122 
129  vtkSetMacro(FullyTraceSupplementalProxies, bool);
130  vtkGetMacro(FullyTraceSupplementalProxies, bool);
132 
134 
137  vtkSetMacro(SkipRenderingComponents, bool);
138  vtkGetMacro(SkipRenderingComponents, bool);
140 
142 
145  vtkSetMacro(FullyTraceCameraAdjustments, bool);
146  vtkGetMacro(FullyTraceCameraAdjustments, bool);
148 
149  enum
150  {
151  RECORD_ALL_PROPERTIES = 0,
152  RECORD_MODIFIED_PROPERTIES = 1,
153  RECORD_USER_MODIFIED_PROPERTIES = 2
154  };
155 
156  vtkSetClampMacro(
157  PropertiesToTraceOnCreate, int, RECORD_ALL_PROPERTIES, RECORD_USER_MODIFIED_PROPERTIES);
158  vtkGetMacro(PropertiesToTraceOnCreate, int);
159 
163  std::string GetCurrentTrace();
164 
172  static std::string GetState(vtkSMProxy* options);
173 
174  // ************** BEGIN INTERNAL *************************
176 
179  class TraceItem;
181  {
182  public:
183  TraceItemArgs();
184  ~TraceItemArgs();
186 
187  // Overloads for keyword arguments.
188  TraceItemArgs& arg(const char* key, vtkObject* val);
189  TraceItemArgs& arg(const char* key, const char* val);
190  TraceItemArgs& arg(const char* key, int val);
191  TraceItemArgs& arg(const char* key, double val);
192  TraceItemArgs& arg(const char* key, bool val);
193  TraceItemArgs& arg(const char* key, const std::vector<int>& val);
194  TraceItemArgs& arg(const char* key, const std::vector<double>& val);
195 
196  // Overloads for positional arguments.
197  TraceItemArgs& arg(vtkObject* val);
198  TraceItemArgs& arg(const char* val);
199  TraceItemArgs& arg(int val);
200  TraceItemArgs& arg(double val);
201  TraceItemArgs& arg(bool val);
202  TraceItemArgs& arg(const std::vector<std::string>& val);
203 
204  private:
206  void operator=(const TraceItemArgs&);
207 
208  friend class TraceItem;
209  class vtkInternals;
210  vtkInternals* Internals;
211  };
212 
214  {
215  public:
216  TraceItem(const char* type);
217  ~TraceItem();
218  void operator=(const TraceItemArgs& arguments);
219 
220  private:
221  TraceItem(const TraceItem&);
222  void operator=(const TraceItem&);
223  const char* Type;
224  class TraceItemInternals;
225  TraceItemInternals* Internals;
226  };
227  // ************** END INTERNAL *************************
228 
229 protected:
230  vtkSMTrace();
231  ~vtkSMTrace() override;
232 
236  bool CheckForError();
237 
244 
245 private:
246  vtkSMTrace(const vtkSMTrace&) = delete;
247  void operator=(const vtkSMTrace&) = delete;
248 
249  static vtkSmartPointer<vtkSMTrace> ActiveTracer;
250  class vtkInternals;
251  vtkInternals* Internals;
252 
253  friend class TraceItem;
254  const vtkSmartPyObject& GetTraceModule() const;
255  const vtkSmartPyObject& GetCreateItemFunction() const;
256 };
257 
258 #define SM_SCOPED_TRACE_0(x, y) x##y
259 #define SM_SCOPED_TRACE_1(x, y) SM_SCOPED_TRACE_0(x, y)
260 #define SM_SCOPED_TRACE(_A_TRACE_TYPE) \
261  vtkSMTrace::TraceItem SM_SCOPED_TRACE_1(_trace_item, __LINE__)(#_A_TRACE_TYPE); \
262  SM_SCOPED_TRACE_1(_trace_item, __LINE__) = vtkSMTrace::TraceItemArgs()
263 #endif
type
#define VTKREMOTINGSERVERMANAGER_EXPORT
vtkSMTrace is used to produce Python trace in the ParaView application.
Definition: vtkSMTrace.h:71
bool FullyTraceSupplementalProxies
Returns true of there&#39;s an error.
Definition: vtkSMTrace.h:241
bool TraceXMLDefaults
Returns true of there&#39;s an error.
Definition: vtkSMTrace.h:238
bool SkipRenderingComponents
Returns true of there&#39;s an error.
Definition: vtkSMTrace.h:242
superclass for most server manager classes
Definition: vtkSMObject.h:29
bool FullyTraceCameraAdjustments
Returns true of there&#39;s an error.
Definition: vtkSMTrace.h:243
static vtkSMTrace * GetActiveTracer()
Provides access to the "active" tracer.
Definition: vtkSMTrace.h:82
static vtkSMObject * New()
proxy for a VTK object(s) on a server
Definition: vtkSMProxy.h:152
T * GetPointer() const
bool LogTraceToStdout
Returns true of there&#39;s an error.
Definition: vtkSMTrace.h:239
int PropertiesToTraceOnCreate
Returns true of there&#39;s an error.
Definition: vtkSMTrace.h:240
key
void PrintSelf(ostream &os, vtkIndent indent) override