Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
HAPI::Node Class Reference

#include <HAPI.hpp>

Public Member Functions

 Node ()
 Node (Node_internal *a_node)
 Node (Node const &a_node)
 ~Node ()
Attribute attribute (const char *a_name) const
std::string attribute_as_string (const char *a_name) const
int attribute_as_int (const char *a_name) const
long attribute_as_long (const char *a_name) const
double attribute_as_double (const char *a_name) const
Node child (const char *name) const
Node first_child () const
Node next_sibling () const
void to_next_sibling () const
Nodeoperator= (const Node &other)
std::string name () const
bool empty () const
Text text () const
Data data () const

Detailed Description

Definition at line 166 of file HAPI.hpp.

Constructor & Destructor Documentation

◆ Node() [1/3]

HAPI::Node::Node ( )

Definition at line 20 of file HAPI_Node.cc.

20 :
21 m_node(NULL) {
22
23}

Referenced by child(), first_child(), next_sibling(), Node(), and operator=().

◆ Node() [2/3]

HAPI::Node::Node ( Node_internal * a_node)

Definition at line 30 of file HAPI_Node.cc.

30 :
31 m_node(a_node) {
32
33}

◆ Node() [3/3]

HAPI::Node::Node ( Node const & a_node)

Copy constructor.

Parameters
a_node[In] The node to copy.

Definition at line 41 of file HAPI_Node.cc.

41 :
42 m_node( nullptr ) {
43
44#ifdef HAPI_USE_PUGIXML
45 if( a_node.m_node->type( ) == NodeInteralType::pugiXML ) {
46 m_node = new PugiXMLNode( static_cast<PugiXMLNode const &>( *a_node.m_node ) );
47 }
48#endif
49#ifdef HAPI_USE_HDF5
50 if( a_node.m_node->type( ) == NodeInteralType::HDF5 ) {
51 m_node = new HDFNode( static_cast<HDFNode const &>( *a_node.m_node ) );
52 }
53#endif
54 if( m_node == nullptr ) throw LUPI::Exception( "Unsupported m_node type." );
55}

◆ ~Node()

HAPI::Node::~Node ( )

Definition at line 60 of file HAPI_Node.cc.

60 {
61
62 delete m_node;
63
64}

Member Function Documentation

◆ attribute()

Attribute HAPI::Node::attribute ( const char * a_name) const
inline

Definition at line 176 of file HAPI.hpp.

176 {
177 return Attribute(m_node, a_name);
178 }

Referenced by PoPI::Decay::Decay().

◆ attribute_as_double()

double HAPI::Node::attribute_as_double ( const char * a_name) const
inline

Definition at line 197 of file HAPI.hpp.

197 {
198 if(m_node == nullptr){
199 return 0.0;
200 }
201 return m_node->attribute_as_double(a_name);
202 }

◆ attribute_as_int()

int HAPI::Node::attribute_as_int ( const char * a_name) const
inline

Definition at line 185 of file HAPI.hpp.

185 {
186 if(m_node == nullptr){
187 return 0;
188 }
189 return m_node->attribute_as_int(a_name);
190 }

◆ attribute_as_long()

long HAPI::Node::attribute_as_long ( const char * a_name) const
inline

Definition at line 191 of file HAPI.hpp.

191 {
192 if(m_node == nullptr){
193 return 0;
194 }
195 return m_node->attribute_as_long(a_name);
196 }

Referenced by GIDI::parseValuesOfDoubles(), and GIDI::parseValuesOfInts().

◆ attribute_as_string()

std::string HAPI::Node::attribute_as_string ( const char * a_name) const
inline

Definition at line 179 of file HAPI.hpp.

179 {
180 if(m_node == nullptr){
181 return "";
182 }
183 return m_node->attribute(a_name);
184 }

Referenced by GIDI::FlattenedArrayData::FlattenedArrayData(), GIDI::Protare::initialize(), GIDI::parseFrame(), GIDI::parseValuesOfDoubles(), GIDI::parseValuesOfInts(), and GIDI::Suite::Suite().

◆ child()

◆ data()

Data HAPI::Node::data ( ) const

Definition at line 178 of file HAPI_Node.cc.

178 {
179
180 if (NULL == m_node)
181 return Data();
182 return Data( m_node->data() );
183
184}

Referenced by GIDI::parseValuesOfDoubles(), and GIDI::parseValuesOfInts().

◆ empty()

◆ first_child()

◆ name()

std::string HAPI::Node::name ( ) const

Definition at line 136 of file HAPI_Node.cc.

136 {
137
138 if (NULL == m_node)
139 return std::string("");
140 return m_node->name();
141
142}

Referenced by GIDI::data1dParse(), GIDI::data1dParseAllowEmpty(), GIDI::data2dParse(), GIDI::data3dParse(), GIDI::Protare::initialize(), GIDI::parseDistributionSuite(), GIDI::parseProductSuite(), and GIDI::Reaction::Reaction().

◆ next_sibling()

Node HAPI::Node::next_sibling ( ) const

Definition at line 96 of file HAPI_Node.cc.

96 {
97
98 if (NULL == m_node)
99 return Node();
100 Node_internal *sibling = m_node->next_sibling( );
101 delete m_node;
102 return Node( sibling );
103
104}

◆ operator=()

Node & HAPI::Node::operator= ( const Node & other)

Definition at line 122 of file HAPI_Node.cc.

122 {
123
124 if (NULL != other.m_node)
125 this->m_node = other.m_node->copy();
126 return *this;
127
128}

◆ text()

Text HAPI::Node::text ( ) const

Definition at line 164 of file HAPI_Node.cc.

164 {
165
166 if (NULL == m_node)
167 return Text();
168 return m_node->text();
169
170}

◆ to_next_sibling()

void HAPI::Node::to_next_sibling ( ) const

Definition at line 112 of file HAPI_Node.cc.

112 {
113
114 m_node->to_next_sibling( );
115
116}

Referenced by GIDI::Functions::Weighted_function2d::Weighted_function2d().


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