Shapeworks Studio  2.1
Shape analysis software suite
itkPSMEvents.h
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __itkPSMEvents_h
19 #define __itkPSMEvents_h
20 
21 #include "itkEventObject.h"
22 
23 namespace itk
24 {
42 class ITK_EXPORT ParticleEvent : public EventObject
43 {
44 public:
45  typedef ParticleEvent Self;
46 
47  ParticleEvent() : m_ThreadID(0) {}
48  virtual ~ParticleEvent() {}
49 
51  int GetThreadID() const
52  { return m_ThreadID; }
53  void SetThreadID(int i)
54  { m_ThreadID = i; }
55 
57  ParticleEvent(const ParticleEvent &v) : EventObject(v)
58  {
59  m_ThreadID = v.m_ThreadID;
60  }
61  const ParticleEvent &operator=(const ParticleEvent &v)
62  { m_ThreadID = v.m_ThreadID; return *this; }
63 
65  virtual const char * GetEventName() const { return "ParticleEvent"; }
66 
67  virtual bool CheckEvent(const ::itk::EventObject* e) const
68  { return dynamic_cast<const Self*>(e); }
69 
70  virtual ::itk::EventObject* MakeObject() const
71  { return new Self; }
72 
73 private:
74  int m_ThreadID;
75 };
76 
84 class ITK_EXPORT ParticleEventWithIndex : public ParticleEvent
85 {
86 public:
89 
92  {
93  m_PositionIndex = v.m_PositionIndex;
94  m_DomainIndex = v.m_DomainIndex;
95  }
96  const ParticleEventWithIndex &operator=(const ParticleEventWithIndex &v)
97  {
98  ParticleEvent::operator=(v);
99  m_PositionIndex = v.m_PositionIndex;
100  m_DomainIndex = v.m_DomainIndex;
101  return *this;
102  }
103 
105  inline void SetPositionIndex(int i)
106  { m_PositionIndex = i; }
107  int GetPositionIndex() const
108  { return m_PositionIndex; }
109 
111  inline void SetDomainIndex(int i)
112  { m_DomainIndex = i; }
113  int GetDomainIndex() const
114  { return m_DomainIndex; }
115 
116 private:
117  int m_PositionIndex;
118  int m_DomainIndex;
119 
120 };
121 
122 itkEventMacro( ParticleDomainAddEvent, ParticleEventWithIndex );
123 itkEventMacro( ParticleTransformSetEvent, ParticleEventWithIndex );
124 itkEventMacro( ParticlePrefixTransformSetEvent, ParticleEventWithIndex );
125 itkEventMacro( ParticleNeighborhoodSetEvent, ParticleEventWithIndex );
126 itkEventMacro( ParticlePositionSetEvent, ParticleEventWithIndex );
127 itkEventMacro( ParticlePositionAddEvent, ParticleEventWithIndex );
128 itkEventMacro( ParticlePositionRemoveEvent, ParticleEventWithIndex );
129 
130 } // end namespace itk
131 
132 
133 #endif
ParticleEventWithIndex(const ParticleEventWithIndex &v)
Definition: itkPSMEvents.h:91
virtual const char * GetEventName() const
Definition: itkPSMEvents.h:65
int GetThreadID() const
Definition: itkPSMEvents.h:51
An event class that specializes EventObject for the PSMParticleSystem class.
Definition: itkPSMEvents.h:42
ParticleEvent(const ParticleEvent &v)
Definition: itkPSMEvents.h:57