bes  Updated for version 3.20.6
HDF5PathFinder.cc
Go to the documentation of this file.
1 // This file is part of hdf5_handler a HDF5 file handler for the OPeNDAP
2 // data server.
3 
4 // Copyright (c) 2007-2016 The HDF Group, Inc. and OPeNDAP, Inc.
5 //
6 // This is free software; you can redistribute it and/or modify it under the
7 // terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 2.1 of the License, or (at your
9 // option) any later version.
10 //
11 // This software is distributed in the hope that it will be useful, but
12 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 // License for more details.
15 //
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 //
20 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
21 // You can contact The HDF Group, Inc. at 1800 South Oak Street,
22 // Suite 203, Champaign, IL 61820
23 
33 
34 // #define DODS_DEBUG
35 #include "BESDebug.h"
36 #include "HDF5PathFinder.h"
37 
38 using namespace std;
39 
40 HDF5PathFinder::HDF5PathFinder()
41 {
42 }
43 
44 HDF5PathFinder::~HDF5PathFinder()
45 {
46 
47 }
48 
49 
50 bool HDF5PathFinder::add(string id, const string name)
51 {
52  BESDEBUG("h5", ">add(): id is:" << id << " name is:" << name << endl);
53  if (!visited(id)) {
54 
55  id_to_name_map[id] = name;
56  return true;
57  } else {
58  BESDEBUG("h5", "=add(): already added." << endl);
59  return false;
60  }
61 }
62 
63 
64 bool HDF5PathFinder::visited(string id)
65 {
66  string str = id_to_name_map[id];
67  if (!str.empty()) {
68  return true;
69  } else {
70  return false;
71  }
72 }
73 
74 string HDF5PathFinder::get_name(string id)
75 {
76  return id_to_name_map[id];
77 }
HDF5PathFinder::add
bool add(std::string id, const std::string name)
Definition: HDF5PathFinder.cc:50
HDF5PathFinder::get_name
std::string get_name(std::string id)
Definition: HDF5PathFinder.cc:74
HDF5PathFinder.h
This class is to find and break a cycle in the HDF5 group. It is used to handle the rara case for the...
HDF5PathFinder::visited
bool visited(std::string id)
Definition: HDF5PathFinder.cc:64