OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
FoInstanceJsonTransform.h
Go to the documentation of this file.
1 // -*- mode: c++; c-basic-offset:4 -*-
2 //
3 // FoInstanceJsonTransform.h
4 //
5 // This file is part of BES JSON File Out Module
6 //
7 // Copyright (c) 2014 OPeNDAP, Inc.
8 // Author: Nathan Potter <ndp@opendap.org>
9 //
10 // This library is free software; you can redistribute it and/or
11 // modify it under the terms of the GNU Lesser General Public
12 // License as published by the Free Software Foundation; either
13 // version 2.1 of the License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 //
24 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
25 // (c) COPYRIGHT URI/MIT 1995-1999
26 // Please read the full copyright statement in the file COPYRIGHT_URI.
27 //
28 
29 #ifndef FoInstanceJsonTransfrom_h_
30 #define FoInstanceJsonTransfrom_h_ 1
31 
32 #include <string>
33 #include <vector>
34 #include <map>
35 
36 #include <DDS.h>
37 #include <Array.h>
38 
39 #include <BESObj.h>
41 
50 {
51 private:
52  libdap::DDS *_dds;
53  std::string _localfile;
54  std::string _returnAs;
55  std::string _indent_increment;
56 
57  std::ostream *_ostrm;
58 
59  template<typename T> unsigned int json_simple_type_array_worker(std::ostream *strm, const std::vector<T> &values, unsigned int indx,
60  const std::vector<unsigned int> &shape, unsigned int currentDim);
61 
62  template<typename T> void json_simple_type_array(std::ostream *strm, libdap::Array *a, std::string indent, bool sendData);
63  void json_string_array(std::ostream *strm, libdap::Array *a, std::string indent, bool sendData);
64 
65 #if 0
66  unsigned int json_simple_type_array_worker_string(std::ostream *strm, const vector<std::string> &values,
67  unsigned int indx, std::vector<unsigned int> *shape, unsigned int currentDim);
68 #endif
69 
70  void transformAtomic(std::ostream *strm, libdap::BaseType *bt, std::string indent, bool sendData);
71 
72  void transform(std::ostream *strm, libdap::DDS *dds, std::string indent, bool sendData);
73  void transform(std::ostream *strm, libdap::BaseType *bt, std::string indent, bool sendData);
74  void transform(std::ostream *strm, libdap::Structure *s, std::string indent, bool sendData);
75  void transform(std::ostream *strm, libdap::Grid *g, std::string indent, bool sendData);
76  void transform(std::ostream *strm, libdap::Sequence *s, std::string indent, bool sendData);
77  void transform(std::ostream *strm, libdap::Array *a, std::string indent, bool sendData);
78  void transform(std::ostream *strm, libdap::AttrTable &attr_table, std::string indent);
79 
80 public:
81  FoInstanceJsonTransform(libdap::DDS *dds, BESDataHandlerInterface &dhi, const std::string &localfile);
82  FoInstanceJsonTransform(libdap::DDS *dds, BESDataHandlerInterface &dhi, std::ostream *ostrm);
83 
84  virtual ~FoInstanceJsonTransform();
85 
86  virtual void transform(bool sendData);
87 
88  virtual void dump(std::ostream &strm) const;
89 };
90 
91 #endif // FoInstanceJsonTransfrom_h_
92 
FoInstanceJsonTransform(libdap::DDS *dds, BESDataHandlerInterface &dhi, const std::string &localfile)
Constructor that creates transformation object from the specified DataDDS object to the specified fil...
Transforms a DDS into JSON document on disk.
virtual ~FoInstanceJsonTransform()
Destructor.
Base object for bes objects.
Definition: BESObj.h:52
Structure storing information used by the BES to handle the request.
virtual void dump(std::ostream &strm) const
dumps information about this transformation object for debugging purposes