Prev Up Next
Go backward to 4 Automake support
Go up to Top
Go forward to References

A NCTypeFactory

NCTypeFactory.cc

// -*- mode: c++; c-basic-offset:4 -*-

// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.

// Copyright (c) 2005 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.

#ifndef nc_type_factory_h
#define nc_type_factory_h

#include <string>

// Class declarations; Make sure to include the corresponding headers in the
// implementation file.

class NCByte;
class NCInt16;
class NCUInt16;
class NCInt32;
class NCUInt32;
class NCFloat32;
class NCFloat64;
class NCStr;
class NCUrl;
class NCArray;
class NCStructure;
class NCSequence;
class NCGrid;

/** A factory for the NetCDF client library types.

    @author James Gallagher
    @see DDS */
class NCTypeFactory: public BaseTypeFactory {
public:
    NCTypeFactory() {} 
    virtual ~NCTypeFactory() {}

    virtual Byte *NewByte(const string &n = "") const;
    virtual Int16 *NewInt16(const string &n = "") const;
    virtual UInt16 *NewUInt16(const string &n = "") const;
    virtual Int32 *NewInt32(const string &n = "") const;
    virtual UInt32 *NewUInt32(const string &n = "") const;
    virtual Float32 *NewFloat32(const string &n = "") const;
    virtual Float64 *NewFloat64(const string &n = "") const;

    virtual Str *NewStr(const string &n = "") const;
    virtual Url *NewUrl(const string &n = "") const;

    virtual Array *NewArray(const string &n = "", BaseType *v = 0) const;
    virtual Structure *NewStructure(const string &n = "") const;
    virtual Sequence *NewSequence(const string &n = "") const;
    virtual Grid *NewGrid(const string &n = "") const;
};

#endif // nc_type_factory_h
NCTypeFactory.cc

// -*- mode: c++; c-basic-offset:4 -*-

// This file is part of libdap, A C++ implementation of the OPeNDAP Data
// Access Protocol.

// Copyright (c) 2005 OPeNDAP, Inc.
// Author: James Gallagher <jgallagher@opendap.org>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
// 
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
//
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.


#include <string>

#include "NCByte.h"
#include "NCInt16.h"
#include "NCUInt16.h"
#include "NCInt32.h"
#include "NCUInt32.h"
#include "NCFloat32.h"
#include "NCFloat64.h"
#include "NCStr.h"
#include "NCUrl.h"
#include "NCArray.h"
#include "NCStructure.h"
#include "NCSequence.h"
#include "NCGrid.h"

#include "NCTypeFactory.h"
#include "debug.h"

Byte *
NCTypeFactory::NewByte(const string &n ) const 
{ 
    return new NCByte(n);
}

Int16 *
NCTypeFactory::NewInt16(const string &n ) const 
{ 
    return new NCInt16(n); 
}

UInt16 *
NCTypeFactory::NewUInt16(const string &n ) const 
{ 
    return new NCUInt16(n);
}

Int32 *
NCTypeFactory::NewInt32(const string &n ) const 
{ 
    return new NCInt32(n);
}

UInt32 *
NCTypeFactory::NewUInt32(const string &n ) const 
{ 
    return new NCUInt32(n);
}

Float32 *
NCTypeFactory::NewFloat32(const string &n ) const 
{ 
    return new NCFloat32(n);
}

Float64 *
NCTypeFactory::NewFloat64(const string &n ) const 
{ 
    return new NCFloat64(n);
}

Str *
NCTypeFactory::NewStr(const string &n ) const 
{ 
    return new NCStr(n);
}

Url *
NCTypeFactory::NewUrl(const string &n ) const 
{ 
    return new NCUrl(n);
}

Array *
NCTypeFactory::NewArray(const string &n , BaseType *v) const 
{ 
    return new NCArray(n, v);
}

Structure *
NCTypeFactory::NewStructure(const string &n ) const 
{ 
    return new NCStructure(n);
}

Sequence *
NCTypeFactory::NewSequence(const string &n ) const 
{ 
    return new NCSequence(n);
}

Grid *
NCTypeFactory::NewGrid(const string &n ) const 
{ 
    return new NCGrid(n);
}

James Gallagher <jgallagher@opendap.org>, 2005-11-02, Revision: 12461

Prev Up Next