Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
lha_blocks.h
Go to the documentation of this file.
1#ifndef HYPERISO_LHA_BLOCKS_H
2#define HYPERISO_LHA_BLOCKS_H
3
4#include <string>
5#include <memory>
6#include <vector>
7#include <sstream>
8#include <algorithm>
9
10#include "lha_elements.h"
11#include "LhaBlockPrototype.h"
12
34class LhaBlock {
35private:
36 Prototype prototype;
37 std::vector<std::shared_ptr<AbstractElement>> entries;
39public:
48 inline explicit LhaBlock(const Prototype& prototype_) : prototype(prototype_) {}
49
60 void readData(const std::vector<std::vector<std::string>>& lines);
61
71 bool hasElement(const LhaID& id) const;
72
81 bool hasElement(const std::vector<long>& id) const { return hasElement(LhaID(id)); };
82
92 AbstractElement* get(const LhaID& id) const;
93
102 AbstractElement* get(const std::vector<long>& id) const { return get(LhaID(id)); }
103
112 const std::vector<std::shared_ptr<AbstractElement>>* getEntries() const;
113
124 void addElement(const std::vector<std::string>& line);
125
133 inline Prototype getPrototype() { return this->prototype; };
134
147 std::string toString() const;
148
161 std::shared_ptr<DBNode> toDBNode() const;
162
169 inline ~LhaBlock() {entries.clear();}
170};
171
172#endif // HYPERISO_LHA_BLOCKS_H
Abstract base class for a single element of an LHA/FLHA block.
Represents an LHA/FLHA block with multiple typed elements.
Definition lha_blocks.h:34
LhaBlock(const Prototype &prototype_)
Constructs an LhaBlock using a specified prototype.
Definition lha_blocks.h:48
Prototype getPrototype()
Returns the Prototype associated with this block.
Definition lha_blocks.h:133
~LhaBlock()
Destructor for LhaBlock.
Definition lha_blocks.h:169
std::string toString() const
Serializes the block and all its entries to a string.
AbstractElement * get(const LhaID &id) const
Retrieves an element by its identifier.
Definition lha_blocks.cpp:3
bool hasElement(const std::vector< long > &id) const
Convenience overload: checks presence from raw ID parts.
Definition lha_blocks.h:81
AbstractElement * get(const std::vector< long > &id) const
Convenience overload: retrieves an element from raw ID parts.
Definition lha_blocks.h:102
const std::vector< std::shared_ptr< AbstractElement > > * getEntries() const
Returns a read-only view of all entries in the block.
bool hasElement(const LhaID &id) const
Checks whether an element is present in the block.
void addElement(const std::vector< std::string > &line)
Adds a new element to the block from a line of data.
void readData(const std::vector< std::vector< std::string > > &lines)
Reads data and populates the block with elements from raw lines.
std::shared_ptr< DBNode > toDBNode() const
Converts the block and its entries to a DBNode representation.
Represents an identifier of a LHA element, possibly containing several sub-ids.
Definition LhaID.h:56
Represents the structure of an LHA block, specifying columns for values, scales, and renormalization ...