BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Functions to serialize various data types.
Serialization means writing to or reading from an XML stream.
This namespace is spread over several source files in order to keep include dependencies unidirectional.
Functions | |
template<typename BaseClass > | |
void | rwBaseClass (Streamer &s, const QString &tag, BaseClass *p) |
Serializes part of an items that belongs to a given base class. More... | |
template<typename Catalog , typename... Args> | |
void | rwCatalogized (Streamer &s, const QString &tag, QVector< typename Catalog::CatalogedType * > &vec, Args... argsForConstructor) |
Serializes a list of items from a class hierarchy described by a catalog. Passes optional arguments to the constructor. More... | |
template<typename T > | |
void | rwClass (Streamer &s, const QString &tag, T &t) |
Serializes an item from a class that provides the function void serialize(Streamer&) . More... | |
template<typename ItemClass > | |
void | rwInitializable (Streamer &s, const QString &tag, std::unique_ptr< ItemClass > &up, const std::function< void(ItemClass *)> &initializer) |
Serializes an optional item of known type that needs an initializer. More... | |
template<typename ItemClass , typename... ArgsForConstructor> | |
void | rwOptional (Streamer &s, const QString &tag, std::unique_ptr< ItemClass > &up, ArgsForConstructor... argsForConstructor) |
Serializes an optional item of known type. Passes optional arguments to the constructor. More... | |
void | rwProperty (Streamer &s, DoubleProperty &d) |
void | rwProperty (Streamer &s, UIntProperty &d) |
void | rwProperty (Streamer &s, VectorProperty &d) |
template<typename Catalog , typename... ArgsForCreation> | |
void | rwSelected (Streamer &s, SelectionProperty< typename Catalog::CatalogedType * > &d, ArgsForCreation... argsForCreation) |
Serializes an item from a catalog. Passes optional arguments to the constructor. More... | |
template<typename type > | |
void | rwSessionItem (Streamer &s, const QString &tag, SessionItem *property) |
Only for migration. More... | |
void | rwValue (Streamer &s, const QString &tag, bool &val) |
void | rwValue (Streamer &s, const QString &tag, double &val) |
void | rwValue (Streamer &s, const QString &tag, int &val) |
void | rwValue (Streamer &s, const QString &tag, QByteArray &val) |
void | rwValue (Streamer &s, const QString &tag, QColor &col) |
void | rwValue (Streamer &s, const QString &tag, QString &val) |
void | rwValue (Streamer &s, const QString &tag, R3 &val) |
template<typename T , typename... Args> | |
void | rwVector (Streamer &s, const QString &tag, QVector< T > &vec, Args... argsForConstructor) |
Serializes a list of items of known and fixed type. Passes optional arguments to the constructor. More... | |
void Serialize::rwBaseClass | ( | Streamer & | s, |
const QString & | tag, | ||
BaseClass * | p | ||
) |
Serializes part of an items that belongs to a given base class.
Definition at line 85 of file Serialize.h.
References Streamer::finish(), and Streamer::start().
void Serialize::rwCatalogized | ( | Streamer & | s, |
const QString & | tag, | ||
QVector< typename Catalog::CatalogedType * > & | vec, | ||
Args... | argsForConstructor | ||
) |
Serializes a list of items from a class hierarchy described by a catalog. Passes optional arguments to the constructor.
Definition at line 116 of file Serialize.h.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), Streamer::read(), Streamer::write(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwClass | ( | Streamer & | s, |
const QString & | tag, | ||
T & | t | ||
) |
Serializes an item from a class that provides the function void serialize(Streamer&)
.
Definition at line 77 of file Serialize.h.
References Streamer::finish(), and Streamer::start().
Referenced by rwVector(), BeamItem::serialize(), InstrumentItem::serialize(), MultiLayerItem::serialize(), RectangularDetectorItem::serialize(), and SphericalDetectorItem::serialize().
void Serialize::rwInitializable | ( | Streamer & | s, |
const QString & | tag, | ||
std::unique_ptr< ItemClass > & | up, | ||
const std::function< void(ItemClass *)> & | initializer | ||
) |
Serializes an optional item of known type that needs an initializer.
The initializer will be called after creation and before de-serialization
Definition at line 164 of file Serialize.h.
References Streamer::gotoEndElementOfTag(), Streamer::gotoStartElementOfTag(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwOptional | ( | Streamer & | s, |
const QString & | tag, | ||
std::unique_ptr< ItemClass > & | up, | ||
ArgsForConstructor... | argsForConstructor | ||
) |
Serializes an optional item of known type. Passes optional arguments to the constructor.
Definition at line 142 of file Serialize.h.
References Streamer::gotoEndElementOfTag(), Streamer::gotoStartElementOfTag(), Streamer::xmlReader(), and Streamer::xmlWriter().
Referenced by LayerItem::serialize(), and ParticleCoreShellItem::serialize().
void Serialize::rwProperty | ( | Streamer & | s, |
DoubleProperty & | d | ||
) |
Definition at line 65 of file DoubleProperty.cpp.
References Streamer::assertCurrentTag(), XML::Tags::Decimals(), DoubleProperty::decimals(), DoubleProperty::get(), Streamer::gotoEndElementOfTag(), XML::Tags::Id(), DoubleProperty::persistentTag(), DoubleProperty::set(), DoubleProperty::setDecimals(), DoubleProperty::setUid(), DoubleProperty::uid(), XML::Tags::Value(), GUI::Session::XML::writeAttribute(), Streamer::xmlReader(), and Streamer::xmlWriter().
Referenced by AxisProperty::rwAxisProperty(), DistributionItem::serialize(), BeamItem::serialize(), InstrumentItem::serialize(), FormFactorItem::serialize(), LayerItem::serialize(), LayerBasicRoughnessItem::serialize(), MultiLayerItem::serialize(), ParticleLayoutItem::serialize(), Profile1DItem::serialize(), Profile2DItem::serialize(), ConstantBackgroundItem::serialize(), FootprintGaussianItem::serialize(), FootprintSquareItem::serialize(), RectangularDetectorItem::serialize(), ResolutionFunction2DGaussianItem::serialize(), Interference1DLatticeItem::serialize(), Interference2DLatticeItem::serialize(), Interference2DParaCrystalItem::serialize(), InterferenceFinite2DLatticeItem::serialize(), InterferenceHardDiskItem::serialize(), InterferenceRadialParaCrystalItem::serialize(), BasicLattice2DItem::serialize(), SquareLattice2DItem::serialize(), HexagonalLattice2DItem::serialize(), MesoCrystalItem::serialize(), ParticleCompositionItem::serialize(), ParticleCoreShellItem::serialize(), ParticleItem::serialize(), Profile1DVoigtItem::serialize(), Profile2DVoigtItem::serialize(), XRotationItem::serialize(), YRotationItem::serialize(), ZRotationItem::serialize(), EulerRotationItem::serialize(), and InterferenceItem::serialize().
void Serialize::rwProperty | ( | Streamer & | s, |
UIntProperty & | d | ||
) |
Definition at line 44 of file UIntProperty.cpp.
References Streamer::assertCurrentTag(), UIntProperty::get(), Streamer::gotoEndElementOfTag(), XML::Tags::Id(), UIntProperty::persistentTag(), UIntProperty::set(), UIntProperty::setUid(), UIntProperty::uid(), XML::Tags::Value(), GUI::Session::XML::writeAttribute(), GUI::Session::XML::writeUid(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwProperty | ( | Streamer & | s, |
VectorProperty & | d | ||
) |
Definition at line 31 of file VectorProperty.cpp.
References Streamer::assertCurrentTag(), VectorProperty::get(), Streamer::gotoEndElementOfTag(), XML::Tags::Id(), VectorProperty::persistentTag(), GUI::Session::XML::readAttribute(), VectorProperty::set(), VectorProperty::setUid(), VectorProperty::uid(), XML::Tags::Value(), GUI::Session::XML::writeAttribute(), GUI::Session::XML::writeUid(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwSelected | ( | Streamer & | s, |
SelectionProperty< typename Catalog::CatalogedType * > & | d, | ||
ArgsForCreation... | argsForCreation | ||
) |
Serializes an item from a catalog. Passes optional arguments to the constructor.
Definition at line 206 of file SelectionProperty.h.
References SelectionProperty< T >::get(), SelectionProperty< T >::persistentTag(), Streamer::read(), SelectionProperty< T >::set(), Streamer::write(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwSessionItem | ( | Streamer & | s, |
const QString & | tag, | ||
SessionItem * | property | ||
) |
Only for migration.
Definition at line 428 of file SessionItem.h.
References rwValue(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
bool & | val | ||
) |
Definition at line 19 of file Serialize.cpp.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), XML::Tags::Value(), Streamer::xmlReader(), and Streamer::xmlWriter().
Referenced by rwSessionItem(), InstrumentItem::serialize(), LayerItem::serialize(), MaterialItem::serialize(), MultiLayerItem::serialize(), PointwiseAxisItem::serialize(), RectangularDetectorItem::serialize(), SpecularBeamInclinationItem::serialize(), Interference2DLatticeItem::serialize(), Interference2DParaCrystalItem::serialize(), InterferenceFinite2DLatticeItem::serialize(), and ParticleItem::serialize().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
double & | val | ||
) |
Definition at line 49 of file Serialize.cpp.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), XML::Tags::Value(), GUI::Session::XML::writeAttribute(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
int & | val | ||
) |
Definition at line 34 of file Serialize.cpp.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), XML::Tags::Value(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
QByteArray & | val | ||
) |
Definition at line 95 of file Serialize.cpp.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
QColor & | col | ||
) |
Definition at line 79 of file Serialize.cpp.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), XML::Tags::Value(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
QString & | val | ||
) |
Definition at line 64 of file Serialize.cpp.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), GUI::Session::XML::readAttribute(), XML::Tags::Value(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwValue | ( | Streamer & | s, |
const QString & | tag, | ||
R3 & | val | ||
) |
Definition at line 111 of file Serialize.cpp.
References Streamer::gotoEndElementOfTag(), Streamer::gotoStartElementOfTag(), GUI::Session::XML::readAttribute(), XML::Tags::Value(), GUI::Session::XML::writeAttribute(), Streamer::xmlReader(), and Streamer::xmlWriter().
void Serialize::rwVector | ( | Streamer & | s, |
const QString & | tag, | ||
QVector< T > & | vec, | ||
Args... | argsForConstructor | ||
) |
Serializes a list of items of known and fixed type. Passes optional arguments to the constructor.
Definition at line 93 of file Serialize.h.
References Streamer::assertCurrentTag(), Streamer::gotoEndElementOfTag(), rwClass(), Streamer::xmlReader(), and Streamer::xmlWriter().
Referenced by LayerItem::serialize(), MaterialItems::serialize(), MultiLayerItem::serialize(), MultiLayerItems::serialize(), and PolygonItem::serialize().