PandA-2024.02
Macros
xml_helper.hpp File Reference

Some macro used to interface with the XML library. More...

#include "string_manipulation.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/typeof/typeof.hpp>
Include dependency graph for xml_helper.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WRITE_XVM(variable, node)   (node)->set_attribute(#variable, STR(variable))
 WRITE XML Value Macro. Insert a value in an XML tree. More...
 
#define WRITE_XNVM(variable, value, node)   (node)->set_attribute(#variable, value)
 WRITE XML Name Value Macro. More...
 
#define WRITE_XNVM2(name, value, node)   (node)->set_attribute(name, value)
 WRITE XML Name Value Macro second version. Insert a value in an XML tree given the name of the attribute. More...
 
#define WRITE_VALUE(variable, node)   WRITE_XNVM(value, STR(variable), (node)->add_child(#variable))
 WRITE XML Name Value Macro third version. More...
 
#define LOAD_XVM(variable, node)   variable = boost::lexical_cast<BOOST_TYPEOF_TPL(variable)>((node)->get_attribute(#variable)->get_value())
 LOAD XML Value Macro. Set a variable starting from an XML value. Conversion is performed if needed. More...
 
#define LOAD_XVFM(variable, node, field)   variable = boost::lexical_cast<BOOST_TYPEOF_TPL(variable)>((node)->get_attribute(#field)->get_value())
 LOAD XML Value for field Macro. Set a variable starting from an XML value. Conversion is performed if needed. More...
 
#define LOAD_XVM_LD(variable, node)   variable = strtold(((node)->get_attribute(#variable)->get_value()).c_str(), nullptr)
 under windows long double numbers are not correctly managed. This hack solves the problem More...
 
#define LOAD_VALUE(variable, node)
 LOAD XML Value Macro. More...
 
#define GET_STRING_VALUE(node)   STR((node)->get_attribute("value")->get_value())
 LOAD XML Value Macro. More...
 
#define GET_NODE_NAME(node)   ((node)->get_name())
 
#define CE_XVM(variable, node)   (node)->get_attribute(#variable)
 Check existence XML Value Macro. Check if an XML attribute is present in the XML tree. More...
 

Detailed Description

Some macro used to interface with the XML library.

Author
Fabrizio Ferrandi fabri.nosp@m.zio..nosp@m.ferra.nosp@m.ndi@.nosp@m.polim.nosp@m.i.it $Revision$ $Date$ Last modified by $Author$

Definition in file xml_helper.hpp.

Macro Definition Documentation

◆ CE_XVM

#define CE_XVM (   variable,
  node 
)    (node)->get_attribute(#variable)

◆ GET_NODE_NAME

#define GET_NODE_NAME (   node)    ((node)->get_name())

◆ GET_STRING_VALUE

#define GET_STRING_VALUE (   node)    STR((node)->get_attribute("value")->get_value())

LOAD XML Value Macro.

Set a variable starting from an XML attribute composed of name and value. Conversion is performed if needed.

Definition at line 83 of file xml_helper.hpp.

Referenced by Parameter::load_xml_configuration_file(), and Parameter::load_xml_configuration_file_rec().

◆ LOAD_VALUE

#define LOAD_VALUE (   variable,
  node 
)
Value:
if((node)->get_name() == #variable) \
(variable) = boost::lexical_cast<BOOST_TYPEOF_TPL(variable)>((node)->get_attribute("value")->get_value())

LOAD XML Value Macro.

Set a variable starting from an XML attribute composed of name and value. Conversion is performed if needed.

Definition at line 77 of file xml_helper.hpp.

◆ LOAD_XVFM

#define LOAD_XVFM (   variable,
  node,
  field 
)    variable = boost::lexical_cast<BOOST_TYPEOF_TPL(variable)>((node)->get_attribute(#field)->get_value())

LOAD XML Value for field Macro. Set a variable starting from an XML value. Conversion is performed if needed.

Definition at line 69 of file xml_helper.hpp.

Referenced by BackendFlow::xload(), structural_type_descriptor::xload(), operation::xload(), port_o::xload(), action_o::xload(), constant_o::xload(), and module::xload().

◆ LOAD_XVM

#define LOAD_XVM (   variable,
  node 
)    variable = boost::lexical_cast<BOOST_TYPEOF_TPL(variable)>((node)->get_attribute(#variable)->get_value())

◆ LOAD_XVM_LD

#define LOAD_XVM_LD (   variable,
  node 
)    variable = strtold(((node)->get_attribute(#variable)->get_value()).c_str(), nullptr)

under windows long double numbers are not correctly managed. This hack solves the problem

Definition at line 73 of file xml_helper.hpp.

◆ WRITE_VALUE

#define WRITE_VALUE (   variable,
  node 
)    WRITE_XNVM(value, STR(variable), (node)->add_child(#variable))

WRITE XML Name Value Macro third version.

Insert a value in an XML tree given the name of the attribute; it sets the attribute with "value" field. It adds a child to node with variable name

Definition at line 62 of file xml_helper.hpp.

◆ WRITE_XNVM

#define WRITE_XNVM (   variable,
  value,
  node 
)    (node)->set_attribute(#variable, value)

WRITE XML Name Value Macro.

Insert a value in an XML tree given the name of the attribute. The name is converted in a string.

Definition at line 55 of file xml_helper.hpp.

Referenced by structural_type_descriptor::xwrite(), operation::xwrite(), memory::xwrite(), port_o::xwrite(), action_o::xwrite(), and memory::xwrite2().

◆ WRITE_XNVM2

#define WRITE_XNVM2 (   name,
  value,
  node 
)    (node)->set_attribute(name, value)

◆ WRITE_XVM

#define WRITE_XVM (   variable,
  node 
)    (node)->set_attribute(#variable, STR(variable))

Generated on Mon Feb 12 2024 13:03:36 for PandA-2024.02 by doxygen 1.8.13