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

Description

Handles all activity related to the simultaneous running of fitting jobs.

Definition at line 28 of file FitSessionManager.h.

Inheritance diagram for FitSessionManager:
[legend]
Collaboration diagram for FitSessionManager:
[legend]

Public Member Functions

 FitSessionManager (QObject *parent=nullptr)
 
 ~FitSessionManager ()
 
FitSessionControllersessionController (JobItem *jobItem)
 

Private Member Functions

FitSessionControllercreateController (JobItem *jobItem)
 
void removeController (JobItem *jobItem)
 Fit controller which is currently attached to jobMessagePanel. More...
 

Private Attributes

FitSessionControllerm_activeController
 
QMap< JobItem *, FitSessionController * > m_item_to_controller
 

Constructor & Destructor Documentation

◆ FitSessionManager()

FitSessionManager::FitSessionManager ( QObject *  parent = nullptr)

Definition at line 21 of file FitSessionManager.cpp.

22  : QObject(parent)
23  , m_activeController(nullptr)
24 {
25 }
FitSessionController * m_activeController

◆ ~FitSessionManager()

FitSessionManager::~FitSessionManager ( )

Definition at line 27 of file FitSessionManager.cpp.

28 {
29  for (auto* jobItem : m_item_to_controller.keys())
30  disconnect(jobItem, nullptr, this, nullptr);
31 }
QMap< JobItem *, FitSessionController * > m_item_to_controller

References m_item_to_controller.

Member Function Documentation

◆ createController()

FitSessionController * FitSessionManager::createController ( JobItem jobItem)
private

Definition at line 50 of file FitSessionManager.cpp.

51 {
52  // job destruction
53  connect(jobItem, &JobItem::jobDestroyed, this, [=]() { removeController(jobItem); });
54 
55  auto* result = new FitSessionController(this);
56  result->setItem(jobItem);
57  return result;
58 }
Controls all activity related to the single fitting task for JobItem. Provides interaction between Fi...
void removeController(JobItem *jobItem)
Fit controller which is currently attached to jobMessagePanel.
void jobDestroyed()

References JobItem::jobDestroyed(), and removeController().

Referenced by sessionController().

Here is the call graph for this function:

◆ removeController()

void FitSessionManager::removeController ( JobItem jobItem)
private

Fit controller which is currently attached to jobMessagePanel.

Removes manager for given jobItem.

Definition at line 62 of file FitSessionManager.cpp.

63 {
64  auto it = m_item_to_controller.find(jobItem);
65  if (it == m_item_to_controller.end())
66  throw Error("FitActivityManager::removeFitSession() -> Error. "
67  "Can't find fit session");
68 
69  if (m_activeController == it.value())
70  m_activeController = nullptr;
71  delete it.value();
72  m_item_to_controller.erase(it);
73 }

References Error, m_activeController, and m_item_to_controller.

Referenced by createController().

◆ sessionController()

FitSessionController * FitSessionManager::sessionController ( JobItem jobItem)

Definition at line 33 of file FitSessionManager.cpp.

34 {
35  FitSessionController* result(nullptr);
36 
37  auto it = m_item_to_controller.find(jobItem);
38  if (it == m_item_to_controller.end()) {
39  result = createController(jobItem);
40  m_item_to_controller.insert(jobItem, result);
41  } else {
42  result = it.value();
43  }
44 
45  m_activeController = result;
46 
47  return result;
48 }
FitSessionController * createController(JobItem *jobItem)

References createController(), m_activeController, and m_item_to_controller.

Referenced by FitActivityPanel::setItem().

Here is the call graph for this function:

Member Data Documentation

◆ m_activeController

FitSessionController* FitSessionManager::m_activeController
private

Definition at line 41 of file FitSessionManager.h.

Referenced by removeController(), and sessionController().

◆ m_item_to_controller

QMap<JobItem*, FitSessionController*> FitSessionManager::m_item_to_controller
private

Definition at line 42 of file FitSessionManager.h.

Referenced by ~FitSessionManager(), removeController(), and sessionController().


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