bes  Updated for version 3.20.6
FoInstanceJsonTransform.h
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 <BESObj.h>
37 
38 namespace libdap {
39 class BaseType;
40 class DDS;
41 class Array;
42 }
43 
45 
46 
55 private:
56  libdap::DDS *_dds;
57  // std::string _localfile;
58  std::string _returnAs;
59  std::string _indent_increment;
60 
61  // std::ostream *_ostrm;
62 
63  template<typename T> unsigned int json_simple_type_array_worker(std::ostream *strm, const std::vector<T> &values,
64  unsigned int indx, const std::vector<unsigned int> &shape, unsigned int currentDim);
65 
66  template<typename T> void json_simple_type_array(std::ostream *strm, libdap::Array *a, std::string indent,
67  bool sendData);
68  void json_string_array(std::ostream *strm, libdap::Array *a, std::string indent, bool sendData);
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(std::ostream &ostrm, bool sendData);
87 
88  virtual void dump(std::ostream &strm) const;
89 };
90 
91 #endif // FoInstanceJsonTransfrom_h_
92 
FoInstanceJsonTransform::dump
virtual void dump(std::ostream &strm) const
dumps information about this transformation object for debugging purposes
Definition: FoInstanceJsonTransform.cc:235
FoInstanceJsonTransform::FoInstanceJsonTransform
FoInstanceJsonTransform(libdap::DDS *dds)
Constructor that creates transformation object from the specified DataDDS object to the specified fil...
Definition: FoInstanceJsonTransform.cc:221
libdap
Definition: BESDapFunctionResponseCache.h:35
BESObj
top level BES object to house generic methods
Definition: BESObj.h:49
FoInstanceJsonTransform
Transforms a DDS into JSON document on disk.
Definition: FoInstanceJsonTransform.h:54
BESDataHandlerInterface
Structure storing information used by the BES to handle the request.
Definition: BESDataHandlerInterface.h:56