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>
|
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_json & | GetIntervalLabelObject (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_json > | GetMatchingIntervalLabels (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 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...
|
|
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
◆ MHO_IntervalLabelInterface() [1/2]
hops::MHO_IntervalLabelInterface::MHO_IntervalLabelInterface |
( |
| ) |
|
|
inlineprotected |
◆ MHO_IntervalLabelInterface() [2/2]
◆ ~MHO_IntervalLabelInterface()
virtual hops::MHO_IntervalLabelInterface::~MHO_IntervalLabelInterface |
( |
| ) |
|
|
inlinevirtual |
◆ 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_index | Lower index value (must be less than or equal to upper_index) |
upper_index | Upper 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
-
key | Input 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
-
key | Input 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
-
XLabelValueType | Template parameter XLabelValueType |
- Parameters
-
key | Key to search for in interval labels |
value | Value 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_index | Lower index for interval |
upper_index | Upper 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
-
key | Key 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
-
XValueType | Template parameter XValueType |
- Parameters
-
lower_index | Lower bound index for the interval |
upper_index | Upper bound index for the interval |
key | Key string for the value to be inserted |
value | Value 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
-
XValueType | Template parameter XValueType |
- Parameters
-
lower_index | Lower bound index for the interval. |
upper_index | Upper bound index for the interval. |
key | Key to search for in the interval's label object. |
value | Reference 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
-
obj | Reference to mho_json object containing metadata |
lower_index | Lower index of interval |
upper_index | Upper index of interval |
◆ SetIntervalLabelObject() [2/2]
void hops::MHO_IntervalLabelInterface::SetIntervalLabelObject |
( |
mho_json * |
obj | ) |
|
|
inlineprotected |
Setter for interval label object.
- Parameters
-
obj | Input mho_json object to set as interval label object |
The documentation for this class was generated from the following file: