flexiblesusy is hosted by Hepforge, IPPP Durham
FlexibleSUSY

#include <slhaea.h>

Collaboration diagram for SLHAea::Block:
Collaboration graph

Classes

struct  key_matches
 

Public Types

typedef impl_type::const_iterator const_iterator
 
typedef impl_type::const_pointer const_pointer
 
typedef const Lineconst_reference
 
typedef impl_type::const_reverse_iterator const_reverse_iterator
 
typedef impl_type::difference_type difference_type
 
typedef impl_type::iterator iterator
 
typedef std::vector< std::string > key_type
 
typedef impl_type::pointer pointer
 
typedef Linereference
 
typedef impl_type::reverse_iterator reverse_iterator
 
typedef impl_type::size_type size_type
 
typedef Line value_type
 

Public Member Functions

reference at (const key_type &key)
 Locates a Line in the Block. More...
 
const_reference at (const key_type &key) const
 Locates a Line in the Block. More...
 
reference at (const std::string &s0, const std::string &s1="", const std::string &s2="", const std::string &s3="", const std::string &s4="")
 Locates a Line in the Block. More...
 
const_reference at (const std::string &s0, const std::string &s1="", const std::string &s2="", const std::string &s3="", const std::string &s4="") const
 Locates a Line in the Block. More...
 
reference at (const std::vector< int > &key)
 Locates a Line in the Block. More...
 
const_reference at (const std::vector< int > &key) const
 Locates a Line in the Block. More...
 
reference at (int i0, int i1=no_index_, int i2=no_index_, int i3=no_index_, int i4=no_index_)
 Locates a Line in the Block. More...
 
const_reference at (int i0, int i1=no_index_, int i2=no_index_, int i3=no_index_, int i4=no_index_) const
 Locates a Line in the Block. More...
 
reference back ()
 
const_reference back () const
 
iterator begin ()
 
const_iterator begin () const
 
 Block (const std::string &name="")
 Constructs an empty Block. More...
 
 Block (std::istream &is)
 Constructs a Block with content from an input stream. More...
 
const_iterator cbegin () const
 
const_iterator cend () const
 
void clear ()
 
void comment ()
 Comments all Lines in the Block. More...
 
size_type count (const key_type &key) const
 Counts all Lines that match a given key. More...
 
const_reverse_iterator crbegin () const
 
const_reverse_iterator crend () const
 
size_type data_size () const
 
bool empty () const
 
iterator end ()
 
const_iterator end () const
 
size_type erase (const key_type &key)
 Erases all Lines that match the provided key. More...
 
iterator erase (iterator first, iterator last)
 Erases a range of elements. More...
 
iterator erase (iterator position)
 Erases element at given position. More...
 
iterator erase_first (const key_type &key)
 Erases first Line that matches the provided key. More...
 
iterator erase_last (const key_type &key)
 Erases last Line that matches the provided key. More...
 
iterator find (const key_type &key)
 Tries to locate a Line in the Block. More...
 
const_iterator find (const key_type &key) const
 Tries to locate a Line in the Block. More...
 
iterator find_block_def ()
 
const_iterator find_block_def () const
 
reference front ()
 
const_reference front () const
 
iterator insert (iterator position, const value_type &line)
 Inserts a Line before given position. More...
 
template<class InputIterator >
void insert (iterator position, InputIterator first, InputIterator last)
 Inserts a range into the Block. More...
 
size_type max_size () const
 
const std::string & name () const
 
void name (const std::string &newName)
 Sets the name of the Block. More...
 
reference operator[] (const key_type &key)
 Locates a Line in the Block. More...
 
reference operator[] (const std::string &key)
 Locates a Line in the Block. More...
 
reference operator[] (const std::vector< int > &key)
 Locates a Line in the Block. More...
 
reference operator[] (int key)
 Locates a Line in the Block. More...
 
void pop_back ()
 
void push_back (const std::string &line)
 Adds a Line to the end of the Block. More...
 
void push_back (const value_type &line)
 Adds a Line to the end of the Block. More...
 
reverse_iterator rbegin ()
 
const_reverse_iterator rbegin () const
 
Blockread (std::istream &is)
 Assigns content from an input stream to the Block. More...
 
void reformat ()
 Reformats all Lines in the Block. More...
 
void rename (const std::string &newName)
 Changes the name and definition of the Block. More...
 
reverse_iterator rend ()
 
const_reverse_iterator rend () const
 
size_type size () const
 
std::string str () const
 
Blockstr (const std::string &block)
 Assigns content from a string to the Block. More...
 
void swap (Block &block)
 Swaps data with another Block. More...
 
void uncomment ()
 Uncomments all Lines in the Block. More...
 

Static Public Member Functions

template<class InputIterator >
static InputIterator find (InputIterator first, InputIterator last, const key_type &key)
 Tries to locate a Line in a range. More...
 
static Block from_str (const std::string &block)
 Constructs a Block with content from a string. More...
 

Private Types

typedef std::vector< Lineimpl_type
 

Static Private Member Functions

template<class Container >
static key_type cont_to_key (const Container &cont)
 
static key_type ints_to_key (int i0, int i1, int i2, int i3, int i4)
 
static key_type strings_to_key (const std::string &s0, const std::string &s1, const std::string &s2, const std::string &s3, const std::string &s4)
 

Private Attributes

impl_type impl_
 
std::string name_
 

Static Private Attributes

static const int no_index_ = -32768
 

Detailed Description

Container of Lines that resembles a block in a SLHA structure. This class is a named container of Lines that resembles a block in a SLHA structure. Unlike a block in a SLHA structure, a Block can contain any number of block definitions or it can be completely empty.

Access to the elements of the Block is provided by the operator[]() and at() functions. These take one or more strings resp. ints as argument(s) and compare them against the first strings of the contained Lines (the ints are converted to strings before comparison). The first Line that matches the provided arguments is then returned, or if no matching Line is found, an empty Line is appended to the Block (operator[]()) or std::out_of_range is thrown (at()). The special argument "(any)" will be considered equal to all strings in the Lines. For example, at("(any)", "2") returns the first Line whose second element is "2".

Definition at line 730 of file slhaea.h.

Member Typedef Documentation

◆ const_iterator

typedef impl_type::const_iterator SLHAea::Block::const_iterator

Definition at line 741 of file slhaea.h.

◆ const_pointer

typedef impl_type::const_pointer SLHAea::Block::const_pointer

Definition at line 745 of file slhaea.h.

◆ const_reference

Definition at line 739 of file slhaea.h.

◆ const_reverse_iterator

typedef impl_type::const_reverse_iterator SLHAea::Block::const_reverse_iterator

Definition at line 743 of file slhaea.h.

◆ difference_type

typedef impl_type::difference_type SLHAea::Block::difference_type

Definition at line 746 of file slhaea.h.

◆ impl_type

typedef std::vector<Line> SLHAea::Block::impl_type
private

Definition at line 733 of file slhaea.h.

◆ iterator

typedef impl_type::iterator SLHAea::Block::iterator

Definition at line 740 of file slhaea.h.

◆ key_type

typedef std::vector<std::string> SLHAea::Block::key_type

Definition at line 736 of file slhaea.h.

◆ pointer

typedef impl_type::pointer SLHAea::Block::pointer

Definition at line 744 of file slhaea.h.

◆ reference

Definition at line 738 of file slhaea.h.

◆ reverse_iterator

typedef impl_type::reverse_iterator SLHAea::Block::reverse_iterator

Definition at line 742 of file slhaea.h.

◆ size_type

typedef impl_type::size_type SLHAea::Block::size_type

Definition at line 747 of file slhaea.h.

◆ value_type

Definition at line 737 of file slhaea.h.

Constructor & Destructor Documentation

◆ Block() [1/2]

SLHAea::Block::Block ( const std::string &  name = "")
inlineexplicit

Constructs an empty Block.

Parameters
nameName of the Block.

Definition at line 758 of file slhaea.h.

Referenced by from_str().

◆ Block() [2/2]

SLHAea::Block::Block ( std::istream &  is)
inlineexplicit

Constructs a Block with content from an input stream.

Parameters
isInput stream to read content from.
See also
read()

Definition at line 766 of file slhaea.h.

References read().

Member Function Documentation

◆ at() [1/8]

reference SLHAea::Block::at ( const key_type key)
inline

Locates a Line in the Block.

Parameters
keyFirst strings of the Line to be located.
Returns
Read/write reference to sought-after Line.
Exceptions
std::out_of_rangeIf key does not match any Line.

This function takes a key (which is a vector of strings) and locates the Line whose first strings are equal to the strings in key. If no such Line exists, std::out_of_range is thrown.

Definition at line 959 of file slhaea.h.

References end(), and find().

Referenced by at(), and SLHAea::Coll::line().

◆ at() [2/8]

const_reference SLHAea::Block::at ( const key_type key) const
inline

Locates a Line in the Block.

Parameters
keyFirst strings of the Line to be located.
Returns
Read-only (constant) reference to sought-after Line.
Exceptions
std::out_of_rangeIf key does not match any Line.

This function takes a key (which is a vector of strings) and locates the Line whose first strings are equal to the strings in key. If no such Line exists, std::out_of_range is thrown.

Definition at line 979 of file slhaea.h.

References end(), and find().

◆ at() [3/8]

reference SLHAea::Block::at ( const std::string &  s0,
const std::string &  s1 = "",
const std::string &  s2 = "",
const std::string &  s3 = "",
const std::string &  s4 = "" 
)
inline

Locates a Line in the Block.

Parameters
s0,s1,s2,s3,s4First strings of the Line to be located.
Returns
Read/write reference to sought-after Line.
Exceptions
std::out_of_rangeIf provided strings do not match any Line.

This function takes up to five strings and locates the Line whose first strings are equal to all provided non-empty strings. If no such Line exists, std::out_of_range is thrown.

Definition at line 1029 of file slhaea.h.

References at(), and strings_to_key().

◆ at() [4/8]

const_reference SLHAea::Block::at ( const std::string &  s0,
const std::string &  s1 = "",
const std::string &  s2 = "",
const std::string &  s3 = "",
const std::string &  s4 = "" 
) const
inline

Locates a Line in the Block.

Parameters
s0,s1,s2,s3,s4First strings of the Line to be located.
Returns
Read-only (constant) reference to sought-after Line.
Exceptions
std::out_of_rangeIf provided strings do not match any Line.

This function takes up to five strings and locates the Line whose first strings are equal to all provided non-empty strings. If no such Line exists, std::out_of_range is thrown.

Definition at line 1047 of file slhaea.h.

References at(), and strings_to_key().

◆ at() [5/8]

reference SLHAea::Block::at ( const std::vector< int > &  key)
inline

Locates a Line in the Block.

Parameters
keyIntegers that are used to locate the Line.
Returns
Read/write reference to sought-after Line.
Exceptions
std::out_of_rangeIf key does not match any Line.

This function takes a vector of ints and locates the Line whose first strings are equal to the to strings converted ints in key. If no such Line exists, std::out_of_range is thrown.

Definition at line 999 of file slhaea.h.

References at(), and cont_to_key().

◆ at() [6/8]

const_reference SLHAea::Block::at ( const std::vector< int > &  key) const
inline

Locates a Line in the Block.

Parameters
keyIntegers that are used to locate the Line.
Returns
Read-only (constant) reference to sought-after Line.
Exceptions
std::out_of_rangeIf key does not match any Line.

This function takes a vector of ints and locates the Line whose first strings are equal to the to strings converted ints in key. If no such Line exists, std::out_of_range is thrown.

Definition at line 1013 of file slhaea.h.

References at(), and cont_to_key().

◆ at() [7/8]

reference SLHAea::Block::at ( int  i0,
int  i1 = no_index_,
int  i2 = no_index_,
int  i3 = no_index_,
int  i4 = no_index_ 
)
inline

Locates a Line in the Block.

Parameters
i0,i1,i2,i3,i4Integers that are used to locate the Line.
Returns
Read/write reference to sought-after Line.
Exceptions
std::out_of_rangeIf provided ints do not match any Line.

This function takes up to five ints and locates the Line whose first strings are equal to all provided to string converted ints. If no such Line exists, std::out_of_range is thrown.

Definition at line 1065 of file slhaea.h.

References at(), and ints_to_key().

◆ at() [8/8]

const_reference SLHAea::Block::at ( int  i0,
int  i1 = no_index_,
int  i2 = no_index_,
int  i3 = no_index_,
int  i4 = no_index_ 
) const
inline

Locates a Line in the Block.

Parameters
i0,i1,i2,i3,i4Integers that are used to locate the Line.
Returns
Read-only (constant) reference to sought-after Line.
Exceptions
std::out_of_rangeIf provided ints do not match any Line.

This function takes up to five ints and locates the Line whose first strings are equal to all provided to string converted ints. If no such Line exists, std::out_of_range is thrown.

Definition at line 1081 of file slhaea.h.

References at(), and ints_to_key().

◆ back() [1/2]

reference SLHAea::Block::back ( )
inline

Returns a read/write reference to the last element of the Block.

Definition at line 1105 of file slhaea.h.

References impl_.

Referenced by operator[]().

◆ back() [2/2]

const_reference SLHAea::Block::back ( ) const
inline

Returns a read-only (constant) reference to the last element of the Block.

Definition at line 1113 of file slhaea.h.

References impl_.

◆ begin() [1/2]

iterator SLHAea::Block::begin ( )
inline

Returns a read/write iterator that points to the first element in the Block. Iteration is done in ordinary element order.

Definition at line 1122 of file slhaea.h.

References impl_.

Referenced by comment(), count(), data_size(), erase(), find(), find_block_def(), SLHAea::operator<(), SLHAea::operator<<(), SLHAea::operator==(), reformat(), and uncomment().

◆ begin() [2/2]

const_iterator SLHAea::Block::begin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the Block. Iteration is done in ordinary element order.

Definition at line 1131 of file slhaea.h.

References impl_.

◆ cbegin()

const_iterator SLHAea::Block::cbegin ( ) const
inline

Returns a read-only (constant) iterator that points to the first element in the Block. Iteration is done in ordinary element order.

Definition at line 1140 of file slhaea.h.

References impl_.

◆ cend()

const_iterator SLHAea::Block::cend ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the Block. Iteration is done in ordinary element order.

Definition at line 1167 of file slhaea.h.

References impl_.

◆ clear()

void SLHAea::Block::clear ( )
inline

Erases all the elements in the Block and set its name to an empty string.

Definition at line 1497 of file slhaea.h.

References impl_, and name_.

Referenced by str().

◆ comment()

void SLHAea::Block::comment ( )
inline

Comments all Lines in the Block.

See also
Line::comment()

Definition at line 1516 of file slhaea.h.

References begin(), SLHAea::Line::comment(), end(), flexiblesusy::detail::for_each(), and MEM_FN.

Referenced by SLHAea::Coll::comment().

◆ cont_to_key()

template<class Container >
static key_type SLHAea::Block::cont_to_key ( const Container &  cont)
inlinestaticprivate

Definition at line 1555 of file slhaea.h.

References SLHAea::to_string().

Referenced by at(), and operator[]().

◆ count()

size_type SLHAea::Block::count ( const key_type key) const
inline

Counts all Lines that match a given key.

Parameters
keyFirst strings of the Lines that will be counted.
Returns
Number of lines whose first strings equal key.

Definition at line 1305 of file slhaea.h.

References begin(), and end().

◆ crbegin()

const_reverse_iterator SLHAea::Block::crbegin ( ) const
inline

Returns a read-only (constant) reverse iterator that points to the last element in the Block. Iteration is done in reverse element order.

Definition at line 1194 of file slhaea.h.

References impl_.

◆ crend()

const_reverse_iterator SLHAea::Block::crend ( ) const
inline

Returns a read-only (constant) reverse iterator that points to one before the first element in the Block. Iteration is done in reverse element order.

Definition at line 1221 of file slhaea.h.

References impl_.

◆ data_size()

size_type SLHAea::Block::data_size ( ) const
inline

Returns the number of data Lines in the Block.

Definition at line 1316 of file slhaea.h.

References begin(), end(), SLHAea::Line::is_data_line(), and MEM_FN.

◆ empty()

bool SLHAea::Block::empty ( ) const
inline

Returns true if the Block is empty.

Definition at line 1329 of file slhaea.h.

References impl_.

Referenced by SLHAea::Coll::erase_if_empty().

◆ end() [1/2]

iterator SLHAea::Block::end ( )
inline

Returns a read/write iterator that points one past the last element in the Block. Iteration is done in ordinary element order.

Definition at line 1149 of file slhaea.h.

References impl_.

Referenced by at(), comment(), count(), data_size(), erase(), erase_first(), erase_last(), find(), find_block_def(), SLHAea::Coll::key_matches_block_def::operator()(), SLHAea::operator<(), SLHAea::operator<<(), SLHAea::operator==(), operator[](), reformat(), rename(), and uncomment().

◆ end() [2/2]

const_iterator SLHAea::Block::end ( ) const
inline

Returns a read-only (constant) iterator that points one past the last element in the Block. Iteration is done in ordinary element order.

Definition at line 1158 of file slhaea.h.

References impl_.

◆ erase() [1/3]

size_type SLHAea::Block::erase ( const key_type key)
inline

Erases all Lines that match the provided key.

Parameters
keyFirst strings of the Lines to be erased.
Returns
The number of Lines erased.

This function takes a key (which is a vector of strings) and erases all Lines whose first strings are equal to the strings in key.

Definition at line 1464 of file slhaea.h.

References begin(), end(), and erase().

◆ erase() [2/3]

iterator SLHAea::Block::erase ( iterator  first,
iterator  last 
)
inline

Erases a range of elements.

Parameters
firstIterator pointing to the first element to be erased.
lastIterator pointing to one past the last element to be erased.
Returns
Iterator pointing to the element pointed to by last prior to erasing (or end()).

This function erases the elements in the range [first, last) and shortens the Block accordingly.

Definition at line 1415 of file slhaea.h.

References impl_.

◆ erase() [3/3]

iterator SLHAea::Block::erase ( iterator  position)
inline

Erases element at given position.

Parameters
positionIterator pointing to the element to be erased.
Returns
Iterator pointing to the next element (or end()).

This function erases the element at the given position and thus shortens the Block by one.

Definition at line 1400 of file slhaea.h.

References impl_.

Referenced by erase(), erase_first(), and erase_last().

◆ erase_first()

iterator SLHAea::Block::erase_first ( const key_type key)
inline

Erases first Line that matches the provided key.

Parameters
keyFirst strings of the Line to be erased.
Returns
Iterator pointing to the next element (or end()).

This function takes a key (which is a vector of strings) and erases the first Line whose first strings are equal to the strings in key. If the Block contains such Line, the function returns an iterator pointing to the next element (or end()). If no such Line exists, end() is returned.

Definition at line 1430 of file slhaea.h.

References end(), erase(), and find().

◆ erase_last()

iterator SLHAea::Block::erase_last ( const key_type key)
inline

Erases last Line that matches the provided key.

Parameters
keyFirst strings of the Line to be erased.
Returns
Iterator pointing to the next element (or end()).

This function takes a key (which is a vector of strings) and erases the last Line whose first strings are equal to the strings in key. If the Block contains such Line, the function returns an iterator pointing to the next element (or end()). If no such Line exists, end() is returned.

Definition at line 1448 of file slhaea.h.

References end(), erase(), find(), rbegin(), and rend().

◆ find() [1/3]

iterator SLHAea::Block::find ( const key_type key)
inline

Tries to locate a Line in the Block.

Parameters
keyFirst strings of the Line to be located.
Returns
Read/write iterator pointing to sought-after element, or end() if not found.

This function takes a key (which is a vector of strings) and tries to locate the Line whose first strings are equal to the strings in key. If successful the function returns a read/write iterator pointing to the sought after Line. If unsuccessful it returns end().

Definition at line 1238 of file slhaea.h.

References begin(), end(), and flexiblesusy::meta::find_if().

Referenced by at(), erase_first(), erase_last(), and operator[]().

◆ find() [2/3]

const_iterator SLHAea::Block::find ( const key_type key) const
inline

Tries to locate a Line in the Block.

Parameters
keyFirst strings of the Line to be located.
Returns
Read-only (constant) iterator pointing to sought-after element, or end() const if not found.

This function takes a key (which is a vector of strings) and tries to locate the Line whose first strings are equal to the strings in key. If successful the function returns a read-only (constant) iterator pointing to the sought after Line. If unsuccessful it returns end() const.

Definition at line 1254 of file slhaea.h.

References begin(), end(), and flexiblesusy::meta::find_if().

◆ find() [3/3]

template<class InputIterator >
static InputIterator SLHAea::Block::find ( InputIterator  first,
InputIterator  last,
const key_type key 
)
inlinestatic

Tries to locate a Line in a range.

Parameters
first,lastInput iterators to the initial and final positions in a sequence.
keyFirst strings of the Line to be located.
Returns
Iterator pointing to sought-after element, or last if not found.

This function tries to locate in the range [first, last) the Line whose first strings are equal to the strings in key. If successful the function returns an iterator pointing to the sought after Line. If unsuccessful it returns last.

Definition at line 1271 of file slhaea.h.

References flexiblesusy::meta::find_if().

◆ find_block_def() [1/2]

iterator SLHAea::Block::find_block_def ( )
inline

Returns a read/write iterator that points to the first Line in the Block which is a block definition. If the Block does not contain a block definition, end() is returned.

Definition at line 1280 of file slhaea.h.

References begin(), end(), flexiblesusy::meta::find_if(), SLHAea::Line::is_block_def(), and MEM_FN.

Referenced by SLHAea::Coll::key_matches_block_def::operator()(), and rename().

◆ find_block_def() [2/2]

const_iterator SLHAea::Block::find_block_def ( ) const
inline

Returns a read-only (constant) iterator that points to the first Line in the Block which is a block definition. If the Block does not contain a block definition, end() const is returned.

Definition at line 1292 of file slhaea.h.

References begin(), end(), flexiblesusy::meta::find_if(), SLHAea::Line::is_block_def(), and MEM_FN.

◆ from_str()

static Block SLHAea::Block::from_str ( const std::string &  block)
inlinestatic

Constructs a Block with content from a string.

Parameters
blockString to read content from.

Definition at line 774 of file slhaea.h.

References Block().

◆ front() [1/2]

reference SLHAea::Block::front ( )
inline

Returns a read/write reference to the first element of the Block.

Definition at line 1090 of file slhaea.h.

References impl_.

◆ front() [2/2]

const_reference SLHAea::Block::front ( ) const
inline

Returns a read-only (constant) reference to the first element of the Block.

Definition at line 1098 of file slhaea.h.

References impl_.

◆ insert() [1/2]

iterator SLHAea::Block::insert ( iterator  position,
const value_type line 
)
inline

Inserts a Line before given position.

Parameters
positionIterator into the Block.
lineLine to be inserted.
Returns
Iterator pointing to the inserted element.

This function inserts a copy of line before the specified position and thus enlarges the Block by one.

Definition at line 1374 of file slhaea.h.

References impl_.

◆ insert() [2/2]

template<class InputIterator >
void SLHAea::Block::insert ( iterator  position,
InputIterator  first,
InputIterator  last 
)
inline

Inserts a range into the Block.

Parameters
positionIterator into the Block.
first,lastInput iterators to the initial and final positions in a sequence.

This function inserts copies of the Lines in the range [first, last) into the Block before the specified position and thus enlarges the Block accordingly.

Definition at line 1388 of file slhaea.h.

References impl_.

◆ ints_to_key()

static key_type SLHAea::Block::ints_to_key ( int  i0,
int  i1,
int  i2,
int  i3,
int  i4 
)
inlinestaticprivate

Definition at line 1582 of file slhaea.h.

References no_index_, and SLHAea::to_string().

Referenced by at().

◆ max_size()

size_type SLHAea::Block::max_size ( ) const
inline

Returns the size() of the largest possible Block.

Definition at line 1324 of file slhaea.h.

References impl_.

◆ name() [1/2]

const std::string & SLHAea::Block::name ( ) const
inline

Returns the name of the Block.

Definition at line 793 of file slhaea.h.

References name_.

Referenced by read(), and rename().

◆ name() [2/2]

void SLHAea::Block::name ( const std::string &  newName)
inline

Sets the name of the Block.

Parameters
newNameNew name of the Block.

Notice that this function only changes a property of the Block. No contained Line (in particular no block definition) is changed.

Definition at line 788 of file slhaea.h.

References name_.

Referenced by SLHAea::Coll::key_matches::operator()(), SLHAea::operator<(), SLHAea::operator==(), and flexiblesusy::SLHA_io::set_block().

◆ operator[]() [1/4]

reference SLHAea::Block::operator[] ( const key_type key)
inline

Locates a Line in the Block.

Parameters
keyFirst strings of the Line to be located.
Returns
Read/write reference to sought-after Line.

This function takes a key (which is a vector of strings) and locates the Line whose first strings are equal to the strings in key. If no such Line exists, this function creates an empty Line at the end of the Block and returns a reference to it.

Definition at line 897 of file slhaea.h.

References back(), end(), find(), and push_back().

◆ operator[]() [2/4]

reference SLHAea::Block::operator[] ( const std::string &  key)
inline

Locates a Line in the Block.

Parameters
keyString that is used to locate the Line.
Returns
Read/write reference to sought-after Line.

This function locates the Line whose first string is equal to key. If no such Line exists, this function creates an empty Line at the end of the Block and returns a reference to it.

Definition at line 931 of file slhaea.h.

◆ operator[]() [3/4]

reference SLHAea::Block::operator[] ( const std::vector< int > &  key)
inline

Locates a Line in the Block.

Parameters
keyIntegers that are used to locate the Line.
Returns
Read/write reference to sought-after Line.

This function takes a key (which is a vector of ints) and locates the Line whose first strings are equal to the to strings converted ints in key. If no such Line exists, this function creates an empty Line at the end of the Block and returns a reference to it.

Definition at line 918 of file slhaea.h.

References cont_to_key().

◆ operator[]() [4/4]

reference SLHAea::Block::operator[] ( int  key)
inline

Locates a Line in the Block.

Parameters
keyInteger that is used to locate the Line.
Returns
Read/write reference to sought-after Line.

This function locates the Line whose first string is equal to the to string converted key. If no such Line exists, this function creates an empty Line at the end of the Block and returns a reference to it.

Definition at line 945 of file slhaea.h.

References SLHAea::to_string().

◆ pop_back()

void SLHAea::Block::pop_back ( )
inline

Removes the last element. This function shrinks the size() of the Block by one.

Definition at line 1361 of file slhaea.h.

References impl_.

◆ push_back() [1/2]

void SLHAea::Block::push_back ( const std::string &  line)
inline

Adds a Line to the end of the Block.

Parameters
lineString that is used to construct the Line that will be added.

This function creates an element at the end of the Block and assigns the Line that is constructed from line to it.

Definition at line 1353 of file slhaea.h.

References impl_.

◆ push_back() [2/2]

void SLHAea::Block::push_back ( const value_type line)
inline

Adds a Line to the end of the Block.

Parameters
lineLine to be added.

This function creates an element at the end of the Block and assigns the given line to it.

Definition at line 1341 of file slhaea.h.

References impl_.

Referenced by operator[](), read(), and SLHAea::Coll::read().

◆ rbegin() [1/2]

reverse_iterator SLHAea::Block::rbegin ( )
inline

Returns a read/write reverse iterator that points to the last element in the Block. Iteration is done in reverse element order.

Definition at line 1176 of file slhaea.h.

References impl_.

Referenced by erase_last().

◆ rbegin() [2/2]

const_reverse_iterator SLHAea::Block::rbegin ( ) const
inline

Returns a read-only (constant) reverse iterator that points to the last element in the Block. Iteration is done in reverse element order.

Definition at line 1185 of file slhaea.h.

References impl_.

◆ read()

Block & SLHAea::Block::read ( std::istream &  is)
inline

Assigns content from an input stream to the Block.

Parameters
isInput stream to read content from.
Returns
Reference to *this.

This function reads non-empty lines from is, transforms them into Lines and adds them to the end of the Block. Lines from is are read until the second block definition is encountered or until the end of the stream, whatever comes first. If is contains a block definition and the current name of the Block is empty, it is changed accordingly.

Definition at line 824 of file slhaea.h.

References SLHAea::detail::is_all_whitespace(), SLHAea::Line::is_block_def(), name(), push_back(), and SLHAea::Line::str().

Referenced by Block(), SLHAea::operator>>(), and str().

◆ reformat()

void SLHAea::Block::reformat ( )
inline

Reformats all Lines in the Block.

See also
Line::reformat()

Definition at line 1508 of file slhaea.h.

References begin(), end(), flexiblesusy::detail::for_each(), MEM_FN, and SLHAea::Line::reformat().

Referenced by SLHAea::Coll::reformat().

◆ rename()

void SLHAea::Block::rename ( const std::string &  newName)
inline

Changes the name and definition of the Block.

Parameters
newNameNew name of the Block.

In contrast to name() this function changes the name of the Block and its first block definition (if it exists).

Definition at line 804 of file slhaea.h.

References end(), find_block_def(), and name().

◆ rend() [1/2]

reverse_iterator SLHAea::Block::rend ( )
inline

Returns a read/write reverse iterator that points to one before the first element in the Block. Iteration is done in reverse element order.

Definition at line 1203 of file slhaea.h.

References impl_.

Referenced by erase_last().

◆ rend() [2/2]

const_reverse_iterator SLHAea::Block::rend ( ) const
inline

Returns a read-only (constant) reverse iterator that points to one before the first element in the Block. Iteration is done in reverse element order.

Definition at line 1212 of file slhaea.h.

References impl_.

◆ size()

size_type SLHAea::Block::size ( ) const
inline

Returns the number of elements in the Block.

Definition at line 1311 of file slhaea.h.

References impl_.

Referenced by SLHAea::operator==().

◆ str() [1/2]

std::string SLHAea::Block::str ( ) const
inline

Returns a string representation of the Block.

Definition at line 878 of file slhaea.h.

◆ str() [2/2]

Block & SLHAea::Block::str ( const std::string &  block)
inline

Assigns content from a string to the Block.

Parameters
blockString that is used as content for the Block.
Returns
Reference to *this.

This function clears the name and content of the Block and adds every non-empty line found in block as Line to the end of the Block. If block contains a block definition, the name of the Block is set accordingly. If block contains more than two block definitions, only the lines before the second block definition are added to the Block.

Definition at line 868 of file slhaea.h.

References clear(), and read().

Referenced by SLHAea::Coll::push_back(), SLHAea::Coll::push_front(), and flexiblesusy::SLHA_io::set_block().

◆ strings_to_key()

static key_type SLHAea::Block::strings_to_key ( const std::string &  s0,
const std::string &  s1,
const std::string &  s2,
const std::string &  s3,
const std::string &  s4 
)
inlinestaticprivate

Definition at line 1567 of file slhaea.h.

Referenced by at().

◆ swap()

void SLHAea::Block::swap ( Block block)
inline

Swaps data with another Block.

Parameters
blockBlock to be swapped with.

Definition at line 1486 of file slhaea.h.

References impl_, and name_.

◆ uncomment()

void SLHAea::Block::uncomment ( )
inline

Uncomments all Lines in the Block.

See also
Line::uncomment()

Definition at line 1524 of file slhaea.h.

References begin(), end(), flexiblesusy::detail::for_each(), MEM_FN, and SLHAea::Line::uncomment().

Referenced by SLHAea::Coll::uncomment().

Member Data Documentation

◆ impl_

impl_type SLHAea::Block::impl_
private

◆ name_

std::string SLHAea::Block::name_
private

Definition at line 1595 of file slhaea.h.

Referenced by clear(), name(), and swap().

◆ no_index_

const int SLHAea::Block::no_index_ = -32768
staticprivate

Definition at line 1597 of file slhaea.h.

Referenced by ints_to_key().


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