API Documentation
Loading...
Searching...
No Matches
DesignTask.h
Go to the documentation of this file.
1#pragma once
2#include <NDEVR/UUID.h>
3#include <NDEVR/TranslatedString.h>
4namespace NDEVR
5{
6 /**--------------------------------------------------------------------------------------------------
7 \brief A task which is to be executed by a DesignObjectLookup. When active tasks may limit certain
8 functionality.
9 *-----------------------------------------------------------------------------------------------**/
24 /**--------------------------------------------------------------------------------------------------
25 \brief Manages all active and inactive tasks for a DesignObjectLookup
26 *-----------------------------------------------------------------------------------------------**/
28 {
29 public:
30 virtual bool canExitApplication() const
31 {
32 RLock lock(&m_tasks);
33 for (const auto& iter : m_tasks)
34 {
35 if (iter.second.is_active && !iter.second.allow_application_close)
36 return false;
37 }
38 return true;
39 }
40 virtual bool canOpenProject() const
41 {
42 RLock lock(&m_tasks);
43 for (const auto& iter : m_tasks)
44 {
45 if (iter.second.is_active && !iter.second.allow_open_project)
46 return false;
47 }
48 return true;
49 }
50 virtual bool canImportFile() const
51 {
52 RLock lock(&m_tasks);
53 for (const auto& iter : m_tasks)
54 {
55 if (iter.second.is_active && !iter.second.allow_import_file)
56 return false;
57 }
58 return true;
59 }
60 virtual void addTask(const DesignTask& task)
61 {
62 WLock lock(&m_tasks);
64 }
65 virtual void updateTask(const DesignTask& task)
66 {
67 WLock lock(&m_tasks);
69 }
70 virtual void removeTask(const UUID& id)
71 {
72 WLock lock(&m_tasks);
73 m_tasks.erase(id);
74 }
75 DesignTask task(const UUID& id) const
76 {
77 RLock lock(&m_tasks);
78 return m_tasks[id];
79 }
81 };
82}
Manages all active and inactive tasks for a DesignObjectLookup.
Definition DesignTask.h:28
virtual bool canOpenProject() const
Definition DesignTask.h:40
DesignTask task(const UUID &id) const
Definition DesignTask.h:75
virtual bool canImportFile() const
Definition DesignTask.h:50
virtual void updateTask(const DesignTask &task)
Definition DesignTask.h:65
virtual bool canExitApplication() const
Definition DesignTask.h:30
Dictionary< UUID, DesignTask > m_tasks
Definition DesignTask.h:80
virtual void addTask(const DesignTask &task)
Definition DesignTask.h:60
virtual void removeTask(const UUID &id)
Definition DesignTask.h:70
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:59
Used to lock a particular variable for reading. Any number of readers can be created when no write lo...
Definition RWLock.h:91
Any text displayed to the user should be defined as a TranslatedString which allows the.
Definition TranslatedString.h:13
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer s...
Definition UUID.h:62
Used to lock a particular variable for writing. Only one write lock can be created when no read locks...
Definition RWLock.h:115
Definition ACIColor.h:37
double fltp08
Defines an alias representing an 8 byte floating-point number.
Definition BaseValues.hpp:146
Defines for a given type (such as sint04, fltp08, UUID, etc) a maximum, minimum, and reserved.
Definition BaseValues.hpp:230
A task which is to be executed by a DesignObjectLookup. When active tasks may limit certain.
Definition DesignTask.h:11
DesignTask()
Definition DesignTask.h:20
UUID id
Definition DesignTask.h:12
bool is_active
Definition DesignTask.h:19
bool allow_application_close
Definition DesignTask.h:16
TranslatedString description
Definition DesignTask.h:14
TranslatedString name
Definition DesignTask.h:13
bool allow_import_file
Definition DesignTask.h:17
fltp08 progress
Definition DesignTask.h:15
bool allow_open_project
Definition DesignTask.h:18