HOPS
HOPS class reference
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
hops::MHO_IntervalLabelInterface Class Reference

Class MHO_IntervalLabelInterface - adds intervals with associated key:value pairs (used by MHO_Axis) constructor is protected this class is only intended to provide an interface that derived classes may inherit this interface is to enforce a specific access pattern associated with modifying meta data attached to a vector/axis like object that is in the form of a mho_json::array_t. More...

#include <MHO_IntervalLabelInterface.hh>

Inheritance diagram for hops::MHO_IntervalLabelInterface:
[legend]

Public Member Functions

virtual ~MHO_IntervalLabelInterface ()
 
void ClearIntervalLabels ()
 Clears interval labels by setting *fIntervalLabelObjectPtr to an empty json object. More...
 
bool ExtractIndexesFromKey (const std::string &key, std::size_t &lower_index, std::size_t &upper_index)
 Extracts lower and upper indexes from a key string separated by comma. More...
 
template<typename XLabelValueType >
mho_json GetFirstIntervalWithKeyValue (std::string key, const XLabelValueType &value) const
 Getter for first interval with key value. More...
 
mho_jsonGetIntervalLabelObject (std::size_t lower_index, std::size_t upper_index)
 Get a reference to the dictionary object associated with this index. More...
 
std::vector< mho_jsonGetMatchingIntervalLabels (std::string key) const
 get a vector of interval labels which contain a key with the same name More...
 
template<typename XValueType >
void InsertIntervalLabelKeyValue (std::size_t lower_index, std::size_t upper_index, const std::string &key, const XValueType &value)
 Inserts an interval label key-value pair into a map referenced by fIntervalLabelObjectPtr. More...
 
template<typename XValueType >
bool RetrieveIntervalLabelKeyValue (std::size_t lower_index, std::size_t upper_index, const std::string &key, const XValueType &value) const
 Retrieves a value associated with a key within an interval range. More...
 
void SetIntervalLabelObject (mho_json &obj, std::size_t lower_index, std::size_t upper_index)
 Setter for interval label object. More...
 

Static Public Member Functions

static std::string ConstructKey (std::size_t lower_index, std::size_t upper_index)
 Constructs a key string from lower and upper indices, ensuring lower_index <= upper_index. More...
 
static std::pair< std::size_t, std::size_t > ExtractIndexesFromKey (const std::string &key)
 Extracts lower and upper indexes from a key string separated by comma. More...
 

Protected Member Functions

 MHO_IntervalLabelInterface ()
 
 MHO_IntervalLabelInterface (const MHO_IntervalLabelInterface &copy)
 
void SetIntervalLabelObject (mho_json *obj)
 Setter for interval label object. More...
 

Detailed Description

Class MHO_IntervalLabelInterface - adds intervals with associated key:value pairs (used by MHO_Axis) constructor is protected this class is only intended to provide an interface that derived classes may inherit this interface is to enforce a specific access pattern associated with modifying meta data attached to a vector/axis like object that is in the form of a mho_json::array_t.

Date
Sun Feb 4 17:21:38 2024 -0500
Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du

Constructor & Destructor Documentation

◆ MHO_IntervalLabelInterface() [1/2]

hops::MHO_IntervalLabelInterface::MHO_IntervalLabelInterface ( )
inlineprotected

◆ MHO_IntervalLabelInterface() [2/2]

hops::MHO_IntervalLabelInterface::MHO_IntervalLabelInterface ( const MHO_IntervalLabelInterface copy)
inlineprotected

◆ ~MHO_IntervalLabelInterface()

virtual hops::MHO_IntervalLabelInterface::~MHO_IntervalLabelInterface ( )
inlinevirtual

Member Function Documentation

◆ ClearIntervalLabels()

void hops::MHO_IntervalLabelInterface::ClearIntervalLabels ( )
inline

Clears interval labels by setting *fIntervalLabelObjectPtr to an empty json object.

◆ ConstructKey()

static std::string hops::MHO_IntervalLabelInterface::ConstructKey ( std::size_t  lower_index,
std::size_t  upper_index 
)
inlinestatic

Constructs a key string from lower and upper indices, ensuring lower_index <= upper_index.

Parameters
lower_indexLower index value (must be less than or equal to upper_index)
upper_indexUpper index value
Returns
String representation of the sorted pair of indices separated by a comma
Note
This is a static function.

◆ ExtractIndexesFromKey() [1/2]

static std::pair< std::size_t, std::size_t > hops::MHO_IntervalLabelInterface::ExtractIndexesFromKey ( const std::string &  key)
inlinestatic

Extracts lower and upper indexes from a key string separated by comma.

Parameters
keyInput key string containing two indexes separated by comma.
Returns
True if extraction is successful, false otherwise.
Note
This is a static function.

◆ ExtractIndexesFromKey() [2/2]

bool hops::MHO_IntervalLabelInterface::ExtractIndexesFromKey ( const std::string &  key,
std::size_t &  lower_index,
std::size_t &  upper_index 
)
inline

Extracts lower and upper indexes from a key string separated by comma.

Parameters
keyInput key string containing two indexes separated by comma.
lower_index(std::size_t&)
upper_index(std::size_t&)
Returns
True if extraction is successful, false otherwise.

◆ GetFirstIntervalWithKeyValue()

template<typename XLabelValueType >
mho_json hops::MHO_IntervalLabelInterface::GetFirstIntervalWithKeyValue ( std::string  key,
const XLabelValueType &  value 
) const
inline

Getter for first interval with key value.

Template Parameters
XLabelValueTypeTemplate parameter XLabelValueType
Parameters
keyKey to search for in interval labels
valueValue associated with the key to match
Returns
First matching mho_json object or empty if none found

◆ GetIntervalLabelObject()

mho_json& hops::MHO_IntervalLabelInterface::GetIntervalLabelObject ( std::size_t  lower_index,
std::size_t  upper_index 
)
inline

Get a reference to the dictionary object associated with this index.

Parameters
lower_indexLower index for interval
upper_indexUpper index for interval
Returns
Reference to mho_json object if exists, else dummy object

◆ GetMatchingIntervalLabels()

std::vector< mho_json > hops::MHO_IntervalLabelInterface::GetMatchingIntervalLabels ( std::string  key) const
inline

get a vector of interval labels which contain a key with the same name

Parameters
keyKey to search for within interval labels
Returns
Vector of matching mho_json objects

◆ InsertIntervalLabelKeyValue()

template<typename XValueType >
void hops::MHO_IntervalLabelInterface::InsertIntervalLabelKeyValue ( std::size_t  lower_index,
std::size_t  upper_index,
const std::string &  key,
const XValueType &  value 
)
inline

Inserts an interval label key-value pair into a map referenced by fIntervalLabelObjectPtr.

Template Parameters
XValueTypeTemplate parameter XValueType
Parameters
lower_indexLower bound index for the interval
upper_indexUpper bound index for the interval
keyKey string for the value to be inserted
valueValue associated with the given key

◆ RetrieveIntervalLabelKeyValue()

template<typename XValueType >
bool hops::MHO_IntervalLabelInterface::RetrieveIntervalLabelKeyValue ( std::size_t  lower_index,
std::size_t  upper_index,
const std::string &  key,
const XValueType &  value 
) const
inline

Retrieves a value associated with a key within an interval range.

Template Parameters
XValueTypeTemplate parameter XValueType
Parameters
lower_indexLower bound index for the interval.
upper_indexUpper bound index for the interval.
keyKey to search for in the interval's label object.
valueReference to store the retrieved value.
Returns
True if retrieval was successful, false otherwise.

◆ SetIntervalLabelObject() [1/2]

void hops::MHO_IntervalLabelInterface::SetIntervalLabelObject ( mho_json obj,
std::size_t  lower_index,
std::size_t  upper_index 
)
inline

Setter for interval label object.

Parameters
objReference to mho_json object containing metadata
lower_indexLower index of interval
upper_indexUpper index of interval

◆ SetIntervalLabelObject() [2/2]

void hops::MHO_IntervalLabelInterface::SetIntervalLabelObject ( mho_json obj)
inlineprotected

Setter for interval label object.

Parameters
objInput mho_json object to set as interval label object

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