bes  Updated for version 3.20.6
BESCatalog.h
1 // BESCatalog.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_BESCatalog_h
34 #define I_BESCatalog_h 1
35 
36 #include <string>
37 
38 #include "BESObj.h"
39 
40 class BESCatalogEntry;
41 class BESCatalogUtils;
42 
43 namespace bes {
44  class CatalogNode;
45  // TODO class CatalogUtils;
46 }
47 
51 class BESCatalog: public BESObj {
52 private:
53  std::string d_catalog_name;
54  unsigned int d_reference;
55 
56  BESCatalogUtils *d_utils;
57 
58  BESCatalog();
59 
60 public:
61  BESCatalog(const std::string &catalog_name);
62 
63  virtual ~BESCatalog();
64 #if 0
65  {
66  // TODO delete d_utils when it's no longer a singleton.
67  // Or leave that class as the weird singleton it is and treat this
68  // as a weak pointer. jhrg 7/21/18
69  }
70 #endif
71 
81  virtual void reference_catalog()
82  {
83  d_reference++;
84  }
85 
92  virtual unsigned int dereference_catalog()
93  {
94  if (!d_reference)
95  return d_reference;
96  return --d_reference;
97  }
98 
103  virtual std::string get_catalog_name() const
104  {
105  return d_catalog_name;
106  }
107 
113  virtual BESCatalogUtils *get_catalog_utils() const { return d_utils; }
114 
118  virtual BESCatalogEntry *show_catalog(const std::string &container, BESCatalogEntry *entry) = 0;
119 
128  virtual std::string get_root() const = 0;
129 
130  // Based on other code (show_catalogs()), use BESCatalogUtils::exclude() on
131  // a directory, but BESCatalogUtils::include() on a file).
132  virtual bes::CatalogNode *get_node(const std::string &path) const = 0;
133 
134  virtual void get_site_map(const std::string &prefix, const std::string &node_suffix, const std::string &leaf_suffix, std::ostream &out,
135  const std::string &path = "/") const = 0;
136 
137  virtual void dump(std::ostream &strm) const = 0;
138 };
139 
140 #endif // I_BESCatalog_h
BESCatalog::show_catalog
virtual BESCatalogEntry * show_catalog(const std::string &container, BESCatalogEntry *entry)=0
BESCatalog::dereference_catalog
virtual unsigned int dereference_catalog()
Decrement the count of clients that reference this catalog.
Definition: BESCatalog.h:92
BESCatalogUtils
Definition: BESCatalogUtils.h:61
BESCatalog::get_catalog_name
virtual std::string get_catalog_name() const
Get the name for this catalog.
Definition: BESCatalog.h:103
BESCatalog::dump
virtual void dump(std::ostream &strm) const =0
dump the contents of this object to the specified ostream
BESObj
top level BES object to house generic methods
Definition: BESObj.h:49
bes::CatalogNode
Definition: CatalogNode.h:45
BESCatalog::get_catalog_utils
virtual BESCatalogUtils * get_catalog_utils() const
Get a pointer to the utilities, customized for this catalog.
Definition: BESCatalog.h:113
BESCatalogEntry
Definition: BESCatalogEntry.h:46
BESCatalog::get_root
virtual std::string get_root() const =0
BESCatalog
Catalogs provide a hierarchical organization for data.
Definition: BESCatalog.h:51
BESCatalog::reference_catalog
virtual void reference_catalog()
Increase the count of clients that reference this catalog.
Definition: BESCatalog.h:81