bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESCatalogEntry.h
1// BESCatalogEntry.h
2
3// This file is part of bes, A C++ back-end server implementation framework
4// for the OPeNDAP Data Access Protocol.
5
6// Copyright (c) 2004-2009 University Corporation for Atmospheric Research
7// Author: Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
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 University Corporation for Atmospheric Research at
24// 3080 Center Green Drive, Boulder, CO 80301
25
26// (c) COPYRIGHT University Corporation for Atmospheric Research 2004-2005
27// Please read the full copyright statement in the file COPYRIGHT_UCAR.
28//
29// Authors:
30// pwest Patrick West <pwest@ucar.edu>
31// jgarcia Jose Garcia <jgarcia@ucar.edu>
32
33#ifndef I_BESCatalogEntry_h
34#define I_BESCatalogEntry_h 1
35
36#include <string>
37#include <list>
38#include <map>
39#include <sys/types.h>
40
41#include "BESObj.h"
42
46class BESCatalogEntry: public BESObj {
47private:
48 std::string _name;
49 std::string _catalog;
50 std::string _size;
51 std::string _mod_date;
52 std::string _mod_time;
53 std::list<std::string> _services;
54
55 std::map<std::string, BESCatalogEntry *> _entry_list;
56 std::map<std::string, std::string> _metadata;
57
58 BESCatalogEntry()
59 {
60 }
61
62public:
63 BESCatalogEntry(const std::string &name, const std::string &catalog);
64 virtual ~BESCatalogEntry(void);
65
66 virtual void add_entry(BESCatalogEntry *entry)
67 {
68 if (entry) {
69 _entry_list[entry->get_name()] = entry;
70 }
71 }
72
73 virtual std::string get_name()
74 {
75 return _name;
76 }
77
78 virtual std::string get_catalog()
79 {
80 return _catalog;
81 }
82
83 virtual bool is_collection()
84 {
85 return (get_count() > 0);
86 }
87
88 virtual std::string get_size()
89 {
90 return _size;
91 }
92
93 virtual void set_size(off_t size);
94
95 virtual std::string get_mod_date()
96 {
97 return _mod_date;
98 }
99
100 virtual void set_mod_date(const std::string &mod_date)
101 {
102 _mod_date = mod_date;
103 }
104
105 virtual std::string get_mod_time()
106 {
107 return _mod_time;
108 }
109
110 virtual void set_mod_time(const std::string &mod_time)
111 {
112 _mod_time = mod_time;
113 }
114
115 virtual std::list<std::string> get_service_list()
116 {
117 return _services;
118 }
119
120 virtual void set_service_list(std::list<std::string> &slist)
121 {
122 _services = slist;
123 }
124
125 virtual unsigned int get_count()
126 {
127 return _entry_list.size();
128 }
129
130 virtual std::map<std::string, std::string> get_info()
131 {
132 return _metadata;
133 }
134
135 virtual void add_info(const std::string &name, const std::string &value)
136 {
137 _metadata[name] = value;
138 }
139
140 typedef std::map<std::string, BESCatalogEntry *>::const_iterator catalog_citer;
141
142 virtual catalog_citer get_beginning_entry()
143 {
144 return _entry_list.begin();
145 }
146
147 virtual catalog_citer get_ending_entry()
148 {
149 return _entry_list.end();
150 }
151
152 virtual void dump(std::ostream &strm) const;
153};
154
155#endif // I_BESCatalogEntry_h
virtual void dump(std::ostream &strm) const
dumps information about this object
top level BES object to house generic methods
Definition BESObj.h:54