libdap++  Updated for version 3.13.3
D4BaseTypeFactory.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 "BaseType.h"
30 
31 #include "Byte.h"
32 #include "Int8.h"
33 #include "Int16.h"
34 #include "UInt16.h"
35 #include "Int32.h"
36 #include "UInt32.h"
37 #include "Int64.h"
38 #include "UInt64.h"
39 
40 #include "Float32.h"
41 #include "Float64.h"
42 
43 #include "Str.h"
44 #include "Url.h"
45 
46 #include "Array.h"
47 #include "Structure.h"
48 #include "Sequence.h"
49 #include "Grid.h"
50 
51 #include "D4Group.h"
52 
53 #include "D4BaseTypeFactory.h"
54 #include "debug.h"
55 
56 namespace libdap {
57 
58 Byte *
59 D4BaseTypeFactory::NewByte(const string &n) const
60 {
61  return new Byte(n);
62 }
63 
64 Byte *
65 D4BaseTypeFactory::NewUInt8(const string &n) const
66 {
67  Byte *b = new Byte(n);
69  return b;
70 }
71 
72 Int8 *
73 D4BaseTypeFactory::NewInt8(const string &n) const
74 {
75  return new Int8(n);
76 }
77 
78 Int16 *
79 D4BaseTypeFactory::NewInt16(const string &n) const
80 {
81  return new Int16(n);
82 }
83 
84 UInt16 *
85 D4BaseTypeFactory::NewUInt16(const string &n) const
86 {
87  return new UInt16(n);
88 }
89 
90 Int32 *
91 D4BaseTypeFactory::NewInt32(const string &n) const
92 {
93  DBG(cerr << "Inside DAP4BaseTypeFactory::NewInt32" << endl);
94  return new Int32(n);
95 }
96 
97 UInt32 *
98 D4BaseTypeFactory::NewUInt32(const string &n) const
99 {
100  return new UInt32(n);
101 }
102 
103 Int64 *
104 D4BaseTypeFactory::NewInt64(const string &n) const
105 {
106  DBG(cerr << "Inside DAP4BaseTypeFactory::NewInt64" << endl);
107  return new Int64(n);
108 }
109 
110 UInt64 *
111 D4BaseTypeFactory::NewUInt64(const string &n) const
112 {
113  return new UInt64(n);
114 }
115 
116 Float32 *
117 D4BaseTypeFactory::NewFloat32(const string &n) const
118 {
119  return new Float32(n);
120 }
121 
122 Float64 *
123 D4BaseTypeFactory::NewFloat64(const string &n) const
124 {
125  return new Float64(n);
126 }
127 
128 Str *
129 D4BaseTypeFactory::NewStr(const string &n) const
130 {
131  return new Str(n);
132 }
133 
134 Url *
135 D4BaseTypeFactory::NewUrl(const string &n) const
136 {
137  return new Url(n);
138 }
139 
140 Url *
141 D4BaseTypeFactory::NewURL(const string &n) const
142 {
143  Url *u = new Url(n);
144  u->set_type(dods_url4_c);
145  return u;
146 }
147 
148 Array *
149 D4BaseTypeFactory::NewArray(const string &n , BaseType *v) const
150 {
151  return new Array(n, v);
152 }
153 
154 Structure *
155 D4BaseTypeFactory::NewStructure(const string &n) const
156 {
157  return new Structure(n);
158 }
159 
160 D4Group *
161 D4BaseTypeFactory::NewGroup(const string &n) const
162 {
163  return new D4Group(n);
164 }
165 
166 Sequence *
167 D4BaseTypeFactory::NewSequence(const string &n) const
168 {
169  DBG(cerr << "Inside DAP4BaseTypeFactory::NewSequence" << endl);
170  return new Sequence(n);
171 }
172 
173 Grid *
174 D4BaseTypeFactory::NewGrid(const string &n) const
175 {
176  return new Grid(n);
177 }
178 
179 } // namespace libdap
virtual Float64 * NewFloat64(const string &n="") const
virtual UInt64 * NewUInt64(const string &n="") const
Holds a 16-bit signed integer value.
Definition: Int8.h:42
Holds a64-bit signed integer.
Definition: Int64.h:49
Holds an Internet address (URL).
Definition: Url.h:63
virtual Int64 * NewInt64(const string &n="") const
virtual D4Group * NewGroup(const string &n="") const
virtual UInt16 * NewUInt16(const string &n="") const
virtual Int16 * NewInt16(const string &n="") const
virtual Byte * NewByte(const string &n="") const
Holds an unsigned 16-bit integer.
Definition: UInt16.h:57
Holds a structure (aggregate) type.
Definition: Structure.h:85
Holds a 32-bit floating point value.
Definition: Float32.h:59
virtual Structure * NewStructure(const string &n="") const
virtual Float32 * NewFloat32(const string &n="") const
Holds character string data.
Definition: Str.h:62
#define DBG(x)
Definition: debug.h:58
Holds a 16-bit signed integer value.
Definition: Int16.h:57
virtual Str * NewStr(const string &n="") const
virtual UInt32 * NewUInt32(const string &n="") const
void set_type(const Type &t)
Sets the type of the class instance.
Definition: BaseType.cc:289
Holds the Grid data type.
Definition: Grid.h:121
Holds a sequence.
Definition: Sequence.h:172
virtual Sequence * NewSequence(const string &n="") const
Holds a 64-bit unsigned integer.
Definition: UInt64.h:49
virtual Int32 * NewInt32(const string &n="") const
virtual Array * NewArray(const string &n="", BaseType *v=0) const
virtual Url * NewUrl(const string &n="") const
virtual Int8 * NewInt8(const string &n="") const
virtual Url * NewURL(const string &n="") const
The basic data type for the DODS DAP types.
Definition: BaseType.h:199
Holds a 64-bit (double precision) floating point value.
Definition: Float64.h:60
Holds a single byte.
Definition: Byte.h:60
virtual Grid * NewGrid(const string &n="") const
Holds a 32-bit unsigned integer.
Definition: UInt32.h:59
A multidimensional array of identical data types.
Definition: Array.h:103
virtual Byte * NewUInt8(const string &n="") const
Holds a 32-bit signed integer.
Definition: Int32.h:64