COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Items.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 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9 // CLASS FileItem
10 // CLASS PortItem
11 //
12 // Description:
13 //
14 // Initial version: 2001-
15 //
16 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17 // (C) 2001 by VirCinity IT Consulting
18 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19 //
20 // Changes:
21 //
22 
23 #ifndef ITEMS_H
24 #define ITEMS_H
25 
26 #include <covise/covise.h>
27 #include <map>
28 
29 #ifdef __sgi
30 using namespace std;
31 #endif
32 #include <api/coChoiceParam.h>
33 #include <api/coFileBrowserParam.h>
34 #include <api/coOutputPort.h>
35 
37 //
38 // simple data class FileItem to store information about
39 // filebrowser parameters
40 //
42 
43 namespace covise
44 {
45 
47 {
48 public:
49  FileItem();
50  FileItem(const string &name,
51  const string &desc,
52  const string &value,
53  const string &mask);
54 
55  string getName()
56  {
57  return name_;
58  };
59  string getDesc()
60  {
61  return desc_;
62  };
63  string getValue()
64  {
65  return value_;
66  };
67  string getMask()
68  {
69  return mask_;
70  };
71 
72  // BE AWARE: allows user to change data but this behaviour is needed here
74  {
75  return browserPtr_;
76  };
78  {
79  browserPtr_ = ptr;
80  };
81 
82  bool empty();
83 
84 private:
85  string name_;
86  string desc_;
87  string value_;
88  string mask_;
89  bool empty_;
91 };
92 
94 //
95 // simple data class PortItem to store information about
96 // filebrowser ports
97 //
100 {
101 
102 public:
103  PortItem();
104  PortItem(const string &name,
105  const string &type,
106  const string &desc,
107  const bool &ifChoice);
108 
109  virtual ~PortItem()
110  {
111  }
112 
113  string getName()
114  {
115  return name_;
116  };
117  string getType()
118  {
119  return type_;
120  };
121  string getDesc()
122  {
123  return desc_;
124  };
125  coOutputPort *getPortPtr() const;
126 
127  void setPortPtr(coOutputPort *ptr);
128 
129  // BE AWARE: allows user to change data but this behaviour is needed here
131  {
132  return choicePtr_;
133  };
135  {
136  choicePtr_ = ptr;
137  };
138  //
139  void fillChoice(const string &it);
140  virtual void fillChoice(vector<string> &it, bool do_update = false);
141 
142  virtual void updateChoice(vector<string> &it)
143  {
144  fillChoice(it, true);
145  };
146 
147  int getChoice();
148  void cleanChoice();
149 
150  bool hasChoice()
151  {
152  return ifChoice_;
153  };
154  bool empty();
155 
156 private:
157  string name_;
158  string type_;
159  string desc_;
160  bool empty_;
163  bool ifChoice_;
165  vector<string> choiceLabels_;
166 
167  // synchronise choices with COVISE API
168  void syncChoice(bool do_update);
169 };
170 
171 typedef vector<PortItem *> PortItemList;
172 
174 //
175 // simple data class CompVecPortItem to store information about
176 // vector ports that are composed by scalar values in the reader
177 //
180 {
181 
182 public:
183  CompVecPortItem();
184  CompVecPortItem(const string &name,
185  const string &type,
186  const string &desc);
187 
189  {
190  }
191 
192  string getCompName(int comp)
193  {
194  return choices_[comp]->getName();
195  };
196 
197  void setChoicePtrs(vector<coChoiceParam *> ptrs);
198  void fillChoice(vector<string> &it, bool do_update = false);
199 
200  void updateChoice(vector<string> &it)
201  {
202  fillChoice(it, true);
203  };
204 
205  vector<int> getChoice();
206 
207 private:
209 
210  void addItem(const string &chName, const string &type, const string &desc);
211 };
212 }
213 #endif
virtual ~PortItem()
Definition: Items.h:109
Definition: Items.h:179
string getDesc()
Definition: Items.h:121
GLenum GLint GLuint mask
Definition: khronos-glext.h:6719
bool ifChoice_
Definition: Items.h:163
GLsizei const GLfloat * value
Definition: khronos-glext.h:6760
Definition: coOutputPort.h:26
vector< PortItem * > PortItemList
Definition: Items.h:171
bool hasChoice()
Definition: Items.h:150
void setChoicePtr(coChoiceParam *ptr)
Definition: Items.h:134
string name_
Definition: Items.h:85
string getName()
Definition: Items.h:113
virtual ~CompVecPortItem()
Definition: Items.h:188
string getType()
Definition: Items.h:117
coOutputPort * portPtr_
Definition: Items.h:162
#define READEREXPORT
Definition: coExport.h:200
string mask_
Definition: Items.h:88
File browser parameter.
Definition: coFileBrowserParam.h:29
vector< string > choiceLabels_
Definition: Items.h:165
GLenum type
Definition: khronos-glext.h:6279
string desc_
Definition: Items.h:86
coChoiceParam * choicePtr_
Definition: Items.h:161
void updateChoice(vector< string > &it)
Definition: Items.h:200
string getName()
Definition: Items.h:55
string desc_
Definition: Items.h:159
PortItemList choices_
Definition: Items.h:208
bool empty_
Definition: Items.h:160
string getCompName(int comp)
Definition: Items.h:192
parameter to choose values from a list
Definition: coChoiceParam.h:29
coFileBrowserParam * browserPtr_
Definition: Items.h:90
string getMask()
Definition: Items.h:67
string value_
Definition: Items.h:87
Definition: Items.h:46
bool empty_
Definition: Items.h:89
Definition: Items.h:99
coChoiceParam * getChoicePtr()
Definition: Items.h:130
string type_
Definition: Items.h:158
int maxChoiceVal_
Definition: Items.h:164
string getValue()
Definition: Items.h:63
GLuint const GLchar * name
Definition: khronos-glext.h:6722
string name_
Definition: Items.h:157
coFileBrowserParam * getBrowserPtr()
Definition: Items.h:73
string getDesc()
Definition: Items.h:59
virtual void updateChoice(vector< string > &it)
Definition: Items.h:142
void setBrowserPtr(coFileBrowserParam *ptr)
Definition: Items.h:77