bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
CatalogItem.h
1// -*- mode: c++; c-basic-offset:4 -*-
2
3// This file is part of the OPeNDAP Back-End Server (BES)
4
5// Copyright (c) 2018 OPeNDAP, Inc.
6// Author: James Gallagher <jgallagher@opendap.org>
7//
8// This library is free software; you can redistribute it and/or
9// modify it under the terms of the GNU Lesser General Public
10// License as published by the Free Software Foundation; either
11// version 2.1 of the License, or (at your option) any later version.
12//
13// This library is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16// Lesser General Public License for more details.
17//
18// You should have received a copy of the GNU Lesser General Public
19// License along with this library; if not, write to the Free Software
20// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21//
22// You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
23
24#ifndef I_CatalogItem_h
25#define I_CatalogItem_h 1
26
27#include <string>
28#include <ostream>
29#include <utility>
30
31#include "BESObj.h"
32
33class BESInfo;
34
35namespace bes {
36
37#if 0
38Class Node {
39 Name
40 LMT
41 Item_count (number of nodes or leaves it holds)
42 Items (zero or more Item instances)
43
44 Class Item {
45 Name
46 Size
47 Type (node or leaf)
48 Is_data
49 LMT
50 }
51}
52#endif
53
73class CatalogItem: public BESObj {
74public:
75 enum item_type {unknown, node, leaf};
76
77private:
78 std::string d_name;
79 size_t d_size{0};
80 std::string d_lmt;
81 bool d_is_data{false};
82 item_type d_type;
83 std::string d_description;
84 std::string d_dap_service_url;
85
86 CatalogItem(const CatalogItem &rhs);
87 CatalogItem &operator=(const CatalogItem &rhs);
88
89public:
91 CatalogItem() : d_type(unknown) { }
92
107 CatalogItem(const std::string &name, size_t size, const std::string &lmt, item_type type)
108 : d_name(name), d_size(size), d_lmt(lmt), d_type(type) { }
109
126 CatalogItem(const std::string &name, size_t size, const std::string &lmt, bool is_data, item_type type)
127 : d_name(name), d_size(size), d_lmt(lmt), d_is_data(is_data), d_type(type) { }
128
129 virtual ~CatalogItem() { }
130
132 bool operator() (CatalogItem *i,CatalogItem *j) { return (i->d_name < j->d_name); }
133 };
134
136 std::string get_name() const { return d_name; }
138 void set_name(const std::string &n) { d_name = n; }
139
141 std::string get_description() const { return d_description; }
143 void set_description(const std::string &n) { d_description = n; }
144
146 size_t get_size() const { return d_size; }
148 void set_size(size_t s) { d_size = s; }
149
151 std::string get_lmt() const { return d_lmt; }
153 void set_lmt(const std::string &lmt) { d_lmt = lmt; }
154
156 bool is_data() const { return d_is_data; }
158 void set_is_data(bool id) { d_is_data = id; }
159
161 std::string get_dap_service_url() const { return d_dap_service_url; }
163 void set_dap_service_url( const std::string &url) { d_dap_service_url = url; }
164
166 item_type get_type() const { return d_type; }
168 void set_type(item_type t) { d_type = t; }
169
170 void encode_item(BESInfo *info) const;
171
172 virtual void dump(std::ostream &strm) const;
173};
174
175} // namespace bes
176
177#endif // I_BESCatalogItem_h
informational response object
Definition BESInfo.h:63
top level BES object to house generic methods
Definition BESObj.h:54
void set_description(const std::string &n)
Set the name of the item.
void set_lmt(const std::string &lmt)
Set the LMT for this item.
std::string get_name() const
The name of this item in the node.
bool is_data() const
Is this item recognized as data?
void set_size(size_t s)
Set the size of the item.
void set_is_data(bool id)
Is this item data that the BES should interpret?
void encode_item(BESInfo *info) const
Encode this CatalogItem in an info object.
size_t get_size() const
The size (bytes) of the item.
std::string get_dap_service_url() const
The DAP Dataset URL for an external DAP service.
CatalogItem(const std::string &name, size_t size, const std::string &lmt, item_type type)
Hold information about an item in a BES Catalog.
virtual void dump(std::ostream &strm) const
void set_dap_service_url(const std::string &url)
Is this item data that the BES should interpret?
std::string get_description() const
The descrtiption of this item.
std::string get_lmt() const
Get the last modified time for this item.
item_type get_type() const
Get the type of this item (unknown, node or leaf)
CatalogItem(const std::string &name, size_t size, const std::string &lmt, bool is_data, item_type type)
Hold information about an item in a BES Catalog.
void set_type(item_type t)
Set the type for this item.
void set_name(const std::string &n)
Set the name of the item.
CatalogItem()
Make an empty instance.
Definition CatalogItem.h:91
Type
Type of JSON value.
Definition rapidjson.h:664