Geant4 11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
GIDI_axisDomain.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/*! \class AxisDomain
16 * Class to store a the minimum and maximum limits for a domain (i.e., a section of an axis) and its unit.
17 */
18
19/* *********************************************************************************************************//**
20 *
21 * @param a_node [in] The **HAPI::Node** to be parsed and used to construct the AxisDomain.
22 * @param a_setupInfo [in] Information create my the Protare constructor to help in parsing.
23 ***********************************************************************************************************/
24
25AxisDomain::AxisDomain( HAPI::Node const &a_node, SetupInfo &a_setupInfo ) :
26 Form( a_node, a_setupInfo, FormType::axisDomain ),
27 m_minimum( a_node.attribute_as_double( GIDI_minChars ) ),
28 m_maximum( a_node.attribute_as_double( GIDI_maxChars ) ),
29 m_unit( a_node.attribute_as_string( GIDI_unitChars ) ) {
30
31}
32
33/* *********************************************************************************************************//**
34 *
35 * @param a_minimum [in] The domain's minimum value.
36 * @param a_maximum [in] The domain's maximum.
37 * @param a_unit [in] The domain's unit.
38 ***********************************************************************************************************/
39
40AxisDomain::AxisDomain( double a_minimum, double a_maximum, std::string const &a_unit ) :
42 m_minimum( a_minimum ),
43 m_maximum( a_maximum ),
44 m_unit( a_unit ) {
45
46}
47
48/* *********************************************************************************************************//**
49 ***********************************************************************************************************/
50
54
55/* *********************************************************************************************************//**
56 * Fills the argument *a_writeInfo* with the XML lines that represent *this*. Recursively enters each sub-node.
57 *
58 * @param a_writeInfo [in/out] Instance containing incremental indentation and other information and stores the appended lines.
59 * @param a_indent [in] The amount to indent *this* node.
60 ***********************************************************************************************************/
61
62void AxisDomain::toXMLList( GUPI::WriteInfo &a_writeInfo, std::string const &a_indent ) const {
63
64 std::string attributes = a_writeInfo.addAttribute( GIDI_minChars, LUPI::Misc::doubleToShortestString( minimum( ) ) ) +
66 a_writeInfo.addAttribute( GIDI_unitChars, unit( ) );
67
68 a_writeInfo.addNodeStarterEnder( a_indent, moniker( ), attributes );
69}
70
71
72}
#define GIDI_unitChars
Definition GIDI.hpp:439
#define GIDI_minChars
Definition GIDI.hpp:443
#define GIDI_maxChars
Definition GIDI.hpp:444
double maximum() const
Definition GIDI.hpp:788
std::string const & unit() const
Definition GIDI.hpp:789
AxisDomain(HAPI::Node const &a_node, SetupInfo &a_setupInfo)
double minimum() const
Definition GIDI.hpp:787
void toXMLList(GUPI::WriteInfo &a_writeInfo, std::string const &a_indent) const
Form(FormType a_type)
Definition GIDI_form.cc:25
std::string const & moniker() const
Definition GUPI.hpp:102
void addNodeStarterEnder(std::string const &indent, std::string const &a_moniker, std::string const &a_attributes="")
Definition GUPI.hpp:57
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
std::string doubleToShortestString(double a_value, int a_significantDigits=15, int a_favorEFormBy=0)
Definition LUPI_misc.cc:349