|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
// -*- mode: c++; c-basic-offset:4 -*-
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
// This file is part of libdap, A C++ implementation of the OPeNDAP Data
|
|
Packit |
a4aae4 |
// Access Protocol.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
// Copyright (c) 2002,2003 OPeNDAP, Inc.
|
|
Packit |
a4aae4 |
// Author: James Gallagher <jgallagher@opendap.org>
|
|
Packit |
a4aae4 |
//
|
|
Packit |
a4aae4 |
// This library is free software; you can redistribute it and/or
|
|
Packit |
a4aae4 |
// modify it under the terms of the GNU Lesser General Public
|
|
Packit |
a4aae4 |
// License as published by the Free Software Foundation; either
|
|
Packit |
a4aae4 |
// version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
a4aae4 |
//
|
|
Packit |
a4aae4 |
// This library is distributed in the hope that it will be useful,
|
|
Packit |
a4aae4 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
a4aae4 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
a4aae4 |
// Lesser General Public License for more details.
|
|
Packit |
a4aae4 |
//
|
|
Packit |
a4aae4 |
// You should have received a copy of the GNU Lesser General Public
|
|
Packit |
a4aae4 |
// License along with this library; if not, write to the Free Software
|
|
Packit |
a4aae4 |
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit |
a4aae4 |
//
|
|
Packit |
a4aae4 |
// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
// (c) COPYRIGHT URI/MIT 1995-1999
|
|
Packit |
a4aae4 |
// Please read the full copyright statement in the file COPYRIGHT_URI.
|
|
Packit |
a4aae4 |
//
|
|
Packit |
a4aae4 |
// Authors:
|
|
Packit |
a4aae4 |
// jhrg,jimg James Gallagher <jgallagher@gso.uri.edu>
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
// Interface for the class Structure. A structure contains a single set of
|
|
Packit |
a4aae4 |
// variables, all at the same lexical level. Of course, a structure may
|
|
Packit |
a4aae4 |
// contain other structures... The variables contained in a structure are
|
|
Packit |
a4aae4 |
// stored by instances of this class in a SLList of BaseType pointers.
|
|
Packit |
a4aae4 |
//
|
|
Packit |
a4aae4 |
// jhrg 9/14/94
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
#ifndef _structure_h
|
|
Packit |
a4aae4 |
#define _structure_h 1
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
#include <vector>
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
#include "Constructor.h"
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
namespace libdap
|
|
Packit |
a4aae4 |
{
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
class DDS;
|
|
Packit |
a4aae4 |
class ConstraintEvaluator;
|
|
Packit |
a4aae4 |
class D4Group;
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
/** This data type is used to hold a collection of related data types,
|
|
Packit |
a4aae4 |
in a manner roughly corresponding to a C structure. The member
|
|
Packit |
a4aae4 |
types can be simple or compound types, and can include other
|
|
Packit |
a4aae4 |
Structures.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
The DAP2 structure is defined as a singly-linked list. This means
|
|
Packit |
a4aae4 |
that Structure elements can be accessed either by name, with the
|
|
Packit |
a4aae4 |
<tt>var()</tt> function, or by their position in the list, either with
|
|
Packit |
a4aae4 |
the overloaded version of <tt>var()</tt>, or the combination of the
|
|
Packit |
a4aae4 |
<tt>first_var()</tt> and <tt>next_var()</tt> functions.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
The <tt>val2buf()</tt> and <tt>buf2val()</tt> functions only
|
|
Packit |
a4aae4 |
return the size of
|
|
Packit |
a4aae4 |
the structure. To read parts of a DAP2 Structure into an
|
|
Packit |
a4aae4 |
application program, use the <tt>buf2val()</tt> function of the element
|
|
Packit |
a4aae4 |
of the Structure in question.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
Note that the predicate-setting functions <tt>set_send_p()</tt> and
|
|
Packit |
a4aae4 |
<tt>set_read_p()</tt> set their flags for the Structure as well as for
|
|
Packit |
a4aae4 |
each of the Structure's member elements.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
Similar to C, you can refer to members of Structure elements
|
|
Packit |
a4aae4 |
with a ``.'' notation. For example, if the Structure has a member
|
|
Packit |
a4aae4 |
Structure called ``Tom'' and Tom has a member Float32 called
|
|
Packit |
a4aae4 |
``shoe_size'', then you can refer to Tom's shoe size as
|
|
Packit |
a4aae4 |
``Tom.shoe_size''.
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
@brief Holds a structure (aggregate) type.
|
|
Packit |
a4aae4 |
*/
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
class Structure: public Constructor
|
|
Packit |
a4aae4 |
{
|
|
Packit |
a4aae4 |
private:
|
|
Packit |
a4aae4 |
protected:
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
public:
|
|
Packit |
a4aae4 |
Structure(const string &n);
|
|
Packit |
a4aae4 |
Structure(const string &n, const string &d);
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
Structure(const Structure &rhs;;
|
|
Packit |
a4aae4 |
virtual ~Structure();
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
Structure &operator=(const Structure &rhs;;
|
|
Packit |
a4aae4 |
virtual BaseType *ptr_duplicate();
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
virtual void transform_to_dap4(D4Group *root, Constructor *container);
|
|
Packit |
a4aae4 |
virtual vector<BaseType *> *transform_to_dap2(AttrTable *parent_attr_table);
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
virtual bool is_linear();
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
virtual void set_leaf_sequence(int level = 1);
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
virtual void dump(ostream &strm) const ;
|
|
Packit |
a4aae4 |
};
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
} // namespace libdap
|
|
Packit |
a4aae4 |
|
|
Packit |
a4aae4 |
#endif // _structure_h
|