libdap  Updated for version 3.17.0
BaseTypeFactory.h
00001 
00002 // -*- mode: c++; c-basic-offset:4 -*-
00003 
00004 // This file is part of libdap, A C++ implementation of the OPeNDAP Data
00005 // Access Protocol.
00006 
00007 // Copyright (c) 2005 OPeNDAP, Inc.
00008 // Author: James Gallagher <jgallagher@opendap.org>
00009 //
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 //
00015 // This library is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023 //
00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00025 
00026 #ifndef base_type_factory_h
00027 #define base_type_factory_h
00028 
00029 #include <string>
00030 
00031 #include "Type.h"
00032 #include "InternalErr.h"
00033 
00034 // Class declarations; Make sure to include the corresponding headers in the
00035 // implementation file.
00036 
00037 namespace libdap
00038 {
00039 
00040 class Byte;
00041 class Int16;
00042 class UInt16;
00043 class Int32;
00044 class UInt32;
00045 class Float32;
00046 class Float64;
00047 class Str;
00048 class Url;
00049 class Array;
00050 class Structure;
00051 class Sequence;
00052 class Grid;
00053 class BaseType;
00054 
00080 class BaseTypeFactory
00081 {
00082 public:
00083     BaseTypeFactory()
00084     {}
00085     virtual ~BaseTypeFactory()
00086     {}
00087 
00097     virtual BaseType *NewVariable(Type t, const string &name = "") const;
00098 
00104     virtual BaseTypeFactory *ptr_duplicate() const {
00105         throw InternalErr(__FILE__, __LINE__, "Not Implemented.");
00106     }
00107 
00108     virtual Byte *NewByte(const string &n = "") const;
00109     virtual Int16 *NewInt16(const string &n = "") const;
00110     virtual UInt16 *NewUInt16(const string &n = "") const;
00111     virtual Int32 *NewInt32(const string &n = "") const;
00112     virtual UInt32 *NewUInt32(const string &n = "") const;
00113     virtual Float32 *NewFloat32(const string &n = "") const;
00114     virtual Float64 *NewFloat64(const string &n = "") const;
00115 
00116     virtual Str *NewStr(const string &n = "") const;
00117     virtual Url *NewUrl(const string &n = "") const;
00118 
00119     virtual Array *NewArray(const string &n = "", BaseType *v = 0) const;
00120     virtual Structure *NewStructure(const string &n = "") const;
00121     virtual Sequence *NewSequence(const string &n = "") const;
00122     virtual Grid *NewGrid(const string &n = "") const;
00123 };
00124 
00125 } // namespace libdap
00126 
00127 #endif // base_type_factory_h