NANDRAD Data Model Library  Version 2.0
NANDRAD
NANDRAD::IDGroup Class Reference

Detailed Description

An IDGroup references one or more IDs and handles the encoding/decoding of an IDGroup-string.

// supported encodings
string severalIDs = "16,20,22";
string allIDs = "*";
string idInterval = "5-10,50-60";
string mixedIDs = "1,3,55,5-10";
// decode with IDGroup
IDGroup grp;
grp.setEncodedString(severalIDs);
// encode string
grp.encodedString();

Definition at line 47 of file NANDRAD_IDGroup.h.

#include <NANDRAD_IDGroup.h>

Public Member Functions

void setEncodedString (const std::string &encodedString)
 Set ID group data from an encoded string. More...
 
std::string encodedString () const
 Encode ID group data into a string representation. More...
 
bool empty () const
 Returns true if neither the wildcard flag m_allIDs is set, nor any IDs are specified in m_ids or m_idIntervals. More...
 
bool contains (unsigned int id) const
 Returns true if either the wildcard flag m_allIDs is set, or the id is in m_ids or enclosed in m_idIntervals.
 
const IDGroup operator+ (const IDGroup &)
 Merges two id groups. More...
 
bool operator== (const IDGroup &other) const
 Comparison operator by value. More...
 
bool operator!= (const IDGroup &other) const
 Not-equal comparison operator by value. More...
 

Public Attributes

bool m_allIDs = false
 If true, the encoded string containted a wildcard character * to indicate all IDs. More...
 
std::set< unsigned int > m_ids
 Set of individually listed IDs. More...
 
std::vector< std::pair< unsigned int, unsigned int > > m_idIntervals
 Model id intervals. More...
 

Member Function Documentation

◆ setEncodedString()

void NANDRAD::IDGroup::setEncodedString ( const std::string &  encodedString)

Set ID group data from an encoded string.

This function throws an exception, if an invalid format is encountered or IDs are specified in addition to a wildcard character.

◆ encodedString()

std::string NANDRAD::IDGroup::encodedString ( ) const

Encode ID group data into a string representation.

◆ empty()

bool NANDRAD::IDGroup::empty ( ) const

Returns true if neither the wildcard flag m_allIDs is set, nor any IDs are specified in m_ids or m_idIntervals.

◆ operator+()

const IDGroup NANDRAD::IDGroup::operator+ ( const IDGroup )

Merges two id groups.

◆ operator==()

bool NANDRAD::IDGroup::operator== ( const IDGroup other) const
inline

Comparison operator by value.

Definition at line 72 of file NANDRAD_IDGroup.h.

◆ operator!=()

bool NANDRAD::IDGroup::operator!= ( const IDGroup other) const

Not-equal comparison operator by value.

Member Data Documentation

◆ m_allIDs

bool NANDRAD::IDGroup::m_allIDs = false

If true, the encoded string containted a wildcard character * to indicate all IDs.

Warning
A wildcard overrides all other IDs.

Definition at line 82 of file NANDRAD_IDGroup.h.

◆ m_ids

std::set<unsigned int> NANDRAD::IDGroup::m_ids

Set of individually listed IDs.

Definition at line 84 of file NANDRAD_IDGroup.h.

◆ m_idIntervals

std::vector<std::pair<unsigned int, unsigned int> > NANDRAD::IDGroup::m_idIntervals

Model id intervals.

Definition at line 86 of file NANDRAD_IDGroup.h.


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