HepMC3 event record library: TagBase Struct Reference

HepMC3 event record library

Public Types | Public Member Functions | Static Public Member Functions | Data Fields
TagBase Struct Reference

## Detailed Description

This is the base class of all classes representing xml tags.

Definition at line 362 of file LHEF.h.

`#include <LHEF.h>`

Inheritance diagram for TagBase:
[legend]
Collaboration diagram for TagBase:
[legend]

## Public Types
typedef XMLTag::AttributeMap | AttributeMap

## Public Member Functions
| TagBase ()
| TagBase (const AttributeMap &attr, const std::string &conts=std::string())
bool | getattr (const std::string &n, double &v, bool erase=true)
bool | getattr (const std::string &n, bool &v, bool erase=true)
bool | getattr (const std::string &n, long &v, bool erase=true)
bool | getattr (const std::string &n, int &v, bool erase=true)
bool | getattr (const std::string &n, std::string &v, bool erase=true)
void | printattrs (std::ostream &file) const
void | closetag (std::ostream &file, const std::string &tag) const

## Static Public Member Functions
static std::string | yes ()

## Data Fields
XMLTag::AttributeMap | attributes
std::string | contents

## Member Typedef Documentation

## ◆ AttributeMap

typedef XMLTag::AttributeMap AttributeMap

Convenient typedef.

Definition at line 367 of file LHEF.h.

## Constructor & Destructor Documentation

## ◆ TagBase() [1/2]

TagBase | ( |  | ) |
| inline

Default constructor does nothing.

Definition at line 372 of file LHEF.h.

## ◆ TagBase() [2/2]

TagBase | ( | const AttributeMap & | attr,
|  | const std::string & | conts = std::string() )
| inline

Main constructor stores the attributes and contents of a tag.

Definition at line 377 of file LHEF.h.

References attributes, and contents.

## Member Function Documentation

## ◆ closetag()

void closetag | ( | std::ostream & | file,
|  | const std::string & | tag ) const
| inline

Print out end of tag marker. Print contents if not empty else print simple close tag.

Definition at line 463 of file LHEF.h.

References contents.

## ◆ getattr() [1/5]

bool getattr | ( | const std::string & | n,
|  | bool & | v,
|  | bool | erase = true )
| inline

Find an attribute named n and set the bool variable v to true if the corresponding value is "yes". Remove the correspondig attribute from the list if found and erase is true.

Returns
  false if no attribute was found.

Definition at line 400 of file LHEF.h.

References attributes.

## ◆ getattr() [2/5]

bool getattr | ( | const std::string & | n,
|  | double & | v,
|  | bool | erase = true )
| inline

Find an attribute named n and set the double variable v to the corresponding value. Remove the correspondig attribute from the list if found and erase is true.

Returns
  false if no attribute was found.

Definition at line 386 of file LHEF.h.

References attributes.

## ◆ getattr() [3/5]

bool getattr | ( | const std::string & | n,
|  | int & | v,
|  | bool | erase = true )
| inline

Find an attribute named n and set the long variable v to the corresponding value. Remove the correspondig attribute from the list if found and erase is true.

Returns
  false if no attribute was found.

Definition at line 428 of file LHEF.h.

References attributes.

## ◆ getattr() [4/5]

bool getattr | ( | const std::string & | n,
|  | long & | v,
|  | bool | erase = true )
| inline

Find an attribute named n and set the long variable v to the corresponding value. Remove the correspondig attribute from the list if found and erase is true.

Returns
  false if no attribute was found.

Definition at line 414 of file LHEF.h.

References attributes.

## ◆ getattr() [5/5]

bool getattr | ( | const std::string & | n,
|  | std::string & | v,
|  | bool | erase = true )
| inline

Find an attribute named n and set the string variable v to the corresponding value. Remove the correspondig attribute from the list if found and erase is true.

Returns
  false if no attribute was found.

Definition at line 442 of file LHEF.h.

References attributes.

## ◆ printattrs()

void printattrs | ( | std::ostream & | file | ) | const
| inline

print out ' name="value"' for all unparsed attributes.

Definition at line 453 of file LHEF.h.

References attributes, and LHEF::oattr().

## ◆ yes()

std::string yes | ( |  | ) |
| inlinestatic

Static string token for truth values.

Definition at line 485 of file LHEF.h.

## Field Documentation

## ◆ attributes

XMLTag::AttributeMap attributes

The attributes of this tag;

Definition at line 475 of file LHEF.h.

## ◆ contents

std::string contents
| mutable

The contents of this tag.

Definition at line 480 of file LHEF.h.

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

- LHEF.h