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

The AppSvc class provides common access for key components of the GUI. More...

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

Static Public Member Functions

static AppSvcinstance ()
 
static MaterialModelmaterialModel ()
 
static ProjectManagerprojectManager ()
 
static void subscribe (MaterialModel *materialModel)
 
static void subscribe (ProjectManager *projectManager)
 
static void unsubscribe (MaterialModel *materialModel)
 
static void unsubscribe (ProjectManager *projectManager)
 

Private Member Functions

 AppSvc ()
 
MaterialModelthis_materialModel ()
 
ProjectManagerthis_projectManager ()
 
void this_subscribe (MaterialModel *materialModel)
 
void this_subscribe (ProjectManager *projectManager)
 
void this_unsubscribe (MaterialModel *materialModel)
 
void this_unsubscribe (ProjectManager *projectManager)
 

Private Attributes

MaterialModelm_materialModel
 
ProjectManagerm_projectManager
 

Friends

class ISingleton< AppSvc >
 

Detailed Description

The AppSvc class provides common access for key components of the GUI.

Definition at line 25 of file AppSvc.h.

Constructor & Destructor Documentation

◆ AppSvc()

AppSvc::AppSvc ( )
private

Definition at line 48 of file AppSvc.cpp.

48 : m_projectManager(nullptr), m_materialModel(nullptr) {}
MaterialModel * m_materialModel
Definition: AppSvc.h:47
ProjectManager * m_projectManager
Definition: AppSvc.h:46

Member Function Documentation

◆ instance()

static AppSvc & ISingleton< AppSvc >::instance ( )
inlinestaticinherited

Definition at line 23 of file ISingleton.h.

24  {
25  static T m_instance;
26  return m_instance;
27  }

◆ materialModel()

MaterialModel * AppSvc::materialModel ( )
static

Definition at line 33 of file AppSvc.cpp.

34 {
35  return instance().this_materialModel();
36 }
MaterialModel * this_materialModel()
Definition: AppSvc.cpp:59
static AppSvc & instance()
Definition: ISingleton.h:23

References ISingleton< AppSvc >::instance(), and this_materialModel().

Referenced by MaterialModel::MaterialModel(), MaterialModel::~MaterialModel(), RealSpaceBuilderUtils::applyParticleColor(), MaterialItemUtils::defaultMaterialProperty(), MaterialItemUtils::findMaterial(), MaterialItemUtils::selectMaterialProperty(), subscribe(), this_subscribe(), this_unsubscribe(), and unsubscribe().

Here is the call graph for this function:

◆ projectManager()

ProjectManager * AppSvc::projectManager ( )
static

◆ subscribe() [1/2]

void AppSvc::subscribe ( MaterialModel materialModel)
static

Definition at line 38 of file AppSvc.cpp.

39 {
41 }
void this_subscribe(ProjectManager *projectManager)
Definition: AppSvc.cpp:64
static MaterialModel * materialModel()
Definition: AppSvc.cpp:33

References ISingleton< AppSvc >::instance(), materialModel(), and this_subscribe().

Here is the call graph for this function:

◆ subscribe() [2/2]

void AppSvc::subscribe ( ProjectManager projectManager)
static

Definition at line 23 of file AppSvc.cpp.

24 {
26 }
static ProjectManager * projectManager()
Definition: AppSvc.cpp:18

References ISingleton< AppSvc >::instance(), projectManager(), and this_subscribe().

Referenced by MaterialModel::MaterialModel(), and ProjectManager::ProjectManager().

Here is the call graph for this function:

◆ this_materialModel()

MaterialModel * AppSvc::this_materialModel ( )
private

Definition at line 59 of file AppSvc.cpp.

60 {
61  return m_materialModel;
62 }

References m_materialModel.

Referenced by materialModel().

◆ this_projectManager()

ProjectManager * AppSvc::this_projectManager ( )
private

Definition at line 50 of file AppSvc.cpp.

51 {
52  if (!m_projectManager)
53  throw GUIHelpers::Error("AppSvc::projectManager() -> Error. Attempt to access "
54  "non existing ProjectManager.");
55 
56  return m_projectManager;
57 }

References m_projectManager.

Referenced by projectManager().

◆ this_subscribe() [1/2]

void AppSvc::this_subscribe ( MaterialModel materialModel)
private

Definition at line 82 of file AppSvc.cpp.

83 {
84  if (m_materialModel)
85  throw GUIHelpers::Error("AppSvc::projectManager() -> Error. Attempt to subscribe "
86  "MaterialModel twice.");
87 
89 }

References m_materialModel, and materialModel().

Here is the call graph for this function:

◆ this_subscribe() [2/2]

void AppSvc::this_subscribe ( ProjectManager projectManager)
private

Definition at line 64 of file AppSvc.cpp.

65 {
66  if (m_projectManager != nullptr)
67  throw GUIHelpers::Error("AppSvc::projectManager() -> Error. Attempt to subscribe "
68  "ProjectManager twice.");
69 
71 }

References m_projectManager, and projectManager().

Referenced by subscribe().

Here is the call graph for this function:

◆ this_unsubscribe() [1/2]

void AppSvc::this_unsubscribe ( MaterialModel materialModel)
private

Definition at line 91 of file AppSvc.cpp.

92 {
94  throw GUIHelpers::Error("AppSvc::projectManager() -> Error. Attempt to unsubscribe "
95  "MaterialModel before it was subscribed.");
96 
97  m_materialModel = nullptr;
98 }

References m_materialModel, and materialModel().

Here is the call graph for this function:

◆ this_unsubscribe() [2/2]

void AppSvc::this_unsubscribe ( ProjectManager projectManager)
private

Definition at line 73 of file AppSvc.cpp.

74 {
76  throw GUIHelpers::Error("AppSvc::projectManager() -> Error. Attempt to unsubscribe "
77  "ProjectManager before it was subscribed.");
78 
79  m_projectManager = nullptr;
80 }

References m_projectManager, and projectManager().

Referenced by unsubscribe().

Here is the call graph for this function:

◆ unsubscribe() [1/2]

void AppSvc::unsubscribe ( MaterialModel materialModel)
static

Definition at line 43 of file AppSvc.cpp.

44 {
46 }
void this_unsubscribe(ProjectManager *projectManager)
Definition: AppSvc.cpp:73

References ISingleton< AppSvc >::instance(), materialModel(), and this_unsubscribe().

Here is the call graph for this function:

◆ unsubscribe() [2/2]

void AppSvc::unsubscribe ( ProjectManager projectManager)
static

Definition at line 28 of file AppSvc.cpp.

References ISingleton< AppSvc >::instance(), projectManager(), and this_unsubscribe().

Referenced by MaterialModel::~MaterialModel(), and ProjectManager::~ProjectManager().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ ISingleton< AppSvc >

friend class ISingleton< AppSvc >
friend

Definition at line 1 of file AppSvc.h.

Member Data Documentation

◆ m_materialModel

MaterialModel* AppSvc::m_materialModel
private

Definition at line 47 of file AppSvc.h.

Referenced by this_materialModel(), this_subscribe(), and this_unsubscribe().

◆ m_projectManager

ProjectManager* AppSvc::m_projectManager
private

Definition at line 46 of file AppSvc.h.

Referenced by this_projectManager(), this_subscribe(), and this_unsubscribe().


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