libdap++
Updated for version 3.12.0
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
BaseTypeFactory.cc
Go to the documentation of this file.
1
2
// -*- mode: c++; c-basic-offset:4 -*-
3
4
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
5
// Access Protocol.
6
7
// Copyright (c) 2005 OPeNDAP, Inc.
8
// Author: James Gallagher <jgallagher@opendap.org>
9
//
10
// This library is free software; you can redistribute it and/or
11
// modify it under the terms of the GNU Lesser General Public
12
// License as published by the Free Software Foundation; either
13
// version 2.1 of the License, or (at your option) any later version.
14
//
15
// This library is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
// Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public
21
// License along with this library; if not, write to the Free Software
22
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23
//
24
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25
26
27
#include <string>
28
29
#include "
Byte.h
"
30
#include "
Int16.h
"
31
#include "
UInt16.h
"
32
#include "
Int32.h
"
33
#include "
UInt32.h
"
34
#include "
Float32.h
"
35
#include "
Float64.h
"
36
#include "
Str.h
"
37
#include "
Url.h
"
38
#include "
Array.h
"
39
#include "
Structure.h
"
40
#include "
Sequence.h
"
41
#include "
Grid.h
"
42
43
#include "
BaseTypeFactory.h
"
44
#include "
debug.h
"
45
46
namespace
libdap {
47
48
BaseType *
49
BaseTypeFactory::NewVariable
(
Type
type,
const
string
&name)
const
50
{
51
switch
(type) {
52
case
dods_byte_c
:
53
return
NewByte
(name);
54
case
dods_int16_c
:
55
return
NewInt16
(name);
56
case
dods_uint16_c
:
57
return
NewUInt16
(name);
58
case
dods_int32_c
:
59
return
NewInt32
(name);
60
case
dods_uint32_c
:
61
return
NewUInt32
(name);
62
case
dods_float32_c
:
63
return
NewFloat32
(name);
64
case
dods_float64_c
:
65
return
NewFloat64
(name);
66
67
case
dods_str_c
:
68
return
NewStr
(name);
69
case
dods_url_c
:
70
return
NewUrl
(name);
71
72
case
dods_array_c
:
73
return
NewArray
(name);
74
case
dods_structure_c
:
75
return
NewStructure
(name);
76
case
dods_sequence_c
:
77
return
NewSequence
(name);
78
case
dods_grid_c
:
79
return
NewGrid
(name);
80
default
:
81
throw
InternalErr
(__FILE__, __LINE__,
"Unknow type"
);
82
}
83
}
84
Byte
*
85
BaseTypeFactory::NewByte
(
const
string
&n)
const
86
{
87
return
new
Byte
(n);
88
}
89
90
Int16
*
91
BaseTypeFactory::NewInt16
(
const
string
&n)
const
92
{
93
return
new
Int16
(n);
94
}
95
96
UInt16
*
97
BaseTypeFactory::NewUInt16
(
const
string
&n)
const
98
{
99
return
new
UInt16
(n);
100
}
101
102
Int32
*
103
BaseTypeFactory::NewInt32
(
const
string
&n)
const
104
{
105
DBG
(cerr <<
"Inside BaseTypeFactory::NewInt32"
<< endl);
106
return
new
Int32
(n);
107
}
108
109
UInt32
*
110
BaseTypeFactory::NewUInt32
(
const
string
&n)
const
111
{
112
return
new
UInt32
(n);
113
}
114
115
Float32
*
116
BaseTypeFactory::NewFloat32
(
const
string
&n)
const
117
{
118
return
new
Float32
(n);
119
}
120
121
Float64
*
122
BaseTypeFactory::NewFloat64
(
const
string
&n)
const
123
{
124
return
new
Float64
(n);
125
}
126
127
Str
*
128
BaseTypeFactory::NewStr
(
const
string
&n)
const
129
{
130
return
new
Str
(n);
131
}
132
133
Url
*
134
BaseTypeFactory::NewUrl
(
const
string
&n)
const
135
{
136
return
new
Url
(n);
137
}
138
139
Array
*
140
BaseTypeFactory::NewArray
(
const
string
&n ,
BaseType
*v)
const
141
{
142
return
new
Array
(n, v);
143
}
144
145
Structure
*
146
BaseTypeFactory::NewStructure
(
const
string
&n)
const
147
{
148
return
new
Structure
(n);
149
}
150
151
Sequence
*
152
BaseTypeFactory::NewSequence
(
const
string
&n)
const
153
{
154
DBG
(cerr <<
"Inside BaseTypeFactory::NewSequence"
<< endl);
155
return
new
Sequence
(n);
156
}
157
158
Grid
*
159
BaseTypeFactory::NewGrid
(
const
string
&n)
const
160
{
161
return
new
Grid
(n);
162
}
163
164
}
// namespace libdap
BaseTypeFactory.cc
Generated on Fri Oct 18 2013 00:14:23 for libdap++ by
1.8.4