libdap::BaseTypeFactory Class Reference

`#include <BaseTypeFactory.h>`

Inheritance diagram for libdap::BaseTypeFactory:

## Public Member Functions

virtual Array * | NewArray (const string &n="", BaseType *v=0) const
virtual Byte * | NewByte (const string &n="") const
virtual Float32 * | NewFloat32 (const string &n="") const
virtual Float64 * | NewFloat64 (const string &n="") const
virtual Grid * | NewGrid (const string &n="") const
virtual Int16 * | NewInt16 (const string &n="") const
virtual Int32 * | NewInt32 (const string &n="") const
virtual Sequence * | NewSequence (const string &n="") const
virtual Str * | NewStr (const string &n="") const
virtual Structure * | NewStructure (const string &n="") const
virtual UInt16 * | NewUInt16 (const string &n="") const
virtual UInt32 * | NewUInt32 (const string &n="") const
virtual Url * | NewUrl (const string &n="") const
virtual BaseType * | NewVariable (Type t, const string &name="") const
virtual BaseTypeFactory * | ptr_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

  t | The 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

inline virtual

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:

- BaseTypeFactory.h
- BaseTypeFactory.cc