libdap  Updated for version 3.20.6
libdap4 is an implementation of OPeNDAP's DAP protocol.
libdap::BaseTypeFactory Class Reference

#include <BaseTypeFactory.h>

Inheritance diagram for libdap::BaseTypeFactory:
Inheritance graph

Public Member Functions

virtual ArrayNewArray (const string &n="", BaseType *v=0) const
 
virtual ByteNewByte (const string &n="") const
 
virtual Float32NewFloat32 (const string &n="") const
 
virtual Float64NewFloat64 (const string &n="") const
 
virtual GridNewGrid (const string &n="") const
 
virtual Int16NewInt16 (const string &n="") const
 
virtual Int32NewInt32 (const string &n="") const
 
virtual SequenceNewSequence (const string &n="") const
 
virtual StrNewStr (const string &n="") const
 
virtual StructureNewStructure (const string &n="") const
 
virtual UInt16NewUInt16 (const string &n="") const
 
virtual UInt32NewUInt32 (const string &n="") const
 
virtual UrlNewUrl (const string &n="") const
 
virtual BaseTypeNewVariable (Type t, const string &name="") const
 
virtual BaseTypeFactoryptr_duplicate () const
 

Detailed Description

A factory to create instances of the leaf nodes of BaseType (Byte, ... Grid). Clients of libdap++ which require special behavior for the types should subclass this factory and provide an implementation which creates instances of those specializations. Make sure to pass a reference to the new factory to DDS's constructor since by default it uses this factory.

To define and use your own factory, first make sure that you are not using the compile time constant 'DEFAULT_BASETYPE_FACTORY.' Then pass a pointer to an instance of your factory to the DDS/DataDDS constructors. When the parser is used to build a DDS from a DAP response, the factory will be used to instantiate the different variable-type classes.

Note
The easiest way to subclass this is to follow the pattern of using a separate class declaration and implementation. It's possible to use one file to hold both, but that is complicated somewhat because DDS.h, which includes this class, also includes many of the type classes (Array.h, ..., Grid.h) and the order of their inclusion can create compilation problems where the Vector and/or Constructor base classes are not defined. It's easiest to split the declaration and implementation and include forward declarations of the type classes in the declaration (.h) file and then include the type class' headers in the implementation (.cc) file.
Author
James Gallagher
See also
DDS

Definition at line 80 of file BaseTypeFactory.h.

Member Function Documentation

◆ NewVariable()

BaseType * libdap::BaseTypeFactory::NewVariable ( Type  t,
const string &  name = "" 
) const
virtual

Build a new variable and return it using a BaseType pointer. The type of the variable is given using Type enumeration.

Note
Added for DAP4
Parameters
tThe type of the variable to create name The (optional) name of the variable.

Reimplemented in libdap::D4BaseTypeFactory.

Definition at line 50 of file BaseTypeFactory.cc.

◆ ptr_duplicate()

virtual BaseTypeFactory* libdap::BaseTypeFactory::ptr_duplicate ( ) const
inlinevirtual

Clone this object and return a pointer to the clone.

Note
added for DAP4

Reimplemented in libdap::D4BaseTypeFactory.

Definition at line 104 of file BaseTypeFactory.h.


The documentation for this class was generated from the following files: