59 const char*
GetParamClassTag() const noexcept override final {
return "ProjectParams"; }
69 "Determines whether module windows' geometries and states are to be remembered when loading the project from file.",
70 false, StoreWindowStatesType::ApplyStoredWindowStates };
171 void Reset(
bool Force =
false);
181 void SaveProject(std::string_view Filename,
const QMainWindow& MainWindow,
const QDialog& CircuitDiagramDlg, QSplitter& HSplitter, QSplitter& VSplitter);
257 bool OnlyMainWindow =
false);
361 std::filesystem::path
ToAbsolutePath(
const std::filesystem::path& Path)
const;
421 template <
typename LibEntryT,
typename ParamsT,
typename ManagerT>
439 void UpdateParamsFromWindowStates(
const QMainWindow& MainWindow,
const QDialog& CircuitDiagramDlg, QSplitter& HSplitter, QSplitter& VSplitter);
487 template <
typename LibEntryT,
typename ParamsT,
typename ManagerT>
491 auto ID = ResourceManager.InsertResource(std::move(Item));
492 auto Res = ResourceManager.GetResource(ID);
495 +
"\" (" + Res->GetCategoryAndName() +
") has been created successfully.");
Provides templates to bundle DynExp resources at compile time in libraries.
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...
DynExp's core class acts as the interface between the user interface and DynExp's internal data like ...
std::unique_ptr< ProjectParams > Params
Project parameters (configuration) of the current DynExp project. Must never be nullptr.
DynExpCore(HardwareAdapterLibraryVectorType HardwareAdapterLib, InstrumentLibraryVectorType InstrumentLib, ModuleLibraryVectorType ModuleLib, std::string ProjectFileToOpen="")
Constructs a DynExpCore instance.
void SaveProject(std::string_view Filename, const QMainWindow &MainWindow, const QDialog &CircuitDiagramDlg, QSplitter &HSplitter, QSplitter &VSplitter)
Saves the current DynExp project to an XML project file.
auto & GetModuleManager() const noexcept
Getter for the module manager.
static constexpr std::chrono::milliseconds GetParamsTimeoutDefault
Default timeout used by DynExpCore::GetParams() to lock the mutex of the project parameter instance.
auto ConnectHardwareAdapters(CommonResourceManagerBase::FunctionToCallWhenObjectStartedType FunctionToCallWhenHardwareAdapterConnecting=nullptr)
Connects all hardware adapters contained in HardwareAdapterMgr asynchronously calling ResourceManager...
void ShutdownProject()
Terminates all running instruments and modules.
bool AllInstrumentsInitialized() const
Checks whether all instruments contained in InstrumentMgr have been initialized successfully.
auto & GetHardwareAdapterLib() const noexcept
Getter for the hardware adapter library.
auto & GetModuleManager() noexcept
Getter for the module manager.
void OpenProject(std::string_view Filename)
Loads a DynExp project from an XML project file.
bool IsProjectOpened(const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const noexcept
Locks Params and determines whether a project has been openend from a project file.
bool LoadedProjectFromCommandlineParams
This flag will be set to true if DynExpCore has been initialized with a path to a project file to loa...
bool OpenProjectSafe(const std::string &Filename) noexcept
Calls OpenProject() and performs error handling for that function.
HardwareAdapterManager HardwareAdapterMgr
Hardware adapter manager owning all instantiated hardware adapters.
const HardwareAdapterLibraryVectorType HardwareAdapterLib
Hardware adapter library vector containing information about all hardware adapters DynExp knows.
auto & GetHardwareAdapterManager() noexcept
Getter for the hardware adapter manager.
void EditProjectSettings(QWidget *const DialogParent)
Opens a settings dialog (ParamsConfigDialog) to let the user configure the parameter values of the cu...
void RestoreWindowStatesFromParams(QMainWindow &MainWindow, QDialog &CircuitDiagramDlg, QSplitter &HSplitter, QSplitter &VSplitter, bool OnlyMainWindow=false)
Sets module and main windows' positions, sizes and styles according to parameters stored in the curre...
QThread WorkerThread
One worker thread runs the Qt event queues for all objects derived from Util::QWorker (e....
auto & GetInstrumentManager() noexcept
Getter for the instrument manager.
void Reset(bool Force=false)
Resets the currently loaded project removing all resources from the resource managers....
bool HasLoadedProjectFromCommandlineParams() noexcept
Indicates whether a DynExp project has been loaded from a path specified as a command line argument w...
ModuleManager ModuleMgr
Module manager owning all instantiated modules.
const InstrumentLibraryVectorType InstrumentLib
Instrument library vector containing information about all instruments DynExp knows.
const auto GetOwnerThreadID() const noexcept
Getter for the thread id of the thread which constructed (and owns) this DynExpCore instance.
auto & GetModuleLib() const noexcept
Getter for the module library.
void MoveQWorkerToWorkerThread(Util::QWorker &Worker, ItemIDType ID) const
Moves a Util::QWorker instance to WorkerThread to run its Qt event queue there. This method is thread...
void SetDataSaveDirectory(const std::filesystem::path &Directory, const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault)
Sets a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to st...
const ModuleLibraryVectorType ModuleLib
Module library vector containing information about all modules DynExp knows.
auto GetLastDataSaveDirectory(const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
Locks Params and returns the path to a directory where modules can save data.
auto GetProjectFilename(const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
Locks Params and returns the current DynExp project's filename.
auto & GetHardwareAdapterManager() const noexcept
Getter for the hardware adapter manager.
void RunModules(CommonResourceManagerBase::FunctionToCallWhenObjectStartedType FunctionToCallWhenModuleStarted=nullptr)
Runs all modules contained in ModuleMgr with RunnableObjectParams::StartupType::OnCreation startup se...
ParamsConstTypeSyncPtrType GetParams(const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
Locks the mutex of the parameter class instance Params assigned to the current project and returns a ...
void UpdateParamsFromWindowStates(const QMainWindow &MainWindow, const QDialog &CircuitDiagramDlg, QSplitter &HSplitter, QSplitter &VSplitter)
Retrieves the module and main windows' positions, sizes and styles from the windows and updates the p...
InstrumentManager InstrumentMgr
Instrument manager owning all instantiated instruments.
const std::thread::id OwnerThreadID
The ID is set by DynExpCore::DynExpCore() to the id of the thread which constructed the DynExpCore in...
void RunInstruments(CommonResourceManagerBase::FunctionToCallWhenObjectStartedType FunctionToCallWhenInstrumentStarted=nullptr)
Runs all instruments contained in InstrumentMgr with RunnableObjectParams::StartupType::OnCreation st...
ItemIDType MakeItem(const LibraryEntry< HardwareAdapterPtrType > &LibEntry, ParamsBasePtrType &&Params)
Creates a DynExp::HardwareAdapterBase instance from a LibraryEntry.
bool AllHardwareAdaptersConnected() const
Checks whether all hardware adapters contained in HardwareAdapterMgr have been connected successfully...
Util::SynchronizedPointer< const ProjectParams > ParamsConstTypeSyncPtrType
Alias for the return type of DynExpCore::GetParams() const. Parameters wrapped into Util::Synchronize...
auto & GetInstrumentManager() const noexcept
Getter for the instrument manager.
void ResetFailedItems(QWidget &ParentWindow)
Calls Object::Reset() and Object::ClearWarning() on all owned DynExp::Object instances which are in a...
std::string GetDataSaveDirectory(const std::chrono::milliseconds Timeout=GetParamsTimeoutDefault) const
Recalls a path where modules might save recorded data to. Used by Util::PromptSaveFilePathModule() to...
std::filesystem::path ToAbsolutePath(const std::filesystem::path &Path) const
Transforms the path Path into an absolute path relative to ProjectParams::ProjectFilename.
auto & GetInstrumentLib() const noexcept
Getter for the instrument library.
Util::SynchronizedPointer< ProjectParams > ParamsTypeSyncPtrType
Alias for the return type of DynExpCore::GetParams(). Parameters wrapped into Util::SynchronizedPoint...
void Shutdown()
Terminates DynExpCore::WorkerThread and waits until the thread has ended.
Resource manager for HardwareAdapterBase resources deriving from a specialized ResourceManagerBase cl...
Resource manager for InstrumentBase resources deriving from a specialized ResourceManagerBase class.
Resource manager for ModuleBase resources deriving from a specialized ResourceManagerBase class.
Abstract base class for object parameter classes. Each class derived from class Object must be accomp...
const DynExpCore & Core
Reference to DynExp's core.
Defines a parameter class with parameters common to all DynExp projects.
std::filesystem::path ProjectFilename
Path to project file. Only non-empty if project has been saved or if it was loaded from file.
Param< ParamsConfigDialog::TextType > Authors
Author of project file.
ListParam< int > VSplitterWidgetHeights
Widths of areas split vertically by the main splitter widget in the main window.
StoreWindowStatesType
Indicates whether to apply window states (like position and size) from the project files.
@ ApplyDefaultWindowStates
@ ApplyStoredWindowStates
Param< StoreWindowStatesType > StoreWindowStates
Indicates whether to apply window states (like position and size) from the project files.
WindowStyleParamsExtension CircuitWindowStyleParams
Window states of the circuit diagram window (CircuitDiagram). WindowStyleParamsExtension::WindowDocki...
static Util::TextValueListType< StoreWindowStatesType > AvlblStoreWindowStatesTypeStrList()
Assigns labels to the entries of StoreWindowStatesType.
std::filesystem::path LastDataSaveDirectory
Path to directory where modules saved their data most recently.
const char * GetParamClassTag() const noexcept override final
This function is intended to be overridden once in each derived class returning the name of the respe...
Param< ParamsConfigDialog::TextType > Version
Version of project file.
ListParam< int > HSplitterWidgetWidths
Widths of areas split horizontally by the main splitter widget in the main window.
void ConfigureParamsImpl(dispatch_tag< ParamsBase >) override final
Called by DynExp::ParamsBase::ConfigureParams() as a starting point for the tag dispatch mechanism to...
WindowStyleParamsExtension MainWindowStyleParams
Window states of the main window. WindowStyleParamsExtension::WindowDockingState member is ignored.
Param< ParamsConfigDialog::TextType > Comment
Comment to project file.
ProjectParams(const DynExpCore &Core)
Constructs the parameters for a ProjectParams instance. The ID argument passed to ParamsBase::ParamsB...
void Startup(FunctionToCallWhenObjectStartedType FunctionToCallWhenObjectStarted) const
Starts all resources owned by the resource manager. For HardwareAdapterBase instances,...
Bundles several parameters to describe a UI window's style. Use in parameter classes.
void Log(const std::string &Message, const ErrorType Type=ErrorType::Info, const size_t Line=0, const std::string &Function="", const std::string &File="", const int ErrorCode=0, const std::stacktrace &Trace={}) noexcept
Logs an event from information specified manually.
Interface to delete copy constructor and copy assignment operator and thus make derived classes non-c...
Implements a QObject belonging to a hardware adapter (derived from DynExp::HardwareAdapterBase) that ...
Pointer to lock a class derived from ISynchronizedPointerLockable for synchronizing between threads....
DynExp's main namespace contains the implementation of DynExp including classes to manage resources (...
std::vector< LibraryEntry< InstrumentPtrType > > InstrumentLibraryVectorType
Alias for the vector type containing entries of a instrument library.
std::vector< LibraryEntry< HardwareAdapterPtrType > > HardwareAdapterLibraryVectorType
Alias for the vector type containing entries of a hardware adapter library.
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
size_t ItemIDType
ID type of objects/items managed by DynExp.
std::vector< LibraryEntry< ModulePtrType > > ModuleLibraryVectorType
Alias for the vector type containing entries of a module library.
EventLogger & EventLog()
This function holds a static EventLogger instance and returns a reference to it. DynExp uses only one...
std::vector< std::pair< TextType, ValueType > > TextValueListType
Type of a list containing key-value pairs where key is a text of type Util::TextType.
Accumulates include statements to provide a precompiled header.
Represents an entry in the library.
LibraryObjectFactoryPtrType< ObjectTypeBasePtr > ObjectFactoryPtr
Refer to LibraryEntry::LibraryEntry()