My Project
 All Classes Files Functions Variables Enumerations Enumerator Friends Macros Pages
IdlParser.h
Go to the documentation of this file.
1 // $Id: IdlParser.h,v 1.1.1.1 2009/07/06 23:57:22 eml Exp $
2 
3 #ifndef GCP_IDL_IDLPARSER_H
4 #define GCP_IDL_IDLPARSER_H
5 
16 #include <iostream>
17 #include <vector>
18 
19 #include "idl_export.h"
20 
21 #include "gcp/util/common/Exception.h"
22 
23 namespace gcp {
24  namespace idl {
25 
26  class IdlParser {
27  public:
28 
29  struct IdlStructTag {
30  std::string name_;
31  bool isStruct_;
32  bool isArray_;
33  std::vector<unsigned> dims_;
34  };
35 
39  IdlParser();
40  IdlParser(IDL_VPTR vPtr);
41 
42  void setTo(IDL_VPTR vPtr);
43 
44  void printSomething() {
45  std::cout << "Hello from IdlParser" << std::endl;
46  }
47 
51  virtual ~IdlParser();
52 
53  // Return the dimensionality of a variable
54 
55  std::vector<unsigned> getDimensions();
56 
57  unsigned getDimension(unsigned iDim);
59  void printDimensions();
60 
61  // Return pointers to appropriate data types
62 
63  double* getDoubleData();
64 
65  bool isStruct();
66  bool isArray();
67  bool isDouble();
68  bool isString();
69 
70  //------------------------------------------------------------
71  // String handling methods
72  //------------------------------------------------------------
73 
74  std::string getString(unsigned index=0);
75 
76  //------------------------------------------------------------
77  // Array handling methods
78  //------------------------------------------------------------
79 
80  unsigned getNumberOfElements();
81  unsigned getDataSizeOfElement();
82  unsigned getSizeOf(unsigned idlFlag);
83 
84  //------------------------------------------------------------
85  // Struct handling methods
86  //------------------------------------------------------------
87 
88  unsigned getNumberOfTags();
89  std::vector<IdlParser> getTagList();
90  IdlParser getTag(std::string tagName);
91  unsigned dataOffsetOfTag(std::string tagName);
92  char* getPtrToDataForTag(std::string tagName);
93 
94  std::string name() {
95  return name_;
96  }
97 
98  //------------------------------------------------------------
99  // General utility
100  //------------------------------------------------------------
101 
102  char* getPtrToData();
103 
104  private:
105 
106  bool isPrimary_;
107  std::string name_;
108  IDL_VPTR vPtr_;
109  char* dataBase_;
110 
111  char* getBaseDataPtr();
112 
113  }; // End class IdlParser
114 
115  } // End namespace idl
116 } // End namespace gcp
117 
118 
119 
120 #endif // End #ifndef GCP_IDL_IDLPARSER_H
int getNumberOfDimensions()
Definition: IdlParser.cc:47
bool isDouble()
Definition: IdlParser.cc:141
IdlParser()
Definition: IdlParser.cc:26
Definition: IdlParser.h:29
void printDimensions()
Definition: IdlParser.cc:94
bool isStruct()
Definition: IdlParser.cc:123
bool isArray()
Definition: IdlParser.cc:132
unsigned getDimension(unsigned iDim)
Definition: IdlParser.cc:81
IdlParser getTag(std::string tagName)
Definition: IdlParser.cc:170
bool isString()
Definition: IdlParser.cc:150
virtual ~IdlParser()
Definition: IdlParser.cc:42
unsigned getNumberOfTags()
Definition: IdlParser.cc:159
std::vector< IdlParser > getTagList()
Definition: IdlParser.cc:200
std::vector< unsigned > getDimensions()
Definition: IdlParser.cc:61
Definition: IdlParser.h:26
double * getDoubleData()
Definition: IdlParser.cc:110