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

Collection of all available data loaders for 1D files. More...

Collaboration diagram for DataLoaders1D:
[legend]

Public Member Functions

 DataLoaders1D ()
 
 ~DataLoaders1D ()
 
void cloneAsUserDefinedLoader (AbstractDataLoader *loader, const QString &name)
 Clone the loader and create a user defined loader with its current settings and the given name. More...
 
AbstractDataLoader1DcreateFromPersistentName (const QString &persistentClassName)
 Create loader from the given persistent name. More...
 
QVector< AbstractDataLoader * > loaders () const
 all defined loaders. More...
 
QVector< AbstractDataLoader * > recentlyUsedLoaders () const
 The last 10 recently used loaders. More...
 
void setRecentlyUsedLoader (const AbstractDataLoader *loader)
 Notify loader was recently used. More...
 

Static Public Member Functions

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

Private Member Functions

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

Private Attributes

QVector< AbstractDataLoader * > m_builtInLoaders
 
QVector< AbstractDataLoader * > m_recentlyUsedLoaders
 
QVector< AbstractDataLoader * > m_userDefinedLoaders
 

Static Private Attributes

static DataLoaders1Dm_instance = nullptr
 

Detailed Description

Collection of all available data loaders for 1D files.

Definition at line 25 of file DataLoaders1D.h.

Constructor & Destructor Documentation

◆ DataLoaders1D()

DataLoaders1D::DataLoaders1D ( )

Definition at line 29 of file DataLoaders1D.cpp.

30 {
31  m_instance = this;
32 }
static DataLoaders1D * m_instance
Definition: DataLoaders1D.h:56

References m_instance.

◆ ~DataLoaders1D()

DataLoaders1D::~DataLoaders1D ( )

Definition at line 34 of file DataLoaders1D.cpp.

35 {
36  qDeleteAll(m_builtInLoaders);
37  qDeleteAll(m_userDefinedLoaders);
38 }
QVector< AbstractDataLoader * > m_userDefinedLoaders
Definition: DataLoaders1D.h:59
QVector< AbstractDataLoader * > m_builtInLoaders
Definition: DataLoaders1D.h:57

References m_builtInLoaders, and m_userDefinedLoaders.

Member Function Documentation

◆ cloneAsUserDefinedLoader()

void DataLoaders1D::cloneAsUserDefinedLoader ( AbstractDataLoader loader,
const QString &  name 
)

Clone the loader and create a user defined loader with its current settings and the given name.

Definition at line 67 of file DataLoaders1D.cpp.

68 {
69  loader->applyImportSettings();
70  auto clonedLoader = dynamic_cast<AbstractDataLoader1D*>(loader->clone());
71  const auto defaultProperties = loader->serialize();
72 
73  m_userDefinedLoaders << new UserDefinedDataLoader1D(clonedLoader, name, defaultProperties);
74 }
Base class for data loaders for 1D import.
virtual QByteArray serialize() const
Returns every internal setting so it can be restored completely.
virtual void applyImportSettings()
Read all values from the properties UI into the internal variables.
virtual AbstractDataLoader * clone() const =0
Create a complete clone, including all internal states.
A user defined data loader.
QString const & name(EShape k)
Definition: particles.cpp:21

References AbstractDataLoader::applyImportSettings(), AbstractDataLoader::clone(), m_userDefinedLoaders, RealSpace::Particles::name(), and AbstractDataLoader::serialize().

Referenced by SpecularDataImportWidget::onCreateNewFormatButton().

Here is the call graph for this function:

◆ createFromPersistentName()

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

Create loader from the given persistent name.

Definition at line 76 of file DataLoaders1D.cpp.

77 {
78  if (persistentClassName == AutomaticDataLoader1D().persistentClassName())
79  return new AutomaticDataLoader1D();
80 
81  if (persistentClassName == QREDataLoader().persistentClassName())
82  return new QREDataLoader();
83 
84  return nullptr;
85 }
Implements the legacy importer from BornAgain with no user interaction.
Real data loader for Q/R/E reflectometry CSV files.
Definition: QREDataLoader.h:27

◆ initBuiltInLoaders()

void DataLoaders1D::initBuiltInLoaders ( )
private

create all default built in loaders

Definition at line 45 of file DataLoaders1D.cpp.

46 {
47  // the ordering in here defines the ordering in the selection combo box in the open file dialog
48  // and also in the selection combo box on the format configuration page. Furthermore the first
49  // returned loader will be used as default in the open file dialog if it is started for the
50  // first time
53 }

References m_builtInLoaders.

Referenced by loaders().

◆ instance()

◆ loaders()

QVector< AbstractDataLoader * > 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 55 of file DataLoaders1D.cpp.

56 {
57  if (m_builtInLoaders.isEmpty())
58  const_cast<DataLoaders1D*>(this)->initBuiltInLoaders();
60 }
Collection of all available data loaders for 1D files.
Definition: DataLoaders1D.h:25
void initBuiltInLoaders()
create all default built in loaders

References initBuiltInLoaders(), m_builtInLoaders, and m_userDefinedLoaders.

Here is the call graph for this function:

◆ recentlyUsedLoaders()

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

The last 10 recently used loaders.

Definition at line 62 of file DataLoaders1D.cpp.

63 {
64  return m_recentlyUsedLoaders;
65 }
QVector< AbstractDataLoader * > m_recentlyUsedLoaders
Definition: DataLoaders1D.h:58

References m_recentlyUsedLoaders.

◆ setRecentlyUsedLoader()

void DataLoaders1D::setRecentlyUsedLoader ( const AbstractDataLoader loader)

Notify loader was recently used.

Member Data Documentation

◆ m_builtInLoaders

QVector<AbstractDataLoader*> DataLoaders1D::m_builtInLoaders
private

Definition at line 57 of file DataLoaders1D.h.

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

◆ m_instance

DataLoaders1D * DataLoaders1D::m_instance = nullptr
staticprivate

Definition at line 56 of file DataLoaders1D.h.

Referenced by DataLoaders1D(), and instance().

◆ m_recentlyUsedLoaders

QVector<AbstractDataLoader*> DataLoaders1D::m_recentlyUsedLoaders
private

Definition at line 58 of file DataLoaders1D.h.

Referenced by recentlyUsedLoaders().

◆ m_userDefinedLoaders

QVector<AbstractDataLoader*> DataLoaders1D::m_userDefinedLoaders
private

Definition at line 59 of file DataLoaders1D.h.

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


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