1 /******************************************************************************
2  * $Id: records.h 05ec2ff9cd43cabf721a161bbc295f6c827eaedd 2016-10-24 06:23:09Z Kurt Schwehr $
3  *
4  * Project:  APP ENVISAT Support
5  * Purpose:  Low Level Envisat file access (read/write) API.
6  * Author:   Antonio Valentino <antonio.valentino@tiscali.it>
7  *
8  ******************************************************************************
9  * Copyright (c) 2011, Antonio Valentino
10  *
11  * Permission is hereby granted, free of charge, to any person obtaining a
12  * copy of this software and associated documentation files (the "Software"),
13  * to deal in the Software without restriction, including without limitation
14  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  * and/or sell copies of the Software, and to permit persons to whom the
16  * Software is furnished to do so, subject to the following conditions:
17  *
18  * The above copyright notice and this permission notice shall be included
19  * in all copies or substantial portions of the Software.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
22  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
24  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  ****************************************************************************/
29 
30 #ifndef RECORDS_H_
31 #define RECORDS_H_
32 
33 #include "gdal.h"
34 
35 #ifdef __cplusplus
36 extern "C"
37 {
38 #endif
39 
40 #define MJD_FIELD_SIZE 12
41 
42 /*! Field data types */
43 typedef enum {
44     /*! Unknown or unspecified type */      EDT_Unknown = GDT_Unknown,
45     /*! Eight bit unsigned integer */       EDT_UByte = GDT_Byte,
46     /*! Eight bit signed integer */         EDT_SByte = GDT_TypeCount + 0,
47     /*! Sixteen bit unsigned integer */     EDT_UInt16 = GDT_UInt16,
48     /*! Sixteen bit signed integer */       EDT_Int16 = GDT_Int16,
49     /*! Thirty two bit unsigned integer */  EDT_UInt32 = GDT_UInt32,
50     /*! Thirty two bit signed integer */    EDT_Int32 = GDT_Int32,
51     /*! Thirty two bit floating point */    EDT_Float32 = GDT_Float32,
52     /*! Sixty four bit floating point */    EDT_Float64 = GDT_Float64,
53     /*! Complex Int16 */                    EDT_CInt16 = GDT_CInt16,
54     /*! Complex Int32 */                    EDT_CInt32 = GDT_CInt32,
55     /*! Complex Float32 */                  EDT_CFloat32 = GDT_CFloat32,
56     /*! Complex Float64 */                  EDT_CFloat64 = GDT_CFloat64,
57     /*! Modified Julian Dated */            EDT_MJD = GDT_TypeCount + 1,
58     /*! ASCII characters */                 EDT_Char = GDT_TypeCount + 2,
59     EDT_TypeCount = GDT_TypeCount + 3       /* maximum type # + 1 */
60 } EnvisatDataType;
61 
62 typedef struct {
63     const char* szName;
64     int nOffset;
65     EnvisatDataType eType;
66     int nCount;
67 } EnvisatFieldDescr;
68 
69 typedef struct {
70     const char* szName;
71     const EnvisatFieldDescr *pFields;
72 } EnvisatRecordDescr;
73 
74 const EnvisatRecordDescr* EnvisatFile_GetRecordDescriptor(const char* pszProduct,
75                                               const char* pszDataset);
76 
77 CPLErr EnvisatFile_GetFieldAsString(const void*, int, const EnvisatFieldDescr*, char*, size_t);
78 
79 #ifdef __cplusplus
80 } /* extern "C" */
81 #endif
82 
83 #endif /* RECORDS_H_ */
84