Public Types | Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ODIMPathElemMatcher Class Reference

Element in a chain in testing a path for a match. More...

#include <ODIMPathMatcher.h>

Inheritance diagram for ODIMPathElemMatcher:
Inheritance graph
[legend]
Collaboration diagram for ODIMPathElemMatcher:
Collaboration graph
[legend]

Public Types

typedef drain::Range< index_t > idx_range_t
 
- Public Types inherited from ODIMPathElem
typedef drain::Flagger flag_t
 
typedef drain::Flagger::dict_t dict_t
 
typedef drain::Flagger::ivalue_t group_t
 In H5, "groups" correspond to "directories" or "folders" in Unix and Windows.
 
typedef int index_t
 

Public Member Functions

 ODIMPathElemMatcher (ODIMPathElem::group_t groups=ROOT, index_t index=0, index_t indexMax=INDEX_MAX)
 
 ODIMPathElemMatcher (const ODIMPathElemMatcher &e)
 
 ODIMPathElemMatcher (const ODIMPathElem &e)
 
 ODIMPathElemMatcher (const std::string &s)
 
virtual void set (const std::string &s)
 Assign a string to this path element. More...
 
bool isSingle () const
 
ODIMPathElemMatcheroperator= (ODIMPathElem::group_t g)
 
ODIMPathElemMatcheroperator= (const std::string &s)
 
bool test (const ODIMPathElem &elem) const
 Test if the elem has the same group, and elem.index is within [index,indexMax].
 
virtual std::ostream & toStream (std::ostream &sstr) const
 For string presentation. More...
 
- Public Member Functions inherited from ODIMPathElem
 ODIMPathElem (group_t group=ROOT, index_t index=1)
 
 ODIMPathElem (const ODIMPathElem &e)
 
 ODIMPathElem (const std::string &s)
 
 ODIMPathElem (const char *s)
 
void reset ()
 
template<class T >
ODIMPathElemoperator= (const T &s)
 Redirects to set(const std::string &) . More...
 
ODIMPathElemoperator= (const char *s)
 Calls set(const std::string &) . More...
 
virtual void set (group_t g, index_t i=0)
 The fundamental assignment operator. More...
 
bool is (group_t g) const
 Abbreviation of (group == NONE)
 
bool isRoot () const
 Abbreviation of (group == ROOT)
 
bool empty () const
 Equivalent to isRoot(). This method is required in recognizing the leading empty string. Consider "/usr/include".
 
bool isIndexed () const
 Abbreviation of (group == NONE) More...
 
bool belongsTo (int groupFilter) const
 Checks if the element belongs to any of groups given.
 
group_t getType () const
 
index_t getIndex () const
 
const std::string & getPrefix () const
 Returns the name without the index.
 
char getCharCode () const
 
const std::string & getKey () const
 Debugging/logging. Returns standard name. Does not check if type is OTHER.
 
const std::string & str () const
 Writes the name, including the index, to output stream.
 
 operator const std::string & () const
 
template<>
void extractIndex (const std::string &s, ODIMPathElem::index_t &idx)
 
template<>
void extractIndex (const std::string &s, ODIMPathElemMatcher::idx_range_t &idx)
 

Public Attributes

index_t indexMax
 
drain::Flagger flags
 
- Public Attributes inherited from ODIMPathElem
group_t group
 
index_t index
 

Protected Member Functions

virtual void extractIndex (const std::string &s)
 Extracts index range of type <index>[:<indexMax>].
 
virtual bool extractPrefix (const std::string &s, bool indexed)
 Given the non-numeric prefix of a group, like "dataset" or "data", set the group. More...
 
- Protected Member Functions inherited from ODIMPathElem
void add (const std::string &s)
 

Additional Inherited Members

- Static Public Member Functions inherited from ODIMPathElem
static bool isIndexed (group_t group)
 
static bool isQuality (group_t group)
 
static const dict_tgetDictionary ()
 
static const std::string & getKey (group_t g)
 Debugging/logging. Returns standard name. Does not check if type is OTHER.
 
- Static Public Attributes inherited from ODIMPathElem
static const group_t NONE = 0
 None (undefined)
 
static const group_t ROOT = 1
 
static const group_t DATASET = 2
 First level group, /dataset + digit .
 
static const group_t DATA = 4
 Second level group, /data + digit .
 
static const group_t ARRAY = 8
 Data group "data", at deepest level, like /dataset4/data2/quality1/data.
 
static const group_t QUALITY = 16
 Special group on first or second level, /quality + digit , used for storing quality data.
 
static const group_t DATA_GROUPS = DATASET | DATA | QUALITY
 Group index mask for groups under which data arrays (ARRAY type) are found.
 
static const group_t ALL_LEVELS = (ROOT | DATASET | DATA)
 Abbreviation for linking (referencing) attributes at different levels (tree depths).
 
static const group_t WHAT = 32
 Metadata group /what , at any depth.
 
static const group_t WHERE = 64
 Metadata group /where , at any depth.
 
static const group_t HOW = 128
 Metadata group /how , at any depth.
 
static const group_t ATTRIBUTE_GROUPS = WHAT|WHERE|HOW
 Group index mask for groups that contain only meta data.
 
static const group_t ALL_GROUPS = 255
 User defined group, name stored as a separate string. Index allowed, but only catenated in the string.
 
static const group_t PALETTE = 256
 Palette data (to be linked). EXPERIMENTAL.
 
static const group_t LEGEND = 512
 Metadata array describing values in the image data (DATA). EXPERIMENTAL.
 
static const group_t OTHER = 1024
 User defined group, name stored as a separate string. The string may still contain numbers, but no indices will be extracted. More...
 
static const group_t IS_INDEXED = (DATASET | DATA | QUALITY )
 Group index mask for groups that have an index.
 
static const index_t INDEX_MAX = std::numeric_limits<unsigned short int>::max()
 
- Static Protected Member Functions inherited from ODIMPathElem
template<class T >
static void extractIndex (const std::string &s, T &idx)
 
- Protected Attributes inherited from ODIMPathElem
std::string currentStr
 

Detailed Description

Element in a chain in testing a path for a match.

Member Function Documentation

◆ extractPrefix()

bool extractPrefix ( const std::string &  s,
bool  indexed 
)
protectedvirtual

Given the non-numeric prefix of a group, like "dataset" or "data", set the group.

Check first if prefix AND index match.

Reimplemented from ODIMPathElem.

◆ set()

void set ( const std::string &  s)
virtual

Assign a string to this path element.

Parameters
s- path element as a string, "dataset4" for example

Note that path separator is not recognized; instead, it will be assigned as a part of the string.

Returns
- true if a valid ODIM path element was created

Reimplemented from ODIMPathElem.

◆ toStream()

std::ostream & toStream ( std::ostream &  sstr) const
virtual

For string presentation.

Step 1: prefix (by group type)

Step 2: index

Reimplemented from ODIMPathElem.


The documentation for this class was generated from the following files: