MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
CSOEvent.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2012, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13
18
19#pragma once
20
21
22#include "../MLCSOIncludes.h"
23
24
26
27//---------------------------------------------------------------------------
28
39{
40public:
41 // NOTE: if you change the enum CSOEventType, you need to accommodate the list of event names
42 // in CSOManager.cpp :: baseEventCB
43
44 // NOTE: also accommodate the CSOEventWrapper
45
106
109 {
110 _isPostCommand = true;
111 _eventType = NONE;
112 _moduleEventGroupId = 0;
113 }
114
117 {
118 _eventType = eventTypeArg;
119 _isPostCommand = isPostCommandArg;
120 _moduleEventGroupId = 0;
121 }
122
125
127 bool hasCSOIds() const
128 {
129 return _csoIds.size() > 0;
130 }
132 bool hasGroupIds() const
133 {
134 return _groupIds.size() > 0;
135 }
136
138 void addCSOId(unsigned int id);
140 void addGroupId(unsigned int id);
141
143 void addCSOIds(const CSOIdVector& csoIds);
145 void addGroupIds(const CSOIdVector& groupIds);
146
148 const CSOIdVector& csoIds() const
149 {
150 return _csoIds;
151 }
153 const CSOIdVector& groupIds() const
154 {
155 return _groupIds;
156 }
157
160 {
161 return _eventType;
162 }
163
165 static std::string getEventTypeName(CSOEventType eventType);
166
169 {
170 _eventType = eventTypeArg;
171 }
172
174 bool isPostCommand() const
175 {
176 return _isPostCommand;
177 }
179 bool isPreCommand() const
180 {
181 return !_isPostCommand;
182 }
185 {
186 _isPostCommand = flag;
187 }
188
190 void setSenderType(const std::string& senderTypeArg)
191 {
192 _senderType = senderTypeArg;
193 }
195 std::string senderType() const
196 {
197 return _senderType;
198 }
199
201 void setSenderName(const std::string& senderNameArg)
202 {
203 _senderName = senderNameArg;
204 }
206 std::string senderName() const
207 {
208 return _senderName;
209 }
210
213 void setCustomMessage(const std::string& customMessageArg)
214 {
215 _customMessage = customMessageArg;
216 }
219 std::string customMessage() const
220 {
221 return _customMessage;
222 }
223
226 {
227 _moduleEventGroupId = id;
228 }
231 {
232 return _moduleEventGroupId;
233 }
234
236
237protected:
246
247 // Type of event sender.
248 std::string _senderType;
249 // Instance name of event sender.
250 std::string _senderName;
251 // Some custom message if events are generated by scripting.
252 std::string _customMessage;
253 // A unique ID to check whether opening/closing module events match.
255};
256
257//---------------------------------------------------------------------------
258
std::vector< unsigned int > CSOIdVector
Defines a vector to hold CSO and CSOGroup IDs.
#define MLCSO_EXPORT
Defines export symbols for classes, so they can be used in other DLLs.
Definition MLCSOSystem.h:23
BaseEvent is the base class for all events emitted from EventSourceBase.
Class for all CSO events.
Definition CSOEvent.h:39
CSOEvent()
Standard constructor.
Definition CSOEvent.h:108
std::string _senderName
Definition CSOEvent.h:250
MLuint64 moduleEventGroupId() const
Returns a unique module CSOGroup event ID.
Definition CSOEvent.h:230
bool isPreCommand() const
Returns whether the event is a pre command.
Definition CSOEvent.h:179
void addCSOIds(const CSOIdVector &csoIds)
Adds all given CSO IDs if an ID is not INVALID_CSO_ID.
std::string customMessage() const
Returns the custom message string.
Definition CSOEvent.h:219
CSOEventType _eventType
The event type.
Definition CSOEvent.h:243
CSOEventType
Enumeration for specifying the exact type of event.
Definition CSOEvent.h:47
@ CSO_VISUAL_ATTRIBUTE_CHANGE
Definition CSOEvent.h:72
@ GROUP_SELECTION_CHANGE
Definition CSOEvent.h:88
@ GROUP_VISUAL_ATTRIBUTE_CHANGE
Definition CSOEvent.h:91
@ CSO_MODIFICATION
Definition CSOEvent.h:62
@ CSO_EDITABLE_STATE
Definition CSOEvent.h:77
@ GROUP_TIMEPOINT_INDEX
Definition CSOEvent.h:94
@ CSO_SELECTION_CHANGE
Definition CSOEvent.h:69
@ CSO_MOUSE_OVER_CHANGE
Definition CSOEvent.h:68
@ GROUP_DESCRIPTION
Definition CSOEvent.h:93
@ CSO_VOXEL_WRITE_VALUE
Definition CSOEvent.h:80
@ CSO_TIMEPOINT_INDEX
Definition CSOEvent.h:75
@ CSO_DESCRIPTION
Definition CSOEvent.h:74
@ CSOLIST_EVENT_GROUP_CLOSE
Definition CSOEvent.h:53
@ GROUP_VOXEL_WRITE_VALUE
Definition CSOEvent.h:99
@ GROUP_SHOW_STATE
Definition CSOEvent.h:95
@ GROUP_EDITABLE_STATE
Definition CSOEvent.h:96
@ CSO_ADD_TO_GROUP
Definition CSOEvent.h:86
@ CSO_DELETE_SEEDPOINT
Definition CSOEvent.h:67
@ CSOLIST_EVENT_GROUP_OPEN
Definition CSOEvent.h:52
@ CSO_VOXELIZE_STATE
Definition CSOEvent.h:78
@ CSO_USER_DATA_CHANGE
Definition CSOEvent.h:70
@ CSO_GEOMETRY_CHANGE
Definition CSOEvent.h:66
@ GROUP_USER_DATA_CHANGE
Definition CSOEvent.h:89
@ CSO_REMOVE_FROM_GROUP
Definition CSOEvent.h:87
@ CSO_VOXEL_WRITE_MODE
Definition CSOEvent.h:79
@ GROUP_VOXELIZE_STATE
Definition CSOEvent.h:97
@ GROUP_VOXEL_WRITE_MODE
Definition CSOEvent.h:98
std::string senderName() const
Returns the sender name string. This is typically the module instance name from where the event is se...
Definition CSOEvent.h:206
CSOIdVector _groupIds
Vector of CSOGroup IDs.
Definition CSOEvent.h:241
void addCSOId(unsigned int id)
Adds a CSO ID if id is not INVALID_CSO_ID.
CSOIdVector _csoIds
Vector of CSO IDs.
Definition CSOEvent.h:239
void addGroupId(unsigned int id)
Adds a CSOGroup ID if id is not INVALID_CSO_ID.
static std::string getEventTypeName(CSOEventType eventType)
Maps event types to strings with their name.
void setSenderType(const std::string &senderTypeArg)
Sets the sender type string. This is typically the module type from where the event is sent.
Definition CSOEvent.h:190
std::string _customMessage
Definition CSOEvent.h:252
ML_CLASS_HEADER(CSOEvent)
void setModuleEventGroupId(MLuint64 id)
Sets a unique event ID. This is done by the module CSOGroup scope class. No need to temper with it.
Definition CSOEvent.h:225
CSOEvent(CSOEventType eventTypeArg, bool isPostCommandArg=true)
Constructor taking an event type and whether it is a pre/post command.
Definition CSOEvent.h:116
bool hasGroupIds() const
Returns whether CSOGroup IDs are registered with this event.
Definition CSOEvent.h:132
bool _isPostCommand
Whether it is a pre or post command.
Definition CSOEvent.h:245
CSOEvent & operator=(const CSOEvent &event)
Assignment operator.
std::string _senderType
Definition CSOEvent.h:248
CSOEventType eventType() const
Returns the event type.
Definition CSOEvent.h:159
const CSOIdVector & groupIds() const
Returns the vector with CSOGroup IDs.
Definition CSOEvent.h:153
void setEventType(CSOEventType eventTypeArg)
Sets the event type.
Definition CSOEvent.h:168
MLuint64 _moduleEventGroupId
Definition CSOEvent.h:254
bool isPostCommand() const
Returns whether the event is a post command.
Definition CSOEvent.h:174
void setCustomMessage(const std::string &customMessageArg)
Sets the custom message string.
Definition CSOEvent.h:213
void setIsPostCommand(bool flag)
Sets whether the event is a pre or post command.
Definition CSOEvent.h:184
void setSenderName(const std::string &senderNameArg)
Sets the sender name string. This is typically the module instance name from where the event is sent.
Definition CSOEvent.h:201
std::string senderType() const
Returns the sender type string. This is typically the module type from where the event is sent.
Definition CSOEvent.h:195
const CSOIdVector & csoIds() const
Returns the vector with CSO IDs.
Definition CSOEvent.h:148
bool hasCSOIds() const
Returns whether CSO IDs are registered with this event.
Definition CSOEvent.h:127
void addGroupIds(const CSOIdVector &groupIds)
Adds all given CSOGroup IDs if an ID is not INVALID_CSO_ID.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
UINT64 MLuint64
Introduce platform-independent 64-bit unsigned integer type.
Definition mlTypeDefs.h:424