bes  Updated for version 3.20.6
Granule.h
1 // -*- mode: c++; c-basic-offset:4 -*-
2 
3 // This file is part of cmr_module, A C++ MODULE that can be loaded in to
4 // the OPeNDAP Back-End Server (BES) and is able to handle remote requests.
5 
6 // Copyright (c) 2015 OPeNDAP, Inc.
7 // Author: Nathan Potter <ndp@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 /*
26  * Granule.h
27  *
28  * Created on: July, 14 2018
29  * Author: ndp
30  */
31 #ifndef MODULES_CMR_MODULE_GRANULE_H_
32 #define MODULES_CMR_MODULE_GRANULE_H_
33 
34 #include <string>
35 #include <vector>
36 #include "rapidjson/document.h"
37 #include "CatalogItem.h"
38 #include "BESCatalogUtils.h"
39 
40 
41 namespace cmr {
42 
43 class Granule {
44 private:
45  const rapidjson::Value& get_links_array(const rapidjson::Value& go);
46 
47  std::string d_name;
48  std::string d_id;
49  std::string d_data_access_url;
50  std::string d_metadata_access_url;
51  std::string d_size_str;
52  std::string d_last_modified_time;
53 
54  void setName(const rapidjson::Value& granule_obj);
55  void setId(const rapidjson::Value& granule_obj);
56  void setDataAccessUrl(const rapidjson::Value& granule_obj);
57  void setMetadataAccessUrl(const rapidjson::Value& granule_obj);
58  void setSize(const rapidjson::Value& granule_obj);
59  void setLastModifiedStr(const rapidjson::Value& granule_obj);
60 
61 public:
62  Granule(const rapidjson::Value& granule_obj);
63 
64  std::string getName(){ return d_name; }
65  std::string getId(){ return d_id; }
66  std::string getDataAccessUrl() { return d_data_access_url; }
67  std::string getMetadataAccessUrl(){ return d_metadata_access_url; }
68  std::string getSizeStr(){ return d_size_str; }
69  std::string getLastModifiedStr() { return d_last_modified_time; }
70  size_t getSize(){ return atol(getSizeStr().c_str()); }
71 
72  bes::CatalogItem *getCatalogItem(BESCatalogUtils *d_catalog_utils);
73 };
74 
75 } // namespace cmr
76 
77 #endif /* MODULES_CMR_MODULE_GRANULE_H_ */
78 
79 
80 
BESCatalogUtils
Definition: BESCatalogUtils.h:61
cmr::Granule
Definition: Granule.h:43
Value
GenericValue< UTF8<> > Value
GenericValue with UTF8 encoding.
Definition: cmr_module/rapidjson/document.h:2010
bes::CatalogItem
Definition: CatalogItem.h:72