-
Notifications
You must be signed in to change notification settings - Fork 21
/
vtkErrorSink.h
73 lines (53 loc) · 2.02 KB
/
vtkErrorSink.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/*=auto=========================================================================
Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
=========================================================================auto=*/
/// \brief vtkErrorSink - class to capture error and warning events
/// reported by a VTK object. This is useful for detecting that a VTK object
/// encountered problems and act accordingly (instead of just logging the event).
///
#ifndef __vtkErrorSink_h
#define __vtkErrorSink_h
#include "vtkAddon.h"
//#include "vtkCommand.h"
#include "vtkCallbackCommand.h"
#include "vtkSmartPointer.h"
#include <vector>
class VTK_ADDON_EXPORT vtkErrorSink : public vtkObject
{
public:
static vtkErrorSink *New();
vtkTypeMacro(vtkErrorSink,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent) override;
typedef vtkErrorSink Self;
/* Explicitly deleted functions belong in the public interface */
vtkErrorSink(const vtkErrorSink&) = delete;
void operator=(const vtkErrorSink&) = delete;
/// Observe error and warnings reported by observedObject.
virtual void SetObservedObject(vtkObject* observedObject);
/// Return true if the observed object reported errors.
virtual bool HasErrors();
/// Return true if the observed object reported errors.
virtual bool HasWarnings();
/// Return number of reported error or warning messages.
virtual int GetNumberOfMessages();
/// Display errors using vtkOutputWindowDisplayErrorText
/// \sa vtkOutputWindowDisplayErrorText
void DisplayMessages();
protected:
vtkErrorSink();
~vtkErrorSink() override;
struct Message
{
long unsigned int EventId;
std::string MessageText;
};
std::vector<Message> MessageList;
vtkSmartPointer<vtkObject> ObservedObject;
vtkSmartPointer<vtkCallbackCommand> CallbackCommand;
private:
static void CallbackFunction(vtkObject*, long unsigned int,
void* clientData, void* callData);
};
#endif