Documentation of MARTY
A Modern ARtificial Theoretical phYsicist
Public Member Functions | Static Public Attributes | Private Attributes
mty::lha::LHAFileData Class Reference

Final class containing all the data coming from a LHA file. More...

#include <lhaData.h>

Public Member Functions

 LHAFileData ()=default
 Default constructor.
 
 ~LHAFileData ()=default
 Default destructor.
 
size_t findBlock (std::string_view nameBlock) const
 Searches a block of a given type and returns it if found. More...
 
void addBlock (std::string_view nameBlock)
 Adds a block to the data if it does not already exist. More...
 
template<class ... Args>
void addElement (std::string_view nameBlock, Args &&...args)
 Adds an element (LHAElement) to a block (LHABlock). More...
 
std::vector< FloatTypegetValues (std::string_view nameBlock) const
 Returns all the values of a given block, in order. More...
 
std::optional< FloatTypegetValue (std::string_view nameBlock, size_t id) const
 Returns the value in a given block for a given id. More...
 
std::optional< FloatTypegetValue (std::string_view nameBlock, size_t i, size_t j) const
 Returns the value in a given block for a given id. More...
 

Static Public Attributes

static constexpr size_t npos = -1
 

Private Attributes

std::vector< LHABlockblocks
 Vector of blocks representing the .lha file.
 

Detailed Description

Final class containing all the data coming from a LHA file.

This object is composed of a set of blocks (see LHABlock), each one containing a set of elements (see LHAElement).

Member Function Documentation

◆ addBlock()

void mty::lha::LHAFileData::addBlock ( std::string_view  nameBlock)

Adds a block to the data if it does not already exist.

Parameters
nameBlockName of the block to create.

◆ addElement()

template<class ... Args>
void mty::lha::LHAFileData::addElement ( std::string_view  nameBlock,
Args &&...  args 
)
inline

Adds an element (LHAElement) to a block (LHABlock).

Template Parameters
...ArgsVariadic template for any arguments for the overloads of LHABlock::addElement().
Parameters
typeType of the block in which the element is added.
argsArguments for LHABlock::addElement().
Note
If the block does not exists, it is created and the element is added directly after.

◆ findBlock()

size_t mty::lha::LHAFileData::findBlock ( std::string_view  nameBlock) const

Searches a block of a given type and returns it if found.

Parameters
nameBlockName of the block type.
Returns
The position of the block of type named nameBlock if found.
LHAFileData::npos else.
See also
BlockName, blockType()

◆ getValue() [1/2]

std::optional< FloatType > mty::lha::LHAFileData::getValue ( std::string_view  nameBlock,
size_t  id 
) const

Returns the value in a given block for a given id.

Parameters
nameBlockName of the block.
idId of the element to get.
Returns
The element in the block nameBlock with id id if it exists.
std::nullopt else.

◆ getValue() [2/2]

std::optional< FloatType > mty::lha::LHAFileData::getValue ( std::string_view  nameBlock,
size_t  i,
size_t  j 
) const

Returns the value in a given block for a given id.

Parameters
nameBlockName of the block.
iRow number for matrix element.
jColumn number for matrix element.
Returns
The element in the block nameBlock with id id if it exists.
std::nullopt else.

◆ getValues()

std::vector< FloatType > mty::lha::LHAFileData::getValues ( std::string_view  nameBlock) const

Returns all the values of a given block, in order.

Parameters
nameBlockName of the block to get.
Returns
All the values of the block if it exists.
An empty vector else.

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