Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_transportable.cc
Go to the documentation of this file.
1/*
2# <<BEGIN-copyright>>
3# Copyright 2019, Lawrence Livermore National Security, LLC.
4# This file is part of the gidiplus package (https://github.com/LLNL/gidiplus).
5# gidiplus is licensed under the MIT license (see https://opensource.org/licenses/MIT).
6# SPDX-License-Identifier: MIT
7# <<END-copyright>>
8*/
9
10#include "GIDI.hpp"
11#include <HAPI.hpp>
12
13namespace GIDI {
14
15#define GIDI_conserveChars "conserve"
16
17/*! \class Transportable
18 * Class for the GNDS <**transportable**> node that resides under the <**transportables**> node.
19 */
20
21/* *********************************************************************************************************//**
22 * @param a_construction [in] Used to pass user options to the constructor.
23 * @param a_node [in] The **HAPI::Node** to be parsed to construct a Transportable instance.
24 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
25 * @param a_pops [in] A PoPI::Database instance used to get particle indices and possibly other particle information.
26 * @param a_parent [in] The parent GIDI::Suite.
27 ***********************************************************************************************************/
28
29Transportable::Transportable( Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo,
30 PoPI::Database const &a_pops, Suite *a_parent ) :
31 Form( a_node, a_setupInfo, FormType::transportable, a_parent ),
32 m_conserve( a_node.attribute_as_string( GIDI_conserveChars ) ),
33 m_group( a_construction, a_node.child( GIDI_groupChars ), a_setupInfo, a_pops ) {
34}
35
36/* *********************************************************************************************************//**
37 * Copy constructor.
38 *
39 * @param a_transportable [in] Transportable instance to copy.
40 ***********************************************************************************************************/
41
43 Form( a_transportable ),
44 m_conserve( a_transportable.conserve( ) ),
45 m_group( a_transportable.group( ) ) {
46
47}
48
49/* *********************************************************************************************************//**
50 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
51 *
52 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
53 * @param a_indent [in] The amount to indent *this* node.
54 ***********************************************************************************************************/
55
56void Transportable::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
57
58 std::string indent2 = a_writeInfo.incrementalIndent( a_indent );
59 std::string attributes = a_writeInfo.addAttribute( GIDI_labelChars, label( ) );
60
61 attributes += a_writeInfo.addAttribute( GIDI_conserveChars, m_conserve );
62 a_writeInfo.addNodeStarter( a_indent, moniker( ), attributes );
63 m_group.toXMLList( a_writeInfo, indent2 );
64 a_writeInfo.addNodeEnder( moniker( ) );
65}
66
67}
#define GIDI_labelChars
Definition GIDI.hpp:438
#define GIDI_groupChars
Definition GIDI.hpp:237
#define GIDI_conserveChars
std::string const & label() const
Definition GIDI.hpp:658
Form(FormType a_type)
Definition GIDI_form.cc:25
std::string const & conserve() const
Definition GIDI.hpp:2913
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent) const
Transportable(Construction::Settings const &a_construction, HAPI::Node const &a_node, SetupInfo &a_setupInfo, PoPI::Database const &a_pops, Suite *a_parent)
Group const & group() const
Definition GIDI.hpp:2914
std::string const & moniker() const
Definition GUPI.hpp:102
void addNodeEnder(std::string const &a_moniker)
Definition GUPI.hpp:59
std::string incrementalIndent(std::string const &indent)
Definition GUPI.hpp:52
void addNodeStarter(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
Definition GUPI.hpp:55
std::string addAttribute(std::string const &a_name, std::string const &a_value) const
Definition GUPI.hpp:60
Definition GIDI.hpp:32
FormType
Definition GIDI.hpp:118