Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Friends | List of all members
Mantid::API::WorkspaceFactoryImpl Class Reference

The WorkspaceFactory class is in charge of the creation of all types of workspaces. More...

#include <WorkspaceFactory.h>

Inheritance diagram for Mantid::API::WorkspaceFactoryImpl:
Mantid::Kernel::DynamicFactory< Workspace >

Public Member Functions

MatrixWorkspace_sptr create (const MatrixWorkspace_const_sptr &parent, size_t NVectors=size_t(-1), size_t XLength=size_t(-1), size_t YLength=size_t(-1)) const
 Create a new instance of the same type of workspace as that given as argument. More...
 
MatrixWorkspace_sptr create (const std::string &className, const size_t &NVectors, const size_t &XLength, const size_t &YLength) const
 Creates a new instance of the class with the given name, and allocates memory for the arrays. More...
 
std::shared_ptr< IPeaksWorkspacecreatePeaks (const std::string &className="PeaksWorkspace") const
 Create a IPeaksWorkspace. More...
 
std::shared_ptr< ITableWorkspacecreateTable (const std::string &className="TableWorkspace") const
 Create a ITableWorkspace. More...
 
void initializeFromParent (const MatrixWorkspace &parent, MatrixWorkspace &child, const bool differentSize) const
 Initialize a workspace from its parent This sets values such as title, instrument, units, sample, spectramap. More...
 
WorkspaceFactoryImploperator= (const WorkspaceFactoryImpl &)=delete
 
 WorkspaceFactoryImpl (const WorkspaceFactoryImpl &)=delete
 
- Public Member Functions inherited from Mantid::Kernel::DynamicFactory< Workspace >
virtual std::shared_ptr< Workspacecreate (const std::string &className) const
 Creates a new instance of the class with the given name. More...
 
virtual WorkspacecreateUnwrapped (const std::string &className) const
 Creates a new instance of the class with the given name, which is not wrapped in a boost shared_ptr. More...
 
void disableNotifications ()
 Disable notifications. More...
 
 DynamicFactory (const DynamicFactory &)=delete
 
void enableNotifications ()
 Enable notifications. More...
 
bool exists (const std::string &className) const
 Returns true if the given class is currently registered. More...
 
virtual const std::vector< std::string > getKeys () const
 Returns the keys in the map. More...
 
DynamicFactoryoperator= (const DynamicFactory &)=delete
 
void subscribe (const std::string &className)
 Registers the instantiator for the given class with the DynamicFactory. More...
 
void subscribe (const std::string &className, std::unique_ptr< AbstractFactory > pAbstractFactory, SubscribeAction replace=ErrorIfExists)
 Registers the instantiator for the given class with the DynamicFactory. More...
 
void unsubscribe (const std::string &className)
 Unregisters the given class and deletes the instantiator for the class. More...
 
virtual ~DynamicFactory ()=default
 Destroys the DynamicFactory and deletes the instantiators for all registered classes. More...
 

Private Member Functions

 WorkspaceFactoryImpl ()
 Private Constructor for singleton class. More...
 
 ~WorkspaceFactoryImpl () override=default
 Private Destructor. More...
 

Friends

struct Mantid::Kernel::CreateUsingNew< WorkspaceFactoryImpl >
 

Additional Inherited Members

- Public Types inherited from Mantid::Kernel::DynamicFactory< Workspace >
using AbstractFactory = AbstractInstantiator< Workspace >
 A typedef for the instantiator. More...
 
enum  NotificationStatus
 Defines the whether notifications are dispatched. More...
 
enum  SubscribeAction
 Defines replacement behaviour. More...
 
- Public Attributes inherited from Mantid::Kernel::DynamicFactory< Workspace >
Poco::NotificationCenter notificationCenter
 Sends notifications to observers. More...
 
- Protected Member Functions inherited from Mantid::Kernel::DynamicFactory< Workspace >
 DynamicFactory ()
 Protected constructor for base class. More...
 

Detailed Description

The WorkspaceFactory class is in charge of the creation of all types of workspaces.

It inherits most of its implementation from the Dynamic Factory base class. It is implemented as a singleton class.

Author
Laurent C Chapon, ISIS, RAL
Russell Taylor, Tessella Support Services plc
Date
26/09/2007

Definition at line 44 of file WorkspaceFactory.h.

Constructor & Destructor Documentation

◆ WorkspaceFactoryImpl() [1/2]

Mantid::API::WorkspaceFactoryImpl::WorkspaceFactoryImpl ( const WorkspaceFactoryImpl )
delete

◆ WorkspaceFactoryImpl() [2/2]

Mantid::API::WorkspaceFactoryImpl::WorkspaceFactoryImpl ( )
private

Private Constructor for singleton class.

Private constructor for singleton class.

Definition at line 28 of file WorkspaceFactory.cpp.

References Mantid::Kernel::Logger::debug(), and Mantid::API::g_log.

◆ ~WorkspaceFactoryImpl()

Mantid::API::WorkspaceFactoryImpl::~WorkspaceFactoryImpl ( )
overrideprivatedefault

Private Destructor.

Member Function Documentation

◆ create() [1/2]

MatrixWorkspace_sptr Mantid::API::WorkspaceFactoryImpl::create ( const MatrixWorkspace_const_sptr parent,
size_t  NVectors = size_t(-1),
size_t  XLength = size_t(-1),
size_t  YLength = size_t(-1) 
) const

Create a new instance of the same type of workspace as that given as argument.

If the optional size parameters are given, the workspace will be initialised using those; otherwise it will be initialised to the same size as the parent. This method should be used when you want to carry over the Workspace data members relating to the Instrument, Spectra-Detector Map, Sample & Axes to the new workspace. If the workspace is the same size as its parent, then the X data, axes and mask list are copied. If its a different size then they are not.

Deprecated:
Replaced by functions in MantidDataObjects/WorkspaceCreation.h
Parameters
parentA shared pointer to the parent workspace
NVectors(Optional) The number of vectors/histograms/detectors in the workspace
XLength(Optional) The number of X data points/bin boundaries in each vector (must all be the same)
YLength(Optional) The number of data/error points in each vector (must all be the same)
Returns
A shared pointer to the newly created instance
Exceptions
std::out_of_rangeIf invalid (0 or less) size arguments are given
NotFoundExceptionIf the class is not registered in the factory

Definition at line 57 of file WorkspaceFactory.cpp.

References create(), and initializeFromParent().

Referenced by create(), createPeaks(), createTable(), and export_WorkspaceFactory().

◆ create() [2/2]

MatrixWorkspace_sptr Mantid::API::WorkspaceFactoryImpl::create ( const std::string &  className,
const size_t &  NVectors,
const size_t &  XLength,
const size_t &  YLength 
) const

Creates a new instance of the class with the given name, and allocates memory for the arrays.

Deprecated:
Replaced by functions in MantidDataObjects/WorkspaceCreation.h
Parameters
classNameThe name of the class you wish to create
NVectorsThe number of vectors/histograms/detectors in the workspace
XLengthThe number of X data points/bin boundaries in each vector (must all be the same)
YLengthThe number of data/error points in each vector (must all be the same)
Returns
A shared pointer to the newly created instance
Exceptions
std::out_of_rangeIf invalid (0 or less) size arguments are given
NotFoundExceptionIf the class is not registered in the factory

Definition at line 163 of file WorkspaceFactory.cpp.

References create(), Mantid::Kernel::Logger::error(), and Mantid::API::g_log.

◆ createPeaks()

IPeaksWorkspace_sptr Mantid::API::WorkspaceFactoryImpl::createPeaks ( const std::string &  className = "PeaksWorkspace") const

Create a IPeaksWorkspace.

Definition at line 191 of file WorkspaceFactory.cpp.

References create().

Referenced by export_WorkspaceFactory().

◆ createTable()

ITableWorkspace_sptr Mantid::API::WorkspaceFactoryImpl::createTable ( const std::string &  className = "TableWorkspace") const

Create a ITableWorkspace.

Definition at line 177 of file WorkspaceFactory.cpp.

References create().

Referenced by export_WorkspaceFactory().

◆ initializeFromParent()

void Mantid::API::WorkspaceFactoryImpl::initializeFromParent ( const MatrixWorkspace parent,
MatrixWorkspace child,
const bool  differentSize 
) const

◆ operator=()

WorkspaceFactoryImpl & Mantid::API::WorkspaceFactoryImpl::operator= ( const WorkspaceFactoryImpl )
delete

Friends And Related Function Documentation

◆ Mantid::Kernel::CreateUsingNew< WorkspaceFactoryImpl >

Definition at line 59 of file WorkspaceFactory.h.


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