DynExp
Highly flexible laboratory automation for dynamically changing experiments.
Managers.h
Go to the documentation of this file.
1 // This file is part of DynExp.
2 
8 #pragma once
9 
10 #include "stdafx.h"
11 #include "HardwareAdapter.h"
12 #include "Instrument.h"
13 #include "Module.h"
14 
15 namespace DynExp
16 {
22  template <typename PointerType>
23  struct Resource
24  {
32  template <typename ResourcePointerT>
33  Resource(ResourcePointerT&& ResourcePointer)
34  : ResourcePointer(std::forward<ResourcePointerT>(ResourcePointer)) {}
35 
36  PointerType ResourcePointer;
37 
43  mutable std::unique_ptr<QTreeWidgetItem> TreeWidgetItem;
44  };
45 
57  {
58  public:
65  using FunctionToCallWhenObjectStartedType = const std::function<void(Object* const)>;
66 
67  protected:
70 
78  static std::thread::id GetOwnerThreadID(const DynExpCore& Core) noexcept;
79  };
80 
85  template <typename PointerType>
87  {
92  {
93  friend class ResourceManagerBase;
94  friend class LinkBase;
95 
101 
106 
108  };
109 
110  public:
112 
113  private:
119  template <typename T>
120  using ShareResourceEnablerType = std::enable_if_t<std::is_same_v<std::shared_ptr<typename T::element_type>, PointerType>, int>;
121 
122  using MapType = std::unordered_map<ItemIDType, ResourceType>;
123 
124  protected:
126  ~ResourceManagerBase() = default;
127 
128  public:
133  ItemIDType GetNextID() const noexcept { return CurrentID; }
134 
139  const auto GetNumResources() const noexcept { return Map.size(); }
140 
145  const bool Empty() const noexcept { return Map.empty(); }
146 
154  const typename PointerType::element_type* GetResource(ItemIDType ID) const;
155 
159  typename PointerType::element_type* GetResource(ItemIDType ID);
160 
168  PointerType ExtractResource(ItemIDType ID);
169 
177  void RemoveResource(ItemIDType ID, const std::chrono::milliseconds Timeout = Util::ILockable::DefaultTimeout);
178 
186 
194 
207  template <typename T = PointerType, ShareResourceEnablerType<T> = 0>
208  auto ShareResource(ItemIDType ID) const;
209 
213  template <typename T = PointerType, ShareResourceEnablerType<T> = 0>
215 
220  auto cbegin() const noexcept { return Map.cbegin(); }
221 
226  auto cend() const noexcept { return Map.cend(); }
227 
231  template <typename ElementType>
232  ItemIDType InsertResource(ElementType&& Element);
233 
241  template <typename DerivedType>
243 
250  void Startup(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const { StartupChild(FunctionToCallWhenObjectStarted); }
251 
255  void Shutdown() const { ShutdownChild(); }
256 
261 
271  ItemIDListType GetFailedResourceIDs(bool OnlyResourcesBeingInUse = false) const;
272 
277  void ResetFailedResources() const;
278 
284 
290  void Reset();
291 
299  QDomElement EntryConfigsToXML(QDomDocument& Document) const;
300 
305 
319  template <typename LibraryVectorT>
320  void MakeEntriesFromXML(const QDomElement& XMLNode, const LibraryVectorT& Library, const DynExpCore& Core);
321 
322  LinkBaseOnlyType LinkBaseOnly; // !< @copydoc LinkBaseOnlyType
323 
324  private:
332  auto LookUpResource(ItemIDType ID) const;
333 
345  template <typename ElementType>
346  ItemIDType InsertResource(ElementType&& Element, const ItemIDType ID);
347 
354  void RaiseID(const ItemIDType ConsumedID);
355 
361  void IncrementID();
362 
367  virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const = 0;
368  virtual void ShutdownChild() const {}
369  virtual void PrepareResetChild() {}
370  virtual void ResetChild() {}
371 
380  virtual QDomElement MakeXMLConfigHeadNode(QDomDocument& Document) const = 0;
382 
384 
391  };
392 
393  template <typename PointerType>
394  const typename PointerType::element_type* ResourceManagerBase<PointerType>::GetResource(ItemIDType ID) const
395  {
396  return LookUpResource(ID)->second.ResourcePointer.get();
397  }
398 
399  template <typename PointerType>
400  typename PointerType::element_type* ResourceManagerBase<PointerType>::GetResource(ItemIDType ID)
401  {
402  return LookUpResource(ID)->second.ResourcePointer.get();
403  }
404 
405  template <typename PointerType>
407  {
408  auto Res = Map.extract(ID);
409 
410  if (Res.empty())
412  "Resource with ID " + Util::ToStr(ID) + " cannot be extracted from a resource manager since it cannot be found.");
413 
414  return std::move(Res.mapped().ResourcePointer);
415  }
416 
417  template <typename PointerType>
418  void ResourceManagerBase<PointerType>::RemoveResource(ItemIDType ID, const std::chrono::milliseconds Timeout)
419  {
420  GetResource(ID)->BlockIfUnused(Timeout);
421 
422  // Postpone calling destructor of managed resource to the end of this function and remove
423  // from map first. Destructor of managed resource might cause iterating throup map (in
424  // case of modules in DynExpManager::GetModuleByActiveUIWindow() when the module's
425  // respective QMdiSubWindow is destroyed). An iteration must not happen while erasing
426  // from the map is in progress.
427  auto Resource = ExtractResource(ID);
428  }
429 
430  template <typename PointerType>
432  {
433  LookUpResource(ID)->second.TreeWidgetItem.reset();
434  }
435 
436  template <typename PointerType>
438  {
439  try
440  {
441  auto const TreeWidgetItem = LookUpResource(ID)->second.TreeWidgetItem.get();
442 
443  // Assuming, all other items have already been deselectd. Now, select chosen one.
444  if (TreeWidgetItem)
445  TreeWidgetItem->setSelected(true);
446  }
447  catch (...) // Swallow especially Util::NotFoundException.
448  {
449  }
450  }
451 
452  template <typename PointerType>
453  template <typename T, ResourceManagerBase<PointerType>::ShareResourceEnablerType<T>>
455  {
456  return std::static_pointer_cast<const typename PointerType::element_type>(LookUpResource(ID)->second.ResourcePointer);
457  }
458 
459  template <typename PointerType>
460  template <typename T, ResourceManagerBase<PointerType>::ShareResourceEnablerType<T>>
462  {
463  return LookUpResource(ID)->second.ResourcePointer;
464  }
465 
466  template <typename PointerType>
467  template <typename ElementType>
469  {
470  return InsertResource(std::forward<ElementType>(Element), GetNextID());
471  }
472 
473  template <typename PointerType>
474  template <typename DerivedType>
476  {
477  ItemIDListType FoundIDs;
478 
479  for (const auto& ResourceEntry : Map)
480  if (dynamic_cast<DerivedType*>(ResourceEntry.second.ResourcePointer.get()))
481  FoundIDs.push_back(ResourceEntry.first);
482 
483  return FoundIDs;
484  }
485 
486  template <typename PointerType>
488  {
489  std::for_each(cbegin(), cend(), [](const auto& i) {
490  i.second.ResourcePointer->ClearWarning();
491  });
492  }
493 
494  template <typename PointerType>
496  {
497  ItemIDListType FoundIDs;
498 
499  std::for_each(cbegin(), cend(), [&FoundIDs, OnlyResourcesBeingInUse](const auto& i) {
500  if (i.second.ResourcePointer->GetException() && (!OnlyResourcesBeingInUse || !i.second.ResourcePointer->IsUnused()))
501  FoundIDs.push_back(i.first);
502  });
503 
504  return FoundIDs;
505  }
506 
507  template <typename PointerType>
509  {
510  std::for_each(cbegin(), cend(), [](const auto& i) {
511  if (i.second.ResourcePointer->GetException())
512  i.second.ResourcePointer->Reset();
513  });
514  }
515 
516  template <typename PointerType>
518  {
519  ResetChild();
520 
521  Map.clear();
522  CurrentID = 1; // Start with 1, so that 0 can have a special meaning (e.g. "not set").
523  }
524 
525  template <typename PointerType>
526  QDomElement ResourceManagerBase<PointerType>::EntryConfigsToXML(QDomDocument& Document) const
527  {
528  auto XMLNode = MakeXMLConfigHeadNode(Document);
529 
530  std::for_each(cbegin(), cend(), [&XMLNode, &Document](const auto& i) {
531  QDomElement ItemNode = Document.createElement("Item");
532  ItemNode.setAttribute(QString("Name"), QString::fromStdString(i.second.ResourcePointer->GetName()));
533  ItemNode.setAttribute(QString("Category"), QString::fromStdString(i.second.ResourcePointer->GetCategory()));
534  ItemNode.setAttribute(QString("ID"), static_cast<qulonglong>(i.first));
535 
536  // GetParams() locks the parameters to save. So this is thread-safe.
537  QDomElement ParamsNode = Document.createElement("Params");
538  ParamsNode.appendChild(i.second.ResourcePointer->GetParams()->ConfigToXML(Document));
539  ItemNode.appendChild(ParamsNode);
540 
541  XMLNode.appendChild(ItemNode);
542  });
543 
544  return XMLNode;
545  }
546 
547  template <typename PointerType>
549  {
550  std::for_each(cbegin(), cend(), [](const auto& i) { i.second.TreeWidgetItem.reset(); });
551  }
552 
553  template <typename PointerType>
554  template <typename LibraryVectorT>
555  void ResourceManagerBase<PointerType>::MakeEntriesFromXML(const QDomElement& XMLNode, const LibraryVectorT& Library, const DynExpCore& Core)
556  {
557  auto ItemNodeList = XMLNode.elementsByTagName("Item");
558  for (int i = 0; i < ItemNodeList.length(); ++i)
559  {
560  auto ItemNode = ItemNodeList.item(i).toElement();
561  if (ItemNode.isNull())
563  "Error parsing the specified project file. An item node contains invalid data.");
564 
565  auto ItemCategory = Util::GetStringFromDOMAttribute(ItemNode, "Category");
566  auto ItemName = Util::GetStringFromDOMAttribute(ItemNode, "Name");
567  auto ItemID = Util::GetTFromDOMAttribute<ItemIDType>(ItemNode, "ID");
568  auto ParamsNode = Util::GetSingleChildDOMElement(ItemNode, "Params");
569 
570  auto LibEntry = FindInLibraryVector(Library, ItemCategory, ItemName);
571  auto Params = LibEntry.ConfigFactoryPtr()->MakeConfigFromXML(ItemID, Core, ParamsNode);
572  auto Item = LibEntry.ObjectFactoryPtr(GetOwnerThreadID(Core), std::move(Params));
573 
574  InsertResource(std::move(Item), ItemID);
575  }
576  }
577 
578  template <typename PointerType>
580  {
581  auto Iter = Map.find(ID);
582 
583  if (Iter == Map.cend())
584  throw Util::NotFoundException("Resource with ID " + Util::ToStr(ID) + " cannot be found.");
585 
586  return Iter;
587  }
588 
589  template <typename PointerType>
590  template <typename ElementType>
592  {
593  if (!ID)
595  "Resource cannot be inserted into a resource manager since 0 is not a valid ID.");
596 
597  auto Result = Map.try_emplace(ID, ResourceType(std::forward<ElementType>(Element)));
598  if (!Result.second)
600  "Resource cannot be inserted into a resource manager since the chosen ID already exists.");
601 
602  RaiseID(ID);
603 
604  return ID;
605  }
606 
607  template <typename PointerType>
609  {
610  if (CurrentID < ConsumedID)
611  CurrentID = ConsumedID;
612 
613  if (CurrentID == ConsumedID)
614  IncrementID();
615  }
616 
617  template <typename PointerType>
619  {
620  if (CurrentID == std::numeric_limits<ItemIDType>::max())
621  throw Util::OverflowException("No ID left to insert a resource into a resource manager.");
622 
623  ++CurrentID;
624  }
625 
630  class HardwareAdapterManager : public ResourceManagerBase<HardwareAdapterPtrType>
631  {
632  public:
634 
637 
645  bool AllConnected() const;
646 
647  private:
648  virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override;
649  virtual QDomElement MakeXMLConfigHeadNode(QDomDocument& Document) const override;
650  };
651 
656  class InstrumentManager : public ResourceManagerBase<InstrumentPtrType>
657  {
658  public:
660 
661  InstrumentManager() = default;
662  ~InstrumentManager() = default;
663 
669  size_t GetNumRunningInstruments() const;
670 
679  bool AllInitialized() const;
680 
686  void TerminateAll() const;
687 
688  private:
689  virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override;
690  virtual void ShutdownChild() const override { TerminateAll(); }
691  virtual void PrepareResetChild() override { TerminateAll(); }
692  virtual QDomElement MakeXMLConfigHeadNode(QDomDocument& Document) const override;
693  };
694 
699  class ModuleManager : public ResourceManagerBase<ModulePtrType>
700  {
701  public:
703 
704  ModuleManager() = default;
705  ~ModuleManager() = default;
706 
712  size_t GetNumRunningModules() const;
713 
719  void TerminateAll() const;
720 
726  void RestoreWindowStatesFromParams() const;
727 
733  void UpdateParamsFromWindowStates() const;
734 
735  private:
736  virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override;
737  virtual void ShutdownChild() const override { TerminateAll(); }
738  virtual void PrepareResetChild() override { TerminateAll(); }
739  virtual QDomElement MakeXMLConfigHeadNode(QDomDocument& Document) const override;
740  };
741 }
Implementation of DynExp hardware adapter objects.
Implementation of DynExp instrument objects.
Implementation of DynExp module objects.
Common base class for all derived ResourceManagerBase classes. Logical const-ness: Only const functio...
Definition: Managers.h:57
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...
Definition: Managers.h:65
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...
Definition: Managers.cpp:9
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
Definition: DynExpCore.h:127
Resource manager for HardwareAdapterBase resources deriving from a specialized ResourceManagerBase cl...
Definition: Managers.h:631
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const override
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
Definition: Managers.cpp:56
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
Definition: Managers.cpp:28
bool AllConnected() const
Determines whether all hardware adapters managed by this resource manager are connected....
Definition: Managers.cpp:14
Resource manager for InstrumentBase resources deriving from a specialized ResourceManagerBase class.
Definition: Managers.h:657
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const override
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
Definition: Managers.cpp:97
virtual void PrepareResetChild() override
Prepares all resources stored in this resource manager for their deletion by e.g. asking them to term...
Definition: Managers.h:691
bool AllInitialized() const
Determines whether all instruments managed by this resource manager are initialized....
Definition: Managers.cpp:68
virtual void ShutdownChild() const override
Calls ShutdownChild() to terminate and clean up all resources stored in this resource manager.
Definition: Managers.h:690
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
Definition: Managers.cpp:87
void TerminateAll() const
Calls RunnableObject::Terminate() on all instruments managed by this resource manager....
Definition: Managers.cpp:82
size_t GetNumRunningInstruments() const
Counts the instruments managed by this resource manager which are running (as determined by RunnableO...
Definition: Managers.cpp:63
Abstract base class of link parameters (to be saved in project files) describing relations between mu...
Definition: Object.h:184
Resource manager for ModuleBase resources deriving from a specialized ResourceManagerBase class.
Definition: Managers.h:700
void RestoreWindowStatesFromParams() const
Calls ModuleBase::RestoreWindowStatesFromParams() on all modules managed by this resource manager....
Definition: Managers.cpp:114
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const override
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
Definition: Managers.cpp:124
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const override
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
Definition: Managers.cpp:134
void TerminateAll() const
Calls RunnableObject::Terminate() on all modules managed by this resource manager....
Definition: Managers.cpp:109
void UpdateParamsFromWindowStates() const
Calls ModuleBase::UpdateParamsFromWindowStates() on all modules managed by this resource manager....
Definition: Managers.cpp:119
virtual void PrepareResetChild() override
Prepares all resources stored in this resource manager for their deletion by e.g. asking them to term...
Definition: Managers.h:738
virtual void ShutdownChild() const override
Calls ShutdownChild() to terminate and clean up all resources stored in this resource manager.
Definition: Managers.h:737
size_t GetNumRunningModules() const
Counts the modules managed by this resource manager which are running (as determined by RunnableObjec...
Definition: Managers.cpp:104
Base class for all DynExp Objects like hardware adapters (DynExp::HardwareAdapterBase),...
Definition: Object.h:1971
Allow exclusive access to some of ResourceManagerBase's private methods to LinkBase.
Definition: Managers.h:92
auto ShareResourceAsNonConst(ItemIDType ID) const
Copies and returns the shared pointer pointing to (and owning) the resource identified by ID....
Definition: Managers.h:105
constexpr LinkBaseOnlyType(ResourceManagerBase &Parent) noexcept
Construcs an instance - one for each ResourceManagerBase instance.
Definition: Managers.h:100
ResourceManagerBase & Parent
Owning ResourceManagerBase instance.
Definition: Managers.h:107
Typed resource manager base class deriving from class CommonResourceManagerBase.
Definition: Managers.h:87
const auto GetNumResources() const noexcept
Determines the amount of resources stored in this resource manager.
Definition: Managers.h:139
void Reset()
Resets the resource manager by calling ResetChild(), by removing all resources from Map and by resett...
Definition: Managers.h:517
virtual void ResetChild()
Resets the resource manager by calling ResetChild(), by removing all resources from Map and by resett...
Definition: Managers.h:370
void ClearResourcesWarnings() const
Calls Object::ClearWarning() on all resources stored in this resource manager.
Definition: Managers.h:487
void DeleteAllTreeWidgetItems()
Deletes the Resource::TreeWidgetItem of all resources stored in this resource manager.
Definition: Managers.h:548
void ResetFailedResources() const
Calls Object::Reset() on all resources stored in this resource manager which are in an error state (d...
Definition: Managers.h:508
PointerType ExtractResource(ItemIDType ID)
Releases ownership of the owned resource with ID and returns it.
Definition: Managers.h:406
auto cend() const noexcept
Returns an iterator behind the last resource stored in the resource manager.
Definition: Managers.h:226
std::unordered_map< ItemIDType, ResourceType > MapType
Type of a map mapping DynExp object IDs (ItemIDType) to DynExp resources (ResourceType)
Definition: Managers.h:122
ItemIDType InsertResource(ElementType &&Element)
Inserts a resource into the resource manager.
Definition: Managers.h:468
PointerType::element_type * GetResource(ItemIDType ID)
Retrieves a resource specified by its ID from the resource manager.
Definition: Managers.h:400
void RemoveResource(ItemIDType ID, const std::chrono::milliseconds Timeout=Util::ILockable::DefaultTimeout)
Removes the resource identified by ID from the resource manager and deletes it.
Definition: Managers.h:418
void FocusTreeWidgetItem(ItemIDType ID)
Selects the Resource::TreeWidgetItem of the requested resource.
Definition: Managers.h:437
LinkBaseOnlyType LinkBaseOnly
Definition: Managers.h:322
const PointerType::element_type * GetResource(ItemIDType ID) const
Retrieves a resource specified by its ID from the resource manager.
Definition: Managers.h:394
auto LookUpResource(ItemIDType ID) const
Retrieves a resource specified by its ID from the resource manager.
Definition: Managers.h:579
void MakeEntriesFromXML(const QDomElement &XMLNode, const LibraryVectorT &Library, const DynExpCore &Core)
Creates resources and takes ownership of them according to an XML tree from a DynExp project XML file...
Definition: Managers.h:555
ItemIDType InsertResource(ElementType &&Element, const ItemIDType ID)
Inserts a resource into the resource manager.
Definition: Managers.h:591
ItemIDType CurrentID
ID, the next resource added to the manager will receive. After initialization and reset (Reset()),...
Definition: Managers.h:390
auto ShareResource(ItemIDType ID)
Copies and returns the shared pointer pointing to (and owning) the resource identified by ID....
Definition: Managers.h:461
virtual void ShutdownChild() const
Calls ShutdownChild() to terminate and clean up all resources stored in this resource manager.
Definition: Managers.h:368
void Shutdown() const
Calls ShutdownChild() to terminate and clean up all resources stored in this resource manager.
Definition: Managers.h:255
virtual void StartupChild(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const =0
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
auto ShareResource(ItemIDType ID) const
Copies and returns the shared pointer pointing to (and owning) the resource identified by ID....
Definition: Managers.h:454
auto cbegin() const noexcept
Returns an iterator to the first resource stored in the resource manager.
Definition: Managers.h:220
ItemIDType GetNextID() const noexcept
Getter for the ID to assign to the next resource to be inserted into the resource manager.
Definition: Managers.h:133
const bool Empty() const noexcept
Determines whether this resource manager is empty.
Definition: Managers.h:145
void PrepareReset()
Prepares all resources stored in this resource manager for their deletion by e.g. asking them to term...
Definition: Managers.h:283
virtual QDomElement MakeXMLConfigHeadNode(QDomDocument &Document) const =0
Creates and returns the XML root node of the (single) resource manager instance of the derived manage...
virtual void PrepareResetChild()
Prepares all resources stored in this resource manager for their deletion by e.g. asking them to term...
Definition: Managers.h:369
ItemIDListType GetFailedResourceIDs(bool OnlyResourcesBeingInUse=false) const
Builds and returns a list of the IDs of all resources stored in this resource manager which are in an...
Definition: Managers.h:495
ItemIDListType Filter() const
Builds and returns a list of the IDs of all resources stored in this resource manager which can be ca...
Definition: Managers.h:475
std::enable_if_t< std::is_same_v< std::shared_ptr< typename T::element_type >, PointerType >, int > ShareResourceEnablerType
SFINAE alias to define methods assuming shared resource ownership only if PointerType is a std::share...
Definition: Managers.h:120
void DeleteTreeWidgetItem(ItemIDType ID)
Deletes the Resource::TreeWidgetItem of the requested resource.
Definition: Managers.h:431
void Startup(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
Definition: Managers.h:250
void IncrementID()
Increments CurrentID.
Definition: Managers.h:618
void RaiseID(const ItemIDType ConsumedID)
If CurrentID is less or equal to ConsumedID, sets CurrentID to ConsumedID + 1. If CurrentID is greate...
Definition: Managers.h:608
QDomElement EntryConfigsToXML(QDomDocument &Document) const
Creates and returns the XML tree containing the configuration of each resource owned by this resource...
Definition: Managers.h:526
MapType Map
Map storing all resources owned by this resource manager.
Definition: Managers.h:383
static constexpr std::chrono::milliseconds DefaultTimeout
Duration which is used as a default timeout within all methods of this class if no different duration...
Definition: Util.h:62
An invalid argument like a null pointer has been passed to a function.
Definition: Exception.h:137
Data to operate on is invalid for a specific purpose. This indicates a corrupted data structure or fu...
Definition: Exception.h:163
An operation cannot be performed currently since the related object is in an invalid state like an er...
Definition: Exception.h:150
Thrown when a requested ressource does not exist.
Definition: Exception.h:236
Thrown when a numeric operation would result in an overflow (e.g. due to incompatible data types)
Definition: Exception.h:199
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
std::vector< ItemIDType > ItemIDListType
Type of a list of IDs belonging to objects managed by DynExp.
Definition: Object.h:40
size_t ItemIDType
ID type of objects/items managed by DynExp.
const LibraryVectorT::value_type & FindInLibraryVector(const LibraryVectorT &LibraryVector, const std::string &Category, const std::string &Name)
Finds an entry in a library vector by category and name.
Definition: Libraries.h:258
std::string ToStr(const T &Value, int Precision=-1)
Converts a (numeric) value of type T to a std::string using operator<< of std::stringstream.
Definition: Util.h:625
QDomElement GetSingleChildDOMElement(const QDomElement &Parent, const QString &ChildTagName)
Behaves like GetSingleChildDOMNode() but returns the node converted to a DOM element.
Definition: QtUtil.cpp:62
std::string GetStringFromDOMAttribute(const QDomElement &Element, const QString &AttributeName)
Behaves like GetDOMAttribute() but returns the text from the attribute.
Definition: QtUtil.cpp:99
Accumulates include statements to provide a precompiled header.
Defines a DynExp resource, which mainly owns a DynExp::Object instance wrapping a pointer to it.
Definition: Managers.h:24
Resource(ResourcePointerT &&ResourcePointer)
Constructs a Resource instance.
Definition: Managers.h:33
std::unique_ptr< QTreeWidgetItem > TreeWidgetItem
For visualization of the resource and its state in DynExp's main window (DynExpManager)....
Definition: Managers.h:43
PointerType ResourcePointer
Pointer to the DynExp::Object instance owned by this resource.
Definition: Managers.h:36