|
Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
|
Represents an LHA/FLHA block with multiple typed elements. More...
#include <lha_blocks.h>
Public Member Functions | |
| LhaBlock (const Prototype &prototype_) | |
| Constructs an LhaBlock using a specified prototype. | |
| void | readData (const std::vector< std::vector< std::string > > &lines) |
| Reads data and populates the block with elements from raw lines. | |
| bool | hasElement (const LhaID &id) const |
| Checks whether an element is present in the block. | |
| bool | hasElement (const std::vector< long > &id) const |
| Convenience overload: checks presence from raw ID parts. | |
| AbstractElement * | get (const LhaID &id) const |
| Retrieves an element by its identifier. | |
| AbstractElement * | get (const std::vector< long > &id) const |
| Convenience overload: retrieves an element from raw ID parts. | |
| const std::vector< std::shared_ptr< AbstractElement > > * | getEntries () const |
| Returns a read-only view of all entries in the block. | |
| void | addElement (const std::vector< std::string > &line) |
| Adds a new element to the block from a line of data. | |
| Prototype | getPrototype () |
| Returns the Prototype associated with this block. | |
| std::string | toString () const |
| Serializes the block and all its entries to a string. | |
| std::shared_ptr< DBNode > | toDBNode () const |
| Converts the block and its entries to a DBNode representation. | |
| ~LhaBlock () | |
| Destructor for LhaBlock. | |
Represents an LHA/FLHA block with multiple typed elements.
An LhaBlock:
Definition at line 34 of file lha_blocks.h.
|
inlineexplicit |
Constructs an LhaBlock using a specified prototype.
The block starts empty; elements are later added via readData() or addElement().
| prototype | Prototype defining the block structure. |
Definition at line 48 of file lha_blocks.h.
|
inline |
Destructor for LhaBlock.
Clears the entries vector; shared_ptr semantics ensure any remaining elements are properly destroyed when no longer referenced.
Definition at line 169 of file lha_blocks.h.
| void LhaBlock::addElement | ( | const std::vector< std::string > & | line | ) |
Adds a new element to the block from a line of data.
The line is interpreted according to this block's Prototype and passed to LhaElementFactory::createElement().
| line | Tokens representing one block entry. |
| std::runtime_error | if the line is incompatible with the prototype. |
Definition at line 40 of file lha_blocks.cpp.
| AbstractElement * LhaBlock::get | ( | const LhaID & | id | ) | const |
Retrieves an element by its identifier.
Performs a linear search and returns a non-owning pointer to the stored element if found.
| id | Identifier of the element. |
Definition at line 3 of file lha_blocks.cpp.
|
inline |
Convenience overload: retrieves an element from raw ID parts.
Constructs an LhaID from id and forwards to get(const LhaID&).
| id | Components of the identifier. |
Definition at line 102 of file lha_blocks.h.
| const std::vector< std::shared_ptr< AbstractElement > > * LhaBlock::getEntries | ( | ) | const |
Returns a read-only view of all entries in the block.
The lifetime of the returned pointer is tied to the LhaBlock instance. It must not be deleted by the caller.
Definition at line 12 of file lha_blocks.cpp.
|
inline |
Returns the Prototype associated with this block.
The prototype is returned by value (copy).
Definition at line 133 of file lha_blocks.h.
| bool LhaBlock::hasElement | ( | const LhaID & | id | ) | const |
Checks whether an element is present in the block.
This performs a linear search over the stored entries and compares their LhaID with id.
| id | Identifier of the element. |
Definition at line 53 of file lha_blocks.cpp.
|
inline |
Convenience overload: checks presence from raw ID parts.
Constructs an LhaID from id and forwards to hasElement(const LhaID&).
| id | Components of the identifier. |
Definition at line 81 of file lha_blocks.h.
| void LhaBlock::readData | ( | const std::vector< std::vector< std::string > > & | lines | ) |
Reads data and populates the block with elements from raw lines.
Each non-empty line is passed to LhaElementFactory::createElement() together with this block's prototype to create the appropriate LhaElement<T>, which is then stored in the block.
| lines | Vector of tokenized lines; each inner vector represents one block entry (split into string fields). |
Definition at line 45 of file lha_blocks.cpp.
| std::shared_ptr< DBNode > LhaBlock::toDBNode | ( | ) | const |
Converts the block and its entries to a DBNode representation.
The resulting node has the following structure:
Definition at line 26 of file lha_blocks.cpp.
| std::string LhaBlock::toString | ( | ) | const |
Serializes the block and all its entries to a string.
The format is: "Block <BLOCKNAME>:\n" "<entry1>\n" "<entry2>\n" ... where each entry line is produced by AbstractElement::toString().
Definition at line 16 of file lha_blocks.cpp.