bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
DmrppMetadataStore.h
1// -*- mode: c++; c-basic-offset:4 -*-
2
3// This file is part of Hyrax, A C++ implementation of the OPeNDAP Data
4// Access Protocol.
5
6// Copyright (c) 2018 OPeNDAP, Inc.
7// Author: James Gallagher <jgallagher@opendap.org>
8//
9// This library is free software; you can redistribute it and/or
10// modify it under the terms of the GNU Lesser General Public
11// License as published by the Free Software Foundation; either
12// version 2.1 of the License, or (at your option) any later version.
13//
14// This library is distributed in the hope that it will be useful,
15// but WITHOUT ANY WARRANTY; without even the implied warranty of
16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17// Lesser General Public License for more details.
18//
19// You should have received a copy of the GNU Lesser General Public
20// License along with this library; if not, write to the Free Software
21// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22//
23// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
24
25#ifndef _dmrpp_metadata_store_h
26#define _dmrpp_metadata_store_h
27
28#include <string>
29//#include <functional>
30
31#include "GlobalMetadataStore.h"
32
33//#include "DMRpp.h"
34
35namespace libdap {
36class DMR;
37}
38
39namespace dmrpp {
40class DMRpp;
41}
42
43namespace bes {
44
83class DmrppMetadataStore: public GlobalMetadataStore {
84private:
85 static bool d_enabled;
86 static DmrppMetadataStore *d_instance;
87
88 // Called by atexit()
89 static void delete_instance() {
90 delete d_instance;
91 d_instance = 0;
92 }
93
94 friend class DmrppMetadataStoreTest;
95
96protected:
98 struct StreamDMRpp : public StreamDAP {
99 StreamDMRpp(libdap::DMR *dmrpp) : StreamDAP(dmrpp) {}
100 // Use the DMR to write the DMR++ when the DMR has variables of the correct
101 // type. Look for this by checking the type of the object at runtime.
102 virtual void operator()(std::ostream &os);
103 };
104
105 DmrppMetadataStore(const DmrppMetadataStore &src) : bes::GlobalMetadataStore(src) { }
106
107 // Only get_instance() should be used to instantiate this class
109 DmrppMetadataStore(const std::string &cache_dir, const std::string &prefix, unsigned long long size) :
110 bes::GlobalMetadataStore(cache_dir, prefix, size) { }
111
112public:
113 static DmrppMetadataStore *get_instance(const std::string &cache_dir, const std::string &prefix, unsigned long long size);
114 static DmrppMetadataStore *get_instance();
115
116 virtual ~DmrppMetadataStore()
117 {
118 }
119
120 virtual bool add_responses(libdap::DMR *dmrpp, const std::string &name);
121 virtual bool add_dmrpp_response(libdap::DMR *dmrpp, const std::string &name);
122
123 virtual libdap::DMR *get_dmr_object(const string &name);
124
125 virtual dmrpp::DMRpp *get_dmrpp_object(const std::string &name);
126};
127
128} // namespace bes
129
130#endif // _dmrpp_metadata_store_h
Store the DAP DMR++ metadata responses.
virtual bool add_responses(libdap::DMR *dmrpp, const std::string &name)
Add the DAP4 metadata responses using a DMR.
virtual libdap::DMR * get_dmr_object(const string &name)
Use the DMR response to build a DMR with Dmrpp Types.
static DmrppMetadataStore * get_instance()
virtual dmrpp::DMRpp * get_dmrpp_object(const std::string &name)
Build a DMR++ object from the cached Response.
Store the DAP metadata responses.
Provide a way to print the DMR++ response.
Definition DMRpp.h:44