COVISE Core
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
ReaderControl.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 ReaderControl
10 //
11 // Description: container for all control information for readers
12 //
13 // Initial version: 22.04.2004
14 //
15 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
16 // (C) 2002 by VirCinity IT Consulting
17 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18 //
19 // Changes:
20 //
21 
22 #ifndef READERCONTROL_H
23 #define READERCONTROL_H
24 
25 #include <covise/covise.h>
26 #include <map>
27 
28 #ifdef _STANDARD_C_PLUS_PLUS
29 using std::map;
30 #endif
31 
32 #include "Items.h"
33 
34 namespace covise
35 {
36 
37 #define READER_CONTROL ReaderControl::instance()
38 
39 typedef map<int, FileItem *> FileList;
40 typedef map<int, PortItem *> PortList;
41 typedef map<int, CompVecPortItem *> CompVecPortList;
42 
44 //
45 // Singleton: ReaderControl - provide global information about
46 // current reader
47 //
49 
50 //template class READEREXPORT map<string,int>;
51 
53 {
54 
55 public:
57  static ReaderControl *instance();
58 
59  void addFile(const int &tok,
60  const string &name,
61  const string &desc,
62  const string &value,
63  const string &mask = string("*"));
64 
65  void addOutputPort(const int &tok,
66  const string &name,
67  const string &type,
68  const string &desc,
69  const bool &ifChoice = true);
70 
71  void addCompVecOutPort(const int &tok,
72  const string &name,
73  const string &type,
74  const string &desc);
75 
76  // returns an int which is associated to the string item
77  int fillPortChoice(const int &tok, const string &item);
78 
79  // fill all choices with one call
80  void fillPortChoice(const int &tok, vector<string> &item);
81 
82  // same as fillPortChoice but keeps content of choice if possible
83  void updatePortChoice(const int &tok, vector<string> &item);
84 
85  // returns the current value of the choice parameter of port
86  // with token tok
87  int getPortChoice(const int &tok);
88 
89  // returns the current value of the choice parameter of a composed vector port
90  // with token tok
91  vector<int> getCompVecChoices(const int &tok);
92 
93  void cleanPortChoice(const int &tok);
94 
95  // returns the COVISE object name associated with a port
96  string getAssocObjName(const int &tok);
97 
98  int setAssocPortObj(const int &tok, coDistributedObject *obj);
99 
100  // store COVISE objects as .covise files in directory dir, create covise group file with name grpName.covgrp and fill it with labels
101  bool storePortObj(string dir, string grpName, map<int, string> &labels);
102 
103  string getPortFileNm(const int &tok);
104 
105  virtual ~ReaderControl();
106 
107  // are the following methods useful
108  string getFileVal(const int &tok);
109 
111  {
112  return files_;
113  };
115  {
116  return ports_;
117  };
118  FileItem *getFileItem(const int &tok);
119  FileItem *getFileItem(const string &name);
120  bool isCompVecPort(const int &tok);
121 
122 private:
123  ReaderControl();
124 
125  PortItem *getPortItem(const int &tok);
126 
127  void fillPortChoice(const int &tok, vector<string> &item, bool do_update);
128 
129  // !! helper: exit if not initialized
130  void initCheck();
131 
133 
137  map<string, int> fileNames_;
138 };
139 }
140 #endif
map< string, int > fileNames_
Definition: ReaderControl.h:137
GLenum GLint GLuint mask
Definition: khronos-glext.h:6719
GLsizei const GLfloat * value
Definition: khronos-glext.h:6760
map< int, CompVecPortItem * > CompVecPortList
Definition: ReaderControl.h:41
CompVecPortList cvec_ports_
Definition: ReaderControl.h:136
GLsizei GLsizei GLuint * obj
Definition: khronos-glext.h:6733
map< int, PortItem * > PortList
Definition: ReaderControl.h:40
PortList ports_
Definition: ReaderControl.h:135
FileList files_
Definition: ReaderControl.h:134
map< int, FileItem * > FileList
Definition: ReaderControl.h:39
#define READEREXPORT
Definition: coExport.h:200
static ReaderControl * instance_
Definition: ReaderControl.h:132
GLenum type
Definition: khronos-glext.h:6279
Definition: ReaderControl.h:52
FileList getFileList()
Definition: ReaderControl.h:110
PortList getPortList()
Definition: ReaderControl.h:114
Definition: Items.h:46
Definition: coDistributedObject.h:294
Definition: Items.h:99
GLuint const GLchar * name
Definition: khronos-glext.h:6722