11 return Core.GetOwnerThreadID();
16 const auto NotConnectedResource = std::find_if(
cbegin(),
cend(), [](
const auto& i) {
17 const auto ExceptionPtr = i.second.ResourcePointer->GetException();
19 std::rethrow_exception(ExceptionPtr);
21 return !i.second.ResourcePointer->IsConnected();
25 return NotConnectedResource ==
cend();
35 std::exception_ptr FirstException;
37 std::for_each(
cbegin(),
cend(), [FunctionToCallWhenObjectStarted, &FirstException](
const auto& i) {
40 i.second.ResourcePointer->EnsureReadyState(
false);
42 if (FunctionToCallWhenObjectStarted)
43 FunctionToCallWhenObjectStarted(i.second.ResourcePointer.get());
48 FirstException = std::current_exception();
53 std::rethrow_exception(FirstException);
58 QDomElement ManagerNode = Document.createElement(
"HardwareAdapters");
65 return std::count_if(
cbegin(),
cend(), [](
const auto& i) {
return i.second.ResourcePointer->IsRunning(); });
70 const auto NotInitializedResource = std::find_if(
cbegin(),
cend(), [](
const auto& i) {
71 const auto ExceptionPtr = i.second.ResourcePointer->GetException();
73 std::rethrow_exception(ExceptionPtr);
75 return !i.second.ResourcePointer->IsInitialized() && i.second.ResourcePointer->GetStartupType() == RunnableObjectParams::StartupType::OnCreation;
79 return NotInitializedResource ==
cend();
84 std::for_each(
cbegin(),
cend(), [](
const auto& i) { i.second.ResourcePointer->Terminate(); });
89 std::for_each(
cbegin(),
cend(), [FunctionToCallWhenObjectStarted](
const auto& i) {
90 const bool HasBeenStarted = i.second.ResourcePointer->RunIfRunOnCreation();
92 if (HasBeenStarted && FunctionToCallWhenObjectStarted)
93 FunctionToCallWhenObjectStarted(i.second.ResourcePointer.get());
99 QDomElement ManagerNode = Document.createElement(
"Instruments");
106 return std::count_if(
cbegin(),
cend(), [](
const auto& i) {
return i.second.ResourcePointer->IsRunning(); });
111 std::for_each(
cbegin(),
cend(), [](
const auto& i) { i.second.ResourcePointer->Terminate(); });
116 std::for_each(
cbegin(),
cend(), [](
const auto& i) { i.second.ResourcePointer->RestoreWindowStatesFromParams(); });
121 std::for_each(
cbegin(),
cend(), [](
const auto& i) { i.second.ResourcePointer->UpdateParamsFromWindowStates(); });
126 std::for_each(
cbegin(),
cend(), [FunctionToCallWhenObjectStarted](
const auto& i) {
127 const bool HasBeenStarted = i.second.ResourcePointer->RunIfRunOnCreation();
129 if (HasBeenStarted && FunctionToCallWhenObjectStarted)
130 FunctionToCallWhenObjectStarted(i.second.ResourcePointer.get());
136 QDomElement ManagerNode = Document.createElement(
"Modules");
Implements DynExp's main UI window called DynExpManager.
Implementation of DynExp's resource managers to manage DynExp objects.
const std::function< void(Object *const)> FunctionToCallWhenObjectStartedType
Type of a callback function to invoke after a resource has been started in a call to ResourceManagerB...
static std::thread::id GetOwnerThreadID(const DynExpCore &Core) noexcept
Getter for the thread id of the thread which constructed (and owns) Core. Implementation necessary in...
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const override
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
bool AllConnected() const
Determines whether all hardware adapters managed by this resource manager are connected....
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const override
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
bool AllInitialized() const
Determines whether all instruments managed by this resource manager are initialized....
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
void TerminateAll() const
Calls RunnableObject::Terminate() on all instruments managed by this resource manager....
size_t GetNumRunningInstruments() const
Counts the instruments managed by this resource manager which are running (as determined by RunnableO...
void RestoreWindowStatesFromParams() const
Calls ModuleBase::RestoreWindowStatesFromParams() on all modules managed by this resource manager....
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const override
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
void TerminateAll() const
Calls RunnableObject::Terminate() on all modules managed by this resource manager....
void UpdateParamsFromWindowStates() const
Calls ModuleBase::UpdateParamsFromWindowStates() on all modules managed by this resource manager....
size_t GetNumRunningModules() const
Counts the modules managed by this resource manager which are running (as determined by RunnableObjec...
auto cend() const noexcept
Returns an iterator behind the last resource stored in the resource manager.
auto cbegin() const noexcept
Returns an iterator to the first resource stored in the resource manager.
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
Accumulates include statements to provide a precompiled header.