OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimAuxFileHandler.h
Go to the documentation of this file.
1 //*******************************************************************
2 // Copyright (C) 2000 ImageLinks Inc.
3 //
4 // License: MIT
5 //
6 // See LICENSE.txt file in the top level directory for more details.
7 //
8 // Author: SPADAC Inc
9 // Adaptd from the GDAL package hfa dataset
10 // Description: This class provides some simple utilities for aux file.
11 //
12 //********************************************************************
13 // $Id: ossimAuxFileHandler.h 2644 2011-05-26 15:20:11Z oscar.kramer $
14 
15 #ifndef ossimAuxFileHandler_HEADER
16 #define ossimAuxFileHandler_HEADER
17 
18 #include <cstring>
19 #include <cstdlib>
20 #include <string>
21 #include <iostream>
22 #include <fstream>
23 
25 #include <ossim/base/ossimString.h>
26 
27 #define EPT_u1 0
28 #define EPT_u2 1
29 #define EPT_u4 2
30 #define EPT_u8 3
31 #define EPT_s8 4
32 #define EPT_u16 5
33 #define EPT_s16 6
34 #define EPT_u32 7
35 #define EPT_s32 8
36 #define EPT_f32 9
37 #define EPT_f64 10
38 #define EPT_c64 11
39 #define EPT_c128 12
40 
41 class ossimFilename;
42 class ossimAuxEntry;
43 class ossimAuxType;
44 class ossimAuxDictionary;
45 
47 
48 public:
49  ossimAuxInfo();
50 
51  virtual ~ossimAuxInfo();
52 
53  FILE *fp;
54 
58 
61 
63 
66 };
67 
68 
70 {
72 
78 
81 
82  char entryNodeName[64];
83  char entryType[32];
84 
88  char* entryData;
89 
90  void loadData();
91 
92  int getFieldValue(const char* auxFieldPath,
93  char chReqType, void *reqReturn);
94 
95 public:
96  ossimAuxEntry( ossimAuxInfo* auxInfoIn, ossim_uint32 nPos,
97  ossimAuxEntry* parentIn, ossimAuxEntry* prevIn);
98 
99  virtual ~ossimAuxEntry();
100 
102 
103  const char* getName() { return entryNodeName; }
104  void setName( const char *nodeName );
105 
106  const char* getType() { return entryType; }
107 
108  char* getData() { loadData(); return entryData; }
111 
114  ossimAuxEntry* getNamedChild( const char * name);
115 
116  ossim_int16 getIntField( const char * auxFieldPath);
117  const char* getStringField( const char * auxFieldPath);
118 
119 };
120 
122 {
123 public:
124  int nBytes;
125 
127  char chPointer; /* '\0', '*' or 'p' */
128  char chItemType; /* 1|2|4|e|... */
129 
130  char *itemObjectType; /* if chItemType == 'o' */
132 
133  char** enumNames; /* normally NULL if not an enum */
134 
135  char *fieldName;
136 
137  ossimAuxField();
138  ~ossimAuxField();
139 
140  int extractInstValue( const char * auxField, int nIndexValue,
141  char *entryData, ossim_uint32 nDataOffset, int nDataSize,
142  char chReqType, void *reqReturn );
143 
144  int getInstCount( char * entryData, int nDataSize );
145 
146  int getInstBytes( char *entryData, int nDataSize );
147 
148  const char* initialize( const char * fieldInput );
149 
150  void completeDefn( ossimAuxDictionary * auxDict );
151 };
152 
153 
155 {
156 public:
157  int nBytes;
158  int nFields;
159 
161 
162  char* auxTypeName;
163 
164  ossimAuxType();
165  ~ossimAuxType();
166 
167  const char* initialize( const char * typeInput);
168 
169  void completeDefn( ossimAuxDictionary * auxDict);
170 
171  int getInstBytes(char *entryData, int nDataSize );
172 
173  int extractInstValue( const char * auxField,
174  char *entryData, ossim_uint32 nDataOffset, int nDataSize,
175  char chReqType, void *reqReturn );
176 };
177 
179 {
180 public:
181  int nTypes;
184 
185  ossimAuxDictionary(const char *auxDictStr);
187 
188  ossimAuxType* findType( const char * name);
189  void addType( ossimAuxType * type);
190 
191  static int getItemSize( char chType);
192 };
193 
194 
196 {
197 public:
198 
199 
201  virtual ~ossimAuxFileHandler();
205  bool isAuxFile(const ossimFilename& file);
206 
210  bool open(const ossimFilename& file);
211 
216  const ossimString& getProjectionName() const { return m_projName; }
217 
218  const ossimString& getDatumName() const { return m_datumName; }
219 
220  const ossimString& getUnitType() const { return m_unitsType; }
221 
222 private:
223 
228 };
229 
230 #endif // #ifndef ossimAuxFileHandlerl_HEADER
void completeDefn(ossimAuxDictionary *auxDict)
const char * getStringField(const char *auxFieldPath)
const ossimString & getProjectionName() const
Reads a single record from a aux file.
ossimAuxType * m_Type
ossimAuxType * m_auxItemObjectType
const ossimString & getDatumName() const
ossim_uint32 nDataPos
int getInstCount(char *entryData, int nDataSize)
ossim_uint32 nChildPos
ossimAuxDictionary * m_Dictionary
void addType(ossimAuxType *type)
ossimAuxEntry * m_Root
ossim_uint32 nDataSize
const char * initialize(const char *typeInput)
const ossimString & getUnitType() const
void setName(const char *nodeName)
ossimAuxEntry * m_Child
ossim_int16 getIntField(const char *auxFieldPath)
ossimAuxType * findType(const char *name)
int getInstBytes(char *entryData, int nDataSize)
ossim_uint32 getDataPos()
ossim_uint32 nRootPos
ossimAuxEntry * getNext()
ossimAuxEntry * getChild()
const char * getType()
unsigned int ossim_uint32
ossimAuxEntry * m_Parent
ossim_uint32 getFilePos()
ossimAuxDictionary(const char *auxDictStr)
ossimAuxField ** m_auxFields
ossimAuxInfo * m_auxInfo
ossim_uint32 nFilePos
int extractInstValue(const char *auxField, int nIndexValue, char *entryData, ossim_uint32 nDataOffset, int nDataSize, char chReqType, void *reqReturn)
ossimAuxType ** m_auxTypes
ossimAuxEntry * m_Next
ossim_uint32 nDictionaryPos
short ossim_int16
ossim_uint32 getDataSize()
ossim_uint32 nEndOfFile
#define OSSIM_DLL
ossim_int32 nVersion
ossimAuxEntry * m_Prev
static int getItemSize(char chType)
int extractInstValue(const char *auxField, char *entryData, ossim_uint32 nDataOffset, int nDataSize, char chReqType, void *reqReturn)
const char * initialize(const char *fieldInput)
ossimAuxEntry(ossimAuxInfo *auxInfoIn, ossim_uint32 nPos, ossimAuxEntry *parentIn, ossimAuxEntry *prevIn)
int getFieldValue(const char *auxFieldPath, char chReqType, void *reqReturn)
void completeDefn(ossimAuxDictionary *auxDict)
const char * getName()
ossim_int16 nEntryHeaderLength
ossimAuxEntry * getNamedChild(const char *name)
int getInstBytes(char *entryData, int nDataSize)
int ossim_int32
ossim_uint32 nNextPos