BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
DataLoaders1D Class Reference

Description

Collection of all available data loaders for 1D files.

Definition at line 27 of file DataLoaders1D.h.

Collaboration diagram for DataLoaders1D:
[legend]

Public Member Functions

 ~DataLoaders1D ()
 
void addBuiltInLoader (const QString &persistentClassName, const std::function< AbstractDataLoader1D *()> &create)
 Register a built-in loader with the given class name and factory function. More...
 
void addUserDefinedLoader (AbstractDataLoader1D *loader)
 add a user defined loader More...
 
AbstractDataLoader1DcreateFromPersistentName (const QString &persistentClassName)
 Notify loader was recently used. More...
 
QVector< AbstractDataLoader1D * > loaders () const
 all defined loaders. A null element in the list defines a separator The returned pointers are the same over the lifetime of the DataLoaders instance, therefore they can be used for comparison. More...
 
QVector< AbstractDataLoader1D * > recentlyUsedLoaders () const
 The last 10 recently used loaders. More...
 

Static Public Member Functions

static DataLoaders1Dinstance ()
 The one and only instance. More...
 

Private Member Functions

 DataLoaders1D ()=default
 
void initBuiltInLoaders ()
 create all default built in loaders More...
 

Private Attributes

QVector< AbstractDataLoader1D * > m_builtInLoaders
 
std::map< QString, std::function< AbstractDataLoader1D *()> > m_createLoaders
 
QVector< AbstractDataLoader1D * > m_recentlyUsedLoaders
 
QVector< AbstractDataLoader1D * > m_userDefinedLoaders
 

Constructor & Destructor Documentation

◆ ~DataLoaders1D()

DataLoaders1D::~DataLoaders1D ( )

Definition at line 18 of file DataLoaders1D.cpp.

19 {
20  qDeleteAll(m_builtInLoaders);
21  qDeleteAll(m_userDefinedLoaders);
22 }
QVector< AbstractDataLoader1D * > m_userDefinedLoaders
Definition: DataLoaders1D.h:64
QVector< AbstractDataLoader1D * > m_builtInLoaders
Definition: DataLoaders1D.h:62

References m_builtInLoaders, and m_userDefinedLoaders.

◆ DataLoaders1D()

DataLoaders1D::DataLoaders1D ( )
privatedefault

Member Function Documentation

◆ addBuiltInLoader()

void DataLoaders1D::addBuiltInLoader ( const QString &  persistentClassName,
const std::function< AbstractDataLoader1D *()> &  create 
)

Register a built-in loader with the given class name and factory function.

Definition at line 31 of file DataLoaders1D.cpp.

33 {
34  m_createLoaders.emplace(name, create);
35  m_builtInLoaders.push_back(create());
36 }
std::map< QString, std::function< AbstractDataLoader1D *()> > m_createLoaders
Definition: DataLoaders1D.h:65
QString const & name(EShape k)
Definition: particles.cpp:20

References m_builtInLoaders, m_createLoaders, and GUI::RealSpace::Particles::name().

Referenced by register1DDataLoaders().

Here is the call graph for this function:

◆ addUserDefinedLoader()

void DataLoaders1D::addUserDefinedLoader ( AbstractDataLoader1D loader)

add a user defined loader

Definition at line 38 of file DataLoaders1D.cpp.

39 {
40  m_userDefinedLoaders.push_back(loader);
41 }

References m_userDefinedLoaders.

Referenced by cloneAsUserDefinedLoader().

◆ createFromPersistentName()

AbstractDataLoader1D * DataLoaders1D::createFromPersistentName ( const QString &  persistentClassName)

Notify loader was recently used.

Create loader from the given persistent name

Definition at line 53 of file DataLoaders1D.cpp.

54 {
55  auto it = m_createLoaders.find(persistentClassName);
56 
57  if (it != m_createLoaders.end())
58  return it->second();
59  return nullptr;
60 }

References m_createLoaders.

◆ initBuiltInLoaders()

void DataLoaders1D::initBuiltInLoaders ( )
private

create all default built in loaders

◆ instance()

DataLoaders1D & DataLoaders1D::instance ( )
static

The one and only instance.

Definition at line 24 of file DataLoaders1D.cpp.

25 {
26  static DataLoaders1D inst;
27 
28  return inst;
29 }
Collection of all available data loaders for 1D files.
Definition: DataLoaders1D.h:27

Referenced by cloneAsUserDefinedLoader(), RealDataItem::deserializeBinaryData(), SpecularDataImportWidget::fillLoaderCombo(), RealDataSelectorWidget::importData1D(), register1DDataLoaders(), and SpecularDataImportWidget::selectedLoader().

◆ loaders()

QVector< AbstractDataLoader1D * > DataLoaders1D::loaders ( ) const

all defined loaders. A null element in the list defines a separator The returned pointers are the same over the lifetime of the DataLoaders instance, therefore they can be used for comparison.

Definition at line 43 of file DataLoaders1D.cpp.

44 {
46 }

References m_builtInLoaders, and m_userDefinedLoaders.

◆ recentlyUsedLoaders()

QVector< AbstractDataLoader1D * > DataLoaders1D::recentlyUsedLoaders ( ) const

The last 10 recently used loaders.

Definition at line 48 of file DataLoaders1D.cpp.

49 {
50  return m_recentlyUsedLoaders;
51 }
QVector< AbstractDataLoader1D * > m_recentlyUsedLoaders
Definition: DataLoaders1D.h:63

References m_recentlyUsedLoaders.

Member Data Documentation

◆ m_builtInLoaders

QVector<AbstractDataLoader1D*> DataLoaders1D::m_builtInLoaders
private

Definition at line 62 of file DataLoaders1D.h.

Referenced by ~DataLoaders1D(), addBuiltInLoader(), and loaders().

◆ m_createLoaders

std::map<QString, std::function<AbstractDataLoader1D*()> > DataLoaders1D::m_createLoaders
private

Definition at line 65 of file DataLoaders1D.h.

Referenced by addBuiltInLoader(), and createFromPersistentName().

◆ m_recentlyUsedLoaders

QVector<AbstractDataLoader1D*> DataLoaders1D::m_recentlyUsedLoaders
private

Definition at line 63 of file DataLoaders1D.h.

Referenced by recentlyUsedLoaders().

◆ m_userDefinedLoaders

QVector<AbstractDataLoader1D*> DataLoaders1D::m_userDefinedLoaders
private

Definition at line 64 of file DataLoaders1D.h.

Referenced by ~DataLoaders1D(), addUserDefinedLoader(), and loaders().


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