STIR  6.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
stir::ParsingObject Class Reference

A base class for objects that want to be able to parse parameter files. More...

#include "stir/ParsingObject.h"

Inheritance diagram for stir::ParsingObject:
Inheritance graph
[legend]

Public Member Functions

 ParsingObject (const ParsingObject &)
 
ParsingObjectoperator= (const ParsingObject &)
 
void ask_parameters ()
 
virtual std::string parameter_info ()
 
parsing functions

parse() returns false if there is some error, true otherwise.

bool parse (std::istream &f)
 
bool parse (const char *const filename)
 

Protected Member Functions

virtual void set_defaults ()
 Set defaults before parsing.
 
virtual void initialise_keymap ()
 Initialise all keywords.
 
virtual bool post_processing ()
 This will be called at the end of the parsing. More...
 
virtual void set_key_values ()
 This will be called before parsing or parameter_info is called. More...
 

Protected Attributes

KeyParser parser
 

Detailed Description

A base class for objects that want to be able to parse parameter files.

This class is essentially a wrapper for KeyParser, such that it is safe to copy ParsingObject objects. The problem with KeyParser is that it stores pointers to the variables it needs to fill in. So, if you copy one KeyParser object to another, both will fill in the same variables (unless add_key is called afterwards). ParsingObject solves this by having a copy constructor that reinitialises all keys in its own (protected) KeyParser object.

Warning
All this only works when all keys are set in the initialise_keymap() function, and only there.
See also
KeyParser

Member Function Documentation

◆ post_processing()

bool stir::ParsingObject::post_processing ( )
protectedvirtual

This will be called at the end of the parsing.

Returns
false if everything OK, true if not

Reimplemented in stir::PoissonLogLikelihoodWithLinearModelForMeanAndProjData< TargetT >, stir::IterativeReconstruction< TargetT >, stir::PoissonLogLikelihoodWithLinearModelForMean< TargetT >, stir::LmToProjData, stir::ScatterSimulation, stir::FourierRebinning, stir::ScatterEstimation, stir::KOSMAPOSLReconstruction< TargetT >, stir::Reconstruction< TargetT >, stir::Reconstruction< DiscretisedDensity< 3, float > >, stir::RelativeDifferencePrior< elemT >, stir::SAFIRCListmodeInputFileFormat< EventDataType >, stir::PoissonLogLikelihoodWithLinearModelForMeanAndGatedProjDataWithMotion< TargetT >, stir::OSMAPOSLReconstruction< TargetT >, stir::PLSPrior< elemT >, stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeData< TargetT >, stir::LogcoshPrior< elemT >, stir::PoissonLogLikelihoodWithLinearKineticModelAndDynamicProjectionData< TargetT >, stir::QuadraticPrior< elemT >, stir::QuadraticPrior< float >, stir::InputStreamFromROOTFile, stir::ProjMatrixByBin, stir::ParametricQuadraticPrior< TargetT >, stir::OSSPSReconstruction< TargetT >, stir::FindMCNormFactors, stir::OutputFileFormat< DataT >, stir::OutputFileFormat< DiscretisedDensity< 3, float > >, stir::OutputFileFormat< ParametricDiscretisedDensity< DiscretisedDensityT > >, stir::OutputFileFormat< DynamicDiscretisedDensity >, stir::OutputFileFormat< ParametricDiscretisedDensity< DiscDensityT > >, stir::PoissonLogLikelihoodWithLinearModelForMeanAndDynamicProjData< TargetT >, stir::EllipsoidalCylinder, stir::PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin< TargetT >, stir::ProjDataRebinning, stir::InputStreamFromROOTFileForCylindricalPET, stir::AnalyticReconstruction, stir::MatchTrackerAndScanner, stir::InputStreamFromROOTFileForECATPET, stir::Shape3DWithOrientation, stir::HUToMuImageProcessor< TargetT >, stir::RigidObject3DMotion, stir::Ellipsoid, stir::TimeFrameMotion, stir::InputStreamWithRecordsFromUPENNbin, stir::CreateTailMaskFromACFs, stir::InputStreamWithRecordsFromUPENN, stir::InputStreamWithRecordsFromUPENNtxt, stir::RigidObject3DMotionFromPolaris, stir::ecat::ecat7::ECAT7ParametricDensityOutputFileFormat< DiscretisedDensityT >, stir::ITKOutputFileFormat, stir::InterfileParametricDiscretisedDensityOutputFileFormat< DiscDensityT >, stir::MoveImage, stir::ecat::ecat7::ECAT7DynamicDiscretisedDensityOutputFileFormat, stir::ecat::ecat6::ECAT6OutputFileFormat, stir::ecat::ecat7::ECAT7OutputFileFormat, stir::MoveProjData, stir::BinNormalisationWithCalibration, stir::ReportMovement, stir::NonRigidObjectTransformationUsingBSplines< num_dimensions, elemT >, stir::MyApp, stir::MultiDynamicDiscretisedDensityOutputFileFormat, stir::SingleScatterSimulation, stir::MultiParametricDiscretisedDensityOutputFileFormat< DiscDensityT >, stir::InterfileDynamicDiscretisedDensityOutputFileFormat, stir::InterfileOutputFileFormat, and stir::LmToProjDataWithMC.

Referenced by stir::DiscretisedShape3D::DiscretisedShape3D().

◆ set_key_values()

void stir::ParsingObject::set_key_values ( )
protectedvirtual

This will be called before parsing or parameter_info is called.

This virtual function should be overloaded when the values for the keywords depend on other variables in the derived class that can be set independently of the parsing.

Example:

A derived class has a public member angle_in_radians, while a keyword sets a private member angle_in_degrees.

Reimplemented in stir::OutputFileFormat< DataT >, stir::OutputFileFormat< DiscretisedDensity< 3, float > >, stir::OutputFileFormat< ParametricDiscretisedDensity< DiscretisedDensityT > >, stir::OutputFileFormat< DynamicDiscretisedDensity >, stir::OutputFileFormat< ParametricDiscretisedDensity< DiscDensityT > >, stir::Shape3DWithOrientation, and stir::NonRigidObjectTransformationUsingBSplines< num_dimensions, elemT >.

References stir::error(), and stir::warning().


The documentation for this class was generated from the following files: