23 #ifndef LHADATA_H_INCLUDED 24 #define LHADATA_H_INCLUDED 31 #include <string_view> 110 std::vector<size_t>
const &pos1,
111 std::vector<size_t>
const &pos2
114 if (pos1.size() != pos2.size())
115 return pos1.size() < pos2.size();
116 auto iter1 = pos1.begin();
117 auto iter2 = pos2.begin();
118 while (iter1 != pos1.end()) {
121 else if (*iter2 < *iter1)
197 bool isName(std::string_view t_name)
const;
208 std::optional<LHAElement> getElement(
size_t id)
const;
221 std::optional<LHAElement> getElement(
239 std::vector<LHAElement> getMultipleElements(
size_t id)
const;
306 static constexpr
size_t npos = -1;
308 IMPLEMENTS_STD_VECTOR(
LHABlock, blocks)
329 size_t findBlock(std::string_view nameBlock)
const;
335 void addBlock(std::string_view nameBlock);
348 template<
class ...Args>
350 std::string_view nameBlock,
354 for (
auto &b : blocks)
355 if (b.getName() == nameBlock) {
356 b.addElement(std::forward<Args>(args)...);
369 std::vector<FloatType> getValues(
370 std::string_view nameBlock
382 std::optional<FloatType> getValue(
383 std::string_view nameBlock,
397 std::optional<FloatType> getValue(
398 std::string_view nameBlock,
451 std::string tolower(std::string
const &str);
LHABlock, containing a vector of LHAElement.
Definition: lhaData.h:160
static bool compare(std::vector< size_t > const &pos1, std::vector< size_t > const &pos2)
Compares two vectors of positions.
Definition: lhaData.h:109
size_t id
Id of the element in the block, or row position for a matrix element.
Definition: lhaData.h:76
FloatType value
Value of the element.
Definition: lhaData.h:84
std::ostream & operator<<(std::ostream &out, BlockType type)
Output stream overload for BlockType.
Definition: lhaData.cpp:58
size_t id_sup
Column position for a matrix element.
Definition: lhaData.h:80
Corresponds to a line of a .lha file.
Definition: lhaData.h:70
void setName(std::string const &t_name)
Sets the name of the block.
Definition: lhaData.h:193
static bool compare(LHAElement const &A, LHAElement const &B)
Compares two LHAElement.
Definition: lhaData.h:141
std::string const & getName() const
Definition: lhaData.h:185
std::vector< LHABlock > blocks
Vector of blocks representing the .lha file.
Definition: lhaData.h:408
BlockType blockType(std::string_view name)
Returns the BlockType corresponding to its name. The name must correspond to the enumeration name (se...
Definition: lhaData.cpp:30
long double FloatType
Floating point type for LHA support. Long double is 64 bits usually.
Definition: lhaData.h:60
Namespace containing all lha utilities.
Definition: lha.h:37
Final class containing all the data coming from a LHA file.
Definition: lhaData.h:302
std::string name
Name of the block.
Definition: lhaData.h:289
std::vector< LHAElement > elements
Vector of LHAElement in the block.
Definition: lhaData.h:293
void addElement(std::string_view nameBlock, Args &&...args)
Adds an element (LHAElement) to a block (LHABlock).
Definition: lhaData.h:349
Helper class to define a comparison function for positions.
Definition: lhaData.h:90
Contains an enumeration of LHA blocks.
BlockType
Enumeration of possible LHA blocks in MARTY.
Definition: lhaBlocks.h:31