ODIMPathTools.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25  */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30  */
31 
32 #ifndef ODIMPATH_TOOLS_H_
33 #define ODIMPATH_TOOLS_H_
34 
35 #include <set>
36 #include <list>
37 #include <map>
38 #include <stdexcept>
39 
40 #include <drain/util/BeanLike.h>
41 #include <drain/util/Range.h>
42 //#include <drain/util/ReferenceMap.h>
43 //#include <drain/util/RegExp.h>
44 //#include <drain/util/Sprinter.h>
45 
46 //#include <drain/util/Variable.h>
47 #include "ODIM.h"
48 #include "PolarODIM.h" // elangle
49 
50 #include "ODIMPathMatcher.h"
51 
52 
53 namespace rack {
54 
55 
56 
57 
59 
63 
64 public:
65 
67  static
68  bool getLastChild(const Hi5Tree & tree, ODIMPathElem & child, bool create = false); //, (ODIMPathElem::group_t g = ODIMPathElem::NONE);
69 
71 
74  static
75  bool getNewChild(const Hi5Tree & tree, ODIMPathElem & child, ODIMPathElem::index_t iMax=ODIMPathElem::INDEX_MAX);
76 
78 
83  static
84  bool getNextChild(const Hi5Tree & tree, ODIMPathElem & child);
85 
86 
88 
91  static
92  bool getChildren(const Hi5Tree & tree, std::map<std::string,ODIMPathElem> & children, ODIMPathElem::group_t groups);
93 
94 };
95 
96 
97 } // rack::
98 
99 #endif /* DATASELECTOR_H_ */
Definition: ODIMPath.h:82
drain::Flagger::ivalue_t group_t
In H5, "groups" correspond to "directories" or "folders" in Unix and Windows.
Definition: ODIMPath.h:91
Tool for selecting datasets based on paths, quantities and min/max elevations.
Definition: ODIMPathTools.h:62
static bool getNextChild(const Hi5Tree &tree, ODIMPathElem &child)
Derive a child with index one greater than the largest index encountered.
Definition: ODIMPathTools.cpp:96
static bool getChildren(const Hi5Tree &tree, std::map< std::string, ODIMPathElem > &children, ODIMPathElem::group_t groups)
Searches children of given type, returns a non-existing child with index greater than child....
Definition: ODIMPathTools.cpp:120
static bool getLastChild(const Hi5Tree &tree, ODIMPathElem &child, bool create=false)
Searches the children of child.getType(), or g if given, and stores the one with largest index.
Definition: ODIMPathTools.cpp:44
static bool getNewChild(const Hi5Tree &tree, ODIMPathElem &child, ODIMPathElem::index_t iMax=ODIMPathElem::INDEX_MAX)
Searches children of given type, returns a non-existing child with index greater than child....
Definition: ODIMPathTools.cpp:72
Definition: DataSelector.cpp:44