Structure.h

Go to the documentation of this file.
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) 2002,2003 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 //
00024 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
00025 
00026 // (c) COPYRIGHT URI/MIT 1995-1999
00027 // Please read the full copyright statement in the file COPYRIGHT_URI.
00028 //
00029 // Authors:
00030 //      jhrg,jimg       James Gallagher <jgallagher@gso.uri.edu>
00031 
00032 // Interface for the class Structure. A structure contains a single set of
00033 // variables, all at the same lexical level. Of course, a structure may
00034 // contain other structures... The variables contained in a structure are
00035 // stored by instances of this class in a SLList of BaseType pointers.
00036 //
00037 // jhrg 9/14/94
00038 
00039 #ifndef _structure_h
00040 #define _structure_h 1
00041 
00042 #ifndef __POWERPC__
00043 #endif
00044 
00045 #include <vector>
00046 //#include "Pix.h"
00047 
00048 #ifndef _basetype_h
00049 #include "BaseType.h"
00050 #endif
00051 
00052 #ifndef _constructor_h
00053 #include "Constructor.h"
00054 #endif
00055 
00056 #ifndef _dds_h
00057 #include "DDS.h"
00058 #endif
00059 
00060 #ifndef constraint_evaluator_h
00061 #include "ConstraintEvaluator.h"
00062 #endif
00063 
00064 // FIXME
00065 #include "XDRUtils.h"
00066 
00067 namespace libdap
00068 {
00069 
00102 class Structure: public Constructor
00103 {
00104 private:
00105     BaseType *m_leaf_match(const string &name, btp_stack *s = 0);
00106     BaseType *m_exact_match(const string &name, btp_stack *s = 0);
00107 
00108 protected:
00109     void _duplicate(const Structure &s);
00110 
00111 public:
00112     Structure(const string &n = "");
00113 
00114     Structure(const Structure &rhs);
00115     virtual ~Structure();
00116 
00117     Structure &operator=(const Structure &rhs);
00118     virtual BaseType *ptr_duplicate();
00119 
00120     virtual int element_count(bool leaves = false);
00121     virtual bool is_linear();
00122 
00123     virtual void set_send_p(bool state);
00124     virtual void set_read_p(bool state);
00125     virtual void set_in_selection(bool state);
00126     virtual void set_leaf_sequence(int level = 1);
00127 
00128     virtual unsigned int width();
00129 
00130     virtual void intern_data(const string &dataset, ConstraintEvaluator &eval,
00131                              DDS &dds);
00132     virtual bool serialize(const string &dataset, ConstraintEvaluator &eval,
00133                            DDS &dds, Marshaller &m, bool ce_eval = true);
00134     virtual bool deserialize(UnMarshaller &um, DDS *dds, bool reuse = false);
00135 
00136     // Do not store values in memory as for C; force users to work with the
00137     // C++ objects as defined by the DAP.
00138 
00139     virtual unsigned int val2buf(void *val, bool reuse = false);
00140     virtual unsigned int buf2val(void **val);
00141 
00142     virtual BaseType *var(const string &name, bool exact_match = true,
00143                           btp_stack *s = 0);
00144 
00145     virtual BaseType *var(const string &n, btp_stack &s);
00146 
00147     virtual void add_var(BaseType *bt, Part part = nil);
00148 
00149     virtual bool read(const string &dataset) ;
00150 
00151     virtual void print_val(FILE *out, string space = "",
00152                            bool print_decl_p = true);
00153     virtual void print_val(ostream &out, string space = "",
00154                            bool print_decl_p = true);
00155 
00156     virtual bool check_semantics(string &msg, bool all = false);
00157 
00158     virtual void dump(ostream &strm) const ;
00159 };
00160 
00161 } // namespace libdap
00162 
00163 #endif // _structure_h

Generated on Tue Jun 10 18:00:31 2008 for libdap++ by  doxygen 1.5.4