Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
PoPI::Suite< T, T2 > Class Template Reference

#include <PoPI.hpp>

Public Member Functions

 Suite (std::string const &a_moniker)
 ~Suite ()
void appendFromParentNode (HAPI::Node const &a_node, Database *a_DB, T2 *a_parent)
void appendFromParentNode2 (HAPI::Node const &a_node, T2 *a_parent)
std::string::size_type size (void) const
T & operator[] (std::size_t a_index) const
std::string const & moniker (void)
void toXMLList (std::vector< std::string > &a_XMLList, std::string const &a_indent1) const

Detailed Description

template<class T, class T2>
class PoPI::Suite< T, T2 >

This is the base class for all suite like members.

Definition at line 309 of file PoPI.hpp.

Constructor & Destructor Documentation

◆ Suite()

template<class T, class T2>
PoPI::Suite< T, T2 >::Suite ( std::string const & a_moniker)
inline

Definition at line 316 of file PoPI.hpp.

316: m_moniker( a_moniker ) { }

◆ ~Suite()

template<class T, class T2>
PoPI::Suite< T, T2 >::~Suite ( )

Definition at line 332 of file PoPI.hpp.

332 {
333
334 std::string::size_type i1, _size = m_items.size( );
335
336 for( i1 = 0; i1 < _size; ++i1 ) delete m_items[i1];
337
338// Ask Adam why next line does not work.
339// for( std::vector<T *>::iterator iter = m_items.begin( ); iter != m_items.end( ); ++iter ) delete *iter;
340}
std::string::size_type size(void) const
Definition PoPI.hpp:321

Member Function Documentation

◆ appendFromParentNode()

template<class T, class T2>
void PoPI::Suite< T, T2 >::appendFromParentNode ( HAPI::Node const & a_node,
Database * a_DB,
T2 * a_parent )

Adds the children of a_node to the suite and to a_DB.

Parameters
a_node[in] The HAPI::Node to be parsed.
a_DB[in] The PoPI::Database instance to add the constructed items to.
a_parent[in] The parent suite that will contain this.

Definition at line 351 of file PoPI.hpp.

351 {
352
353 for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
354 T *item = new T( child, a_DB, a_parent );
355 m_items.push_back( item );
356 }
357}

◆ appendFromParentNode2()

template<class T, class T2>
void PoPI::Suite< T, T2 >::appendFromParentNode2 ( HAPI::Node const & a_node,
T2 * a_parent )

Adds the children of a_node to the suite.

Parameters
a_node[in] The HAPI::Node to be parsed.
a_parent[in] The parent suite that will contain this.

Definition at line 367 of file PoPI.hpp.

367 {
368
369 for( HAPI::Node child = a_node.first_child( ); !child.empty( ); child.to_next_sibling( ) ) {
370 T *item = new T( child, a_parent );
371 m_items.push_back( item );
372 }
373}

◆ moniker()

template<class T, class T2>
std::string const & PoPI::Suite< T, T2 >::moniker ( void )
inline

Returns the value of the m_moniker member.

Definition at line 323 of file PoPI.hpp.

◆ operator[]()

template<class T, class T2>
T & PoPI::Suite< T, T2 >::operator[] ( std::size_t a_index) const
inline

Returns the item at index a_index.

Definition at line 322 of file PoPI.hpp.

◆ size()

template<class T, class T2>
std::string::size_type PoPI::Suite< T, T2 >::size ( void ) const
inline

Returns the number of items in the suite.

Definition at line 321 of file PoPI.hpp.

Referenced by PoPI::DecayMode::calculateNuclideGammaBranchStateInfo().

◆ toXMLList()

template<class T, class T2>
void PoPI::Suite< T, T2 >::toXMLList ( std::vector< std::string > & a_XMLList,
std::string const & a_indent1 ) const

Creates an XML representation of the suite.

Parameters
a_XMLList[in] The list the XML lines are added to.
a_indent1[in] The amount to indent the XML text.

Definition at line 383 of file PoPI.hpp.

383 {
384
385 std::string::size_type _size = m_items.size( );
387
388 if( _size == 0 ) return;
389
390 std::string header = a_indent1 + "<" + m_moniker + ">";
391 a_XMLList.push_back( std::move( header ) );
392 for( std::string::size_type i1 = 0; i1 < _size; ++i1 ) m_items[i1]->toXMLList( a_XMLList, indent2 );
393
394 appendXMLEnd( a_XMLList, m_moniker );
395}
void toXMLList(std::vector< std::string > &a_XMLList, std::string const &a_indent1) const
Definition PoPI.hpp:383
void appendXMLEnd(std::vector< std::string > &a_XMLList, std::string const &a_label)
Definition PoPI_misc.cc:53

Referenced by toXMLList().


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