BornAgain
1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Supports serialization to or deserialization from QXmlStream.
Can be either a writer or a reader, depending on the constructor.
Definition at line 36 of file Streamer.h.
Public Member Functions | |
Streamer (QXmlStreamReader *r) | |
Streamer (QXmlStreamWriter *w) | |
void | assertCurrentTag (const QString &expectedTag) const |
void | assertVersion (unsigned expectedVersion) const |
As reader, throws DeserializationException unless the expected version is read. As writer, does nothing. More... | |
void | finish (const QString &tag) |
void | gotoEndElementOfTag (const QString &tag) |
void | gotoStartElementOfTag (const QString &tag) |
template<typename Catalog , typename... Args> | |
void | read (const QString &tag, typename Catalog::CatalogedType *&p, Args... argsForConstructor) |
void | start (const QString &tag) |
template<typename Catalog > | |
void | write (const QString &tag, typename Catalog::CatalogedType *p) |
void | writeVersion (unsigned version) const |
As writer, serializes the given version number. As reader, does nothing. More... | |
QXmlStreamReader * | xmlReader () |
Returns stream reader or nullptr. More... | |
QXmlStreamWriter * | xmlWriter () |
Returns stream writer or nullptr. More... | |
Private Member Functions | |
void | assertCurrentToken (QXmlStreamReader::TokenType token) const |
Private Attributes | |
QXmlStreamReader * | m_r = nullptr |
QXmlStreamWriter * | m_w = nullptr |
|
inline |
Definition at line 38 of file Streamer.h.
|
inline |
Definition at line 42 of file Streamer.h.
void Streamer::assertCurrentTag | ( | const QString & | expectedTag | ) | const |
Definition at line 62 of file Streamer.cpp.
References m_r, and DeserializationException::streamError().
Referenced by gotoEndElementOfTag(), Serialize::rwCatalogized(), Serialize::rwProperty(), Serialize::rwValue(), and Serialize::rwVector().
|
private |
Definition at line 76 of file Streamer.cpp.
References m_r, and DeserializationException::streamError().
Referenced by gotoEndElementOfTag(), and gotoStartElementOfTag().
void Streamer::assertVersion | ( | unsigned | expectedVersion | ) | const |
As reader, throws DeserializationException unless the expected version is read. As writer, does nothing.
Definition at line 26 of file Streamer.cpp.
References m_r, DeserializationException::tooNew(), DeserializationException::tooOld(), and XML::Tags::Version().
Referenced by ProjectDocument::readProject(), AxisProperty::rwAxisProperty(), DistributionItem::serialize(), BasicAxisItem::serialize(), BeamItem::serialize(), InstrumentCollection::serialize(), InstrumentItem::serialize(), PolygonPointItem::serialize(), MaskItems::serialize(), FormFactorItem::serialize(), LayerItem::serialize(), LayerBasicRoughnessItem::serialize(), MaterialItem::serialize(), MaterialItems::serialize(), MultiLayerItem::serialize(), MultiLayerItems::serialize(), ParticleLayoutItem::serialize(), Profile1DItem::serialize(), Profile2DItem::serialize(), AmplitudeAxisItem::serialize(), ConstantBackgroundItem::serialize(), BeamAzimuthalAngleItem::serialize(), BeamInclinationAngleItem::serialize(), SpecularBeamItem::serialize(), BeamWavelengthItem::serialize(), FootprintGaussianItem::serialize(), FootprintSquareItem::serialize(), DepthProbeInstrumentItem::serialize(), Instrument2DItem::serialize(), OffspecInstrumentItem::serialize(), RectangleItem::serialize(), PolygonItem::serialize(), VerticalLineItem::serialize(), HorizontalLineItem::serialize(), EllipseItem::serialize(), MaskAllItem::serialize(), PointwiseAxisItem::serialize(), RectangularDetectorItem::serialize(), ResolutionFunction2DGaussianItem::serialize(), SpecularBeamInclinationItem::serialize(), SphericalDetectorItem::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 Streamer::finish | ( | const QString & | tag | ) |
Definition at line 90 of file Streamer.cpp.
References gotoEndElementOfTag(), and m_w.
Referenced by AxisProperty::rwAxisProperty(), Serialize::rwBaseClass(), and Serialize::rwClass().
void Streamer::gotoEndElementOfTag | ( | const QString & | tag | ) |
Definition at line 39 of file Streamer.cpp.
References assertCurrentTag(), assertCurrentToken(), and m_r.
Referenced by finish(), read(), Serialize::rwCatalogized(), Serialize::rwInitializable(), Serialize::rwOptional(), Serialize::rwProperty(), Serialize::rwValue(), and Serialize::rwVector().
void Streamer::gotoStartElementOfTag | ( | const QString & | tag | ) |
Definition at line 54 of file Streamer.cpp.
References assertCurrentToken(), and m_r.
Referenced by read(), Serialize::rwInitializable(), Serialize::rwOptional(), Serialize::rwValue(), and start().
void Streamer::read | ( | const QString & | tag, |
typename Catalog::CatalogedType *& | p, | ||
Args... | argsForConstructor | ||
) |
Definition at line 93 of file Streamer.h.
References gotoEndElementOfTag(), gotoStartElementOfTag(), and m_r.
Referenced by JobItem::readNonSessionItems(), Serialize::rwCatalogized(), and Serialize::rwSelected().
void Streamer::start | ( | const QString & | tag | ) |
Definition at line 82 of file Streamer.cpp.
References gotoStartElementOfTag(), and m_w.
Referenced by AxisProperty::rwAxisProperty(), Serialize::rwBaseClass(), and Serialize::rwClass().
void Streamer::write | ( | const QString & | tag, |
typename Catalog::CatalogedType * | p | ||
) |
Definition at line 82 of file Streamer.h.
References m_w.
Referenced by Serialize::rwCatalogized(), Serialize::rwSelected(), and JobItem::writeNonSessionItems().
void Streamer::writeVersion | ( | unsigned | version | ) | const |
As writer, serializes the given version number. As reader, does nothing.
Definition at line 19 of file Streamer.cpp.
References m_w, and XML::Tags::Version().
Referenced by ProjectDocument::writeTo().
|
inline |
Returns stream reader or nullptr.
Definition at line 48 of file Streamer.h.
References m_r.
Referenced by Serialize::rwCatalogized(), Serialize::rwInitializable(), Serialize::rwOptional(), Serialize::rwProperty(), Serialize::rwSelected(), Serialize::rwSessionItem(), Serialize::rwValue(), Serialize::rwVector(), MaskItems::serialize(), MaterialItem::serialize(), MaterialItems::serialize(), MultiLayerItem::serialize(), BeamAzimuthalAngleItem::serialize(), BeamInclinationAngleItem::serialize(), BeamWavelengthItem::serialize(), PolygonItem::serialize(), PointwiseAxisItem::serialize(), RectangularDetectorItem::serialize(), SpecularBeamInclinationItem::serialize(), and SphericalDetectorItem::serialize().
|
inline |
Returns stream writer or nullptr.
Definition at line 47 of file Streamer.h.
References m_w.
Referenced by Serialize::rwCatalogized(), Serialize::rwInitializable(), Serialize::rwOptional(), Serialize::rwProperty(), Serialize::rwSelected(), Serialize::rwSessionItem(), Serialize::rwValue(), Serialize::rwVector(), and PointwiseAxisItem::serialize().
|
private |
Definition at line 74 of file Streamer.h.
Referenced by assertCurrentTag(), assertCurrentToken(), assertVersion(), gotoEndElementOfTag(), gotoStartElementOfTag(), read(), and xmlReader().
|
private |
Definition at line 73 of file Streamer.h.
Referenced by finish(), start(), write(), writeVersion(), and xmlWriter().