Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkObservation.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkObservation.h,v $
10  Date: $Date: 2006/01/08 04:48:05 $
11  Version: $Revision: 1.45 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkObservation_h
16 #define __vtkObservation_h
17 
18 // MRML includes
19 #include "vtkMRML.h"
20 class vtkEventBroker;
21 
22 // VTK includes
23 #include <vtkObject.h>
24 class vtkCallbackCommand;
25 
26 // STD includes
27 #include <deque>
28 
40 //
43 class VTK_MRML_EXPORT vtkObservation : public vtkObject
44 {
45  public:
46 
48  static vtkObservation *New();
49  vtkTypeMacro(vtkObservation,vtkObject);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
58  virtual void SetEventBroker(vtkEventBroker* eventBroker);
59  vtkGetObjectMacro (EventBroker, vtkEventBroker);
60  vtkGetMacro (InEventQueue, int);
61  vtkSetMacro (InEventQueue, int);
62  vtkGetObjectMacro (ObservationCallbackCommand, vtkCallbackCommand);
63  vtkGetObjectMacro (Subject, vtkObject);
64  void AssignSubject(vtkObject* subject) {this->Subject = subject;};
65  vtkGetMacro (Event, unsigned long);
66  vtkSetMacro (Event, unsigned long);
67  virtual void SetCallbackCommand(vtkCallbackCommand* callbackCommand);
68  vtkGetObjectMacro (CallbackCommand, vtkCallbackCommand);
69  vtkSetStringMacro (Script);
70  vtkGetStringMacro (Script);
71  vtkGetObjectMacro (Observer, vtkObject);
72  void AssignObserver(vtkObject* observer) {this->Observer = observer;};
73  vtkSetStringMacro (Comment);
74  vtkGetStringMacro (Comment);
75  vtkSetMacro(Priority, float);
76  vtkGetMacro(Priority, float);
77 
78  vtkGetMacro (EventTag, unsigned long);
79  vtkSetMacro (EventTag, unsigned long);
80  vtkGetMacro (SubjectDeleteEventTag, unsigned long);
81  vtkSetMacro (SubjectDeleteEventTag, unsigned long);
82  vtkGetMacro (ObserverDeleteEventTag, unsigned long);
83  vtkSetMacro (ObserverDeleteEventTag, unsigned long);
84 
88  vtkGetMacro (LastElapsedTime, double);
89  vtkSetMacro (LastElapsedTime, double);
90  vtkGetMacro (TotalElapsedTime, double);
91  vtkSetMacro (TotalElapsedTime, double);
92 
93  struct CallType
94  {
95  inline CallType(unsigned long eventID, void* callData);
96  unsigned long EventID;
97  void* CallData;
98  };
99  std::deque<CallType> *GetCallDataList() {return &(this->CallDataList);};
100 
101 protected:
102  vtkObservation();
103  ~vtkObservation() override;
105  void operator=(const vtkObservation&);
106 
110 
114  vtkCallbackCommand *ObservationCallbackCommand;
115 
121 
124  vtkObject *Subject;
125 
128  unsigned long Event;
129 
132  vtkObject *Observer;
133 
136  vtkCallbackCommand *CallbackCommand;
137 
140  std::deque<CallType> CallDataList;
141 
144  char *Script;
145 
148  char *Comment;
149 
151  float Priority;
152 
156  unsigned long EventTag;
157  unsigned long SubjectDeleteEventTag;
158  unsigned long ObserverDeleteEventTag;
159 
162 
163 };
164 
165 //----------------------------------------------------------------------------
166 vtkObservation::CallType::CallType(unsigned long eventID, void* callData)
167  : EventID(eventID)
168  , CallData(callData)
169 {
170 }
171 
172 
173 #endif
char * Script
Holder for script as an alternative to the callback command
void AssignSubject(vtkObject *subject)
vtkCallbackCommand * CallbackCommand
Holder for callback that the Observer wants to have run when Event happens
float Priority
Priority of the observer.
vtkObject * Subject
Holder for Subject
unsigned long Event
Holder for Event
unsigned long ObserverDeleteEventTag
Stores information about the relationship between a Subject and an Observer.
Class that manages adding and deleting of observers with events.
void AssignObserver(vtkObject *observer)
double TotalElapsedTime
vtkObject * Observer
Holder for Observer
vtkCallbackCommand * ObservationCallbackCommand
std::deque< CallType > CallDataList
data passed to the observation by the subject
unsigned long EventTag
unsigned long SubjectDeleteEventTag
CallType(unsigned long eventID, void *callData)
double LastElapsedTime
char * Comment
Holder for comment string
vtkEventBroker * EventBroker
EventBroker that &#39;owns&#39; this observation
std::deque< CallType > * GetCallDataList()