COVISE Core
coGRMsg.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8//-*-Mode: C++;-*-
9// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
10// ++ (C)2006 VISENSO ++
11// ++ coGRMsg - Covise GUI to Renderer Messages ++
12// ++ Base class for all messages ++
13// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14
15#ifndef COGRMSG_H
16#define COGRMSG_H
17
18#include <string>
19#include <vector>
20#include <util/coExport.h>
21
22#ifdef WIN32
23#define strdup _strdup
24#endif //WIN32
25#ifndef COGRMSG_SAFEFREE
26#define COGRMSG_SAFEFREE(x) \
27 if (x) \
28 { \
29 free(x); \
30 x = NULL; \
31 }
32#endif //COGRMSG_SAFEFREE
33
34namespace grmsg
35{
36
38{
39public:
41 typedef enum
42 {
43 NO_TYPE = 0,
103 SET_VARIANT, // KLSM
105 KINEMATICS_STATE // KLSM
106 } Mtype; //, PLANEINT, BBINT, COLOR, MATERIAL, SELECT, VIEWPOINT, CLIPLANE } Mtype;
107
109 coGRMsg(const char *msg);
110
112 virtual ~coGRMsg()
113 {
114 delete[] str_;
115 };
116
119 {
120 return (is_valid_ == 1);
121 };
122
124 virtual void print_stdout();
125
128 {
129 return type_;
130 };
131 const char *c_str() const;
132 std::string getString() const;
133
134protected:
136 coGRMsg(Mtype type);
137
139 void addToken(const char *token);
140
142 std::string getFirstToken();
143
145 std::string extractFirstToken();
146
148 std::vector<std::string> getAllTokens();
149
152
153private:
155 const char SplitToken;
156
159
163 char *str_;
164};
165}
166#endif
#define GRMSGEXPORT
Definition: coExport.h:349
GLsizei const GLchar *const * string
Definition: khronos-glext.h:6750
GLenum type
Definition: khronos-glext.h:6279
std::string getString(covise::TokenBuffer &tb)
Definition: userinfo.cpp:17
Definition: coGRActivatedViewpointMsg.h:23
Definition: coGRMsg.h:38
Mtype getType() const
access to private variables
Definition: coGRMsg.h:127
Mtype type_
Definition: coGRMsg.h:160
const std::string MsgID
string put to the header to identify the type Gui2RenderMessage
Definition: coGRMsg.h:158
int isValid()
whether recreate was succesful
Definition: coGRMsg.h:118
std::string content_
Definition: coGRMsg.h:161
int is_valid_
valid can be overwritten by children if their recreation was not succesful
Definition: coGRMsg.h:151
const char SplitToken
split message string by this token
Definition: coGRMsg.h:155
char * str_
char representation of content
Definition: coGRMsg.h:163
Mtype
id to specify the type of the message
Definition: coGRMsg.h:42
@ SEND_DOCUMENT_NUMBERS
Definition: coGRMsg.h:66
@ RESTRICT_AXIS
Definition: coGRMsg.h:76
@ VPCLIPPLANEMODE_TOGGLE
Definition: coGRMsg.h:87
@ ANIMATION_SPEED
Definition: coGRMsg.h:84
@ SET_VARIANT
Definition: coGRMsg.h:103
@ CREATE_DEFAULT_VIEWPOINT
Definition: coGRMsg.h:51
@ CHANGE_VIEWPOINT_ID
Definition: coGRMsg.h:54
@ ACTIVATED_VIEWPOINT
Definition: coGRMsg.h:86
@ SET_APPEARANCE
Definition: coGRMsg.h:104
@ SET_DOCUMENT_PAGESIZE
Definition: coGRMsg.h:65
@ FLYMODE_TOGGLE
Definition: coGRMsg.h:57
@ SEND_CURRENT_DOCUMENT
Definition: coGRMsg.h:89
@ SET_CONNECTIONPOINT
Definition: coGRMsg.h:94
@ REGISTER
Definition: coGRMsg.h:44
@ CHANGE_VIEWPOINT
Definition: coGRMsg.h:91
@ ATTACHED_CLIPPLANE
Definition: coGRMsg.h:82
@ TRANSFORM_CASE
Definition: coGRMsg.h:75
@ CREATE_VIEWPOINT
Definition: coGRMsg.h:50
@ ANIMATION_TIMESTEP
Definition: coGRMsg.h:85
@ KEYWORD
Definition: coGRMsg.h:73
@ OBJECT_TRANSFORMED
Definition: coGRMsg.h:93
@ SET_TRANSPARENCY
Definition: coGRMsg.h:72
@ GRAPHIC_RESSOURCE
Definition: coGRMsg.h:77
@ SET_NAME
Definition: coGRMsg.h:59
@ GENERIC_PARAM_REGISTER
Definition: coGRMsg.h:95
@ SELECT_OBJECT
Definition: coGRMsg.h:98
@ SET_DOCUMENT_SCALE
Definition: coGRMsg.h:63
@ TRANSFORM_SGITEM
Definition: coGRMsg.h:97
@ SET_DOCUMENT_POSITION
Definition: coGRMsg.h:64
@ SET_CASE
Definition: coGRMsg.h:58
@ SENSOR_EVENT
Definition: coGRMsg.h:81
@ SET_DOCUMENT_PAGE
Definition: coGRMsg.h:62
@ DELETE_VIEWPOINT
Definition: coGRMsg.h:56
@ GEOMETRY_OBJECT
Definition: coGRMsg.h:100
@ CHANGE_VIEWPOINT_NAME
Definition: coGRMsg.h:55
@ SET_MOVE
Definition: coGRMsg.h:78
@ GEO_VISIBLE
Definition: coGRMsg.h:45
@ MATERIAL_OBJECT
Definition: coGRMsg.h:71
@ MOVE_INTERACTOR
Definition: coGRMsg.h:48
@ DELETE_OBJECT
Definition: coGRMsg.h:99
@ COLOR_OBJECT
Definition: coGRMsg.h:69
@ INTERACTOR_USED
Definition: coGRMsg.h:49
@ SNAPSHOT
Definition: coGRMsg.h:88
@ ADD_CHILD_OBJECT
Definition: coGRMsg.h:101
@ SENSOR
Definition: coGRMsg.h:80
@ DOC_VISIBLE
Definition: coGRMsg.h:67
@ SHADER_OBJECT
Definition: coGRMsg.h:70
@ SET_MOVE_SELECTED
Definition: coGRMsg.h:79
@ SMOKE_VISIBLE
Definition: coGRMsg.h:47
@ ADD_DOCUMENT
Definition: coGRMsg.h:61
@ GENERIC_PARAM_CHANGED
Definition: coGRMsg.h:96
@ TURNTABLE_ANIMATION
Definition: coGRMsg.h:102
@ SHOW_VIEWPOINT
Definition: coGRMsg.h:52
@ INTERACTOR_VISIBLE
Definition: coGRMsg.h:46
@ VIEWPOINT_CHANGED
Definition: coGRMsg.h:92
@ TRANSFORM_OBJECT
Definition: coGRMsg.h:74
@ BOUNDARIES_OBJECT
Definition: coGRMsg.h:68
@ MOVE_OBJECT
Definition: coGRMsg.h:60
@ ANIMATION_ON
Definition: coGRMsg.h:83
@ SET_TRACKING_PARAMS
Definition: coGRMsg.h:90
@ SHOW_PRESENTATIONPOINT
Definition: coGRMsg.h:53
virtual ~coGRMsg()
destructor
Definition: coGRMsg.h:112