Mantid
Loading...
Searching...
No Matches
BraggScattererFactory Class Reference

This class implements a factory for concrete BraggScatterer classes. More...

#include <BraggScattererFactory.h>

Detailed Description

This class implements a factory for concrete BraggScatterer classes.

When a new scatterer is derived from BraggScatterer, it should be registered in the factory. Like other factories in Mantid, a macro is provided for this purpose:

DECLARE_BRAGGSCATTERER(NewScattererClass)

At runtime, instances of this class can be created like this:

BraggScatterer_sptr scatterer =
BraggScattererFactory::Instance().createScatterer("NewScattererClass");

The returned object is initialized, which is required for using the Kernel::Property-based system of setting parameters for the scatterer. To make creation of scatterers more convenient, it's possible to provide a string with "name=value" pairs, separated by semi-colons, which assigns property values. This is similar to the way FunctionFactory::createInitialized works:

BraggScatterer_sptr s = BraggScattererFactory::Instance()
                                       .createScatterer(
                                            "NewScatterer",
                                            "SpaceGroup=F m -3 m;"
                                            "Position=[0.1,0.2,0.3]");

If you choose to use the raw create/createUnwrapped methods, you have to make sure to call BraggScatterer::initialize() on the created instance.

Author
Michael Wedel, Paul Scherrer Institut - SINQ
Date
26/10/2014

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