BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::ProjectChangedController Class Reference

Tracks changes in all models. More...

Classes

struct  ProjectChangedControllerImpl
 

Public Types

using callback_t = std::function< void()>
 

Public Member Functions

 ProjectChangedController (const std::vector< SessionModel * > &models, callback_t project_changed_callback={})
 
 ~ProjectChangedController ()
 
bool hasChanged () const
 Returns true if the change in the models has been registered since the last call of resetChanged. More...
 
void resetChanged ()
 Reset controller to initial state, pretending that no changes has been registered. More...
 

Private Attributes

std::unique_ptr< ProjectChangedControllerImplp_impl
 

Detailed Description

Tracks changes in all models.

Allows to check if one or more models have been changed since last call of ::resetChanged(). This is intended to work together with the Project class. It will take care of calling resetChanged after own saving. To avoid extra signaling while being in already "changed" mode, the controller reports only once.

Definition at line 36 of file projectchangecontroller.h.

Member Typedef Documentation

◆ callback_t

using ModelView::ProjectChangedController::callback_t = std::function<void()>

Definition at line 38 of file projectchangecontroller.h.

Constructor & Destructor Documentation

◆ ProjectChangedController()

ProjectChangedController::ProjectChangedController ( const std::vector< SessionModel * > &  models,
callback_t  project_changed_callback = {} 
)

Definition at line 61 of file projectchangecontroller.cpp.

63  : p_impl(std::make_unique<ProjectChangedControllerImpl>(models, project_changed_callback))
64 {
65 }
std::unique_ptr< ProjectChangedControllerImpl > p_impl

◆ ~ProjectChangedController()

ProjectChangedController::~ProjectChangedController ( )
default

Member Function Documentation

◆ hasChanged()

bool ProjectChangedController::hasChanged ( ) const

Returns true if the change in the models has been registered since the last call of resetChanged.

Definition at line 72 of file projectchangecontroller.cpp.

73 {
74  return p_impl->hasChanged();
75 }

References p_impl.

Referenced by TEST_F().

◆ resetChanged()

void ProjectChangedController::resetChanged ( )

Reset controller to initial state, pretending that no changes has been registered.

Definition at line 79 of file projectchangecontroller.cpp.

80 {
81  return p_impl->resetChanged();
82 }

References p_impl.

Referenced by ModelView::Project::ProjectImpl::process(), and TEST_F().

Member Data Documentation

◆ p_impl

std::unique_ptr<ProjectChangedControllerImpl> ModelView::ProjectChangedController::p_impl
private

Definition at line 49 of file projectchangecontroller.h.

Referenced by hasChanged(), and resetChanged().


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