forked from ossimlabs/ossim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathossimVpfDatabaseHeaderTableValidator.cpp
132 lines (123 loc) · 2.66 KB
/
ossimVpfDatabaseHeaderTableValidator.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//-----------------------------------------------------------------
// License: LGPL
//
// See LICENSE.txt file in the top level directory for more details.
//-----------------------------------------------------------------
#include <ossim/vec/ossimVpfDatabaseHeaderTableValidator.h>
#include <ossim/vec/ossimVpfTable.h>
ossimVpfDatabaseHeaderTableValidator::~ossimVpfDatabaseHeaderTableValidator()
{
}
bool ossimVpfDatabaseHeaderTableValidator::isValid(ossimVpfTable& aTable)const
{
// make sure the table is not null
if(&aTable == NULL)
{
return false;
}
// and make sure that the table is not closed
if(aTable.isClosed())
{
return false;
}
// get the table data defined in vpf_util/vpftable.h"
const vpf_table_type* data = aTable.getVpfTableData();
if(!data)
{
return false;
}
// if the file is not open then we can't validate
if(!data->fp)
{
return false;
}
// The way that we will validate is to see if the columns of a dht
// exist. if the column didn't exist then the position
// will be negative
long column = table_pos("ID", *data);
if(column < 0)
{
return false;
}
column = table_pos("VPF_VERSION", *data);
if(column < 0)
{
return false;
}
column = table_pos("DATABASE_NAME", *data);
if(column < 0)
{
return false;
}
column = table_pos("DATABASE_DESC", *data);
if(column < 0)
{
return false;
}
column = table_pos("MEDIA_STANDARD", *data);
if(column < 0)
{
return false;
}
column = table_pos("ORIGINATOR", *data);
if(column < 0)
{
return false;
}
column = table_pos("ADDRESSEE", *data);
if(column < 0)
{
return false;
}
column = table_pos("MEDIA_VOLUMES", *data);
if(column < 0)
{
return false;
}
column = table_pos("SEQ_NUMBERS", *data);
if(column < 0)
{
return false;
}
column = table_pos("NUM_DATA_SETS", *data);
if(column < 0)
{
return false;
}
column = table_pos("SECURITY_CLASS", *data);
if(column < 0)
{
return false;
}
column = table_pos("DOWNGRADING", *data);
if(column < 0)
{
return false;
}
column = table_pos("DOWNGRADE_DATE", *data);
if(column < 0)
{
return false;
}
column = table_pos("RELEASABILITY", *data);
if(column < 0)
{
return false;
}
column = table_pos("TRANSMITTAL_ID", *data);
if(column < 0)
{
return false;
}
column = table_pos("EDITION_NUMBER", *data);
if(column < 0)
{
return false;
}
column = table_pos("EDITION_DATE", *data);
if(column < 0)
{
return false;
}
return true;
}