| Line |
Branch |
Decision |
Call |
Exec |
Source |
| 1 |
|
|
|
|
#ifndef CHRYSALIS_PROJECT_H |
| 2 |
|
|
|
|
#define CHRYSALIS_PROJECT_H |
| 3 |
|
|
|
|
|
| 4 |
|
|
|
|
#include <queue> |
| 5 |
|
|
|
|
#include <condition_variable> |
| 6 |
|
|
|
|
|
| 7 |
|
|
|
|
#include "Option.h" |
| 8 |
|
|
|
|
#include "Pattern.h" |
| 9 |
|
|
|
|
#include "Parameter.h" |
| 10 |
|
|
|
|
#include "Expression.h" |
| 11 |
|
|
|
|
#include "ProjectSpace.h" |
| 12 |
|
|
|
|
#include "instructions/BaseInstructionsContainer.h" |
| 13 |
|
|
|
|
|
| 14 |
|
|
|
|
namespace Chrysalis { |
| 15 |
|
|
|
|
class Project { |
| 16 |
|
|
|
|
PROVIDE_SERIALIZATION_ACCESS(Project) |
| 17 |
|
|
|
|
public: |
| 18 |
|
|
|
|
static constexpr auto PROJECT_FILE_SUFFIX = "chrysalis"; |
| 19 |
|
|
|
|
static constexpr auto PROJECT_NAME_FILTER = "Chrysalis Project (*.chrysalis)"; |
| 20 |
|
|
|
|
|
| 21 |
|
|
|
|
explicit Project(std::string name, std::unique_ptr<ProjectSpace> space, |
| 22 |
|
|
|
|
std::unique_ptr<PatternsContainer> patterns, std::unique_ptr<ParametersContainer> parameters, |
| 23 |
|
|
|
|
std::unique_ptr<OptionsContainer> options, std::unique_ptr<ExpressionsContainer> expressions, |
| 24 |
|
|
|
|
std::unique_ptr<InstructionsContainer> instructions); |
| 25 |
|
|
|
|
~Project(); |
| 26 |
|
|
|
|
|
| 27 |
|
|
|
|
static std::unique_ptr<Project> create(); |
| 28 |
|
|
|
|
static std::unique_ptr<Project> create(const std::string& name); |
| 29 |
|
|
|
|
|
| 30 |
|
|
|
|
std::vector<char> bytes() const; |
| 31 |
|
|
|
|
static std::unique_ptr<Project> fromBytes(const char* bytes, size_t size); |
| 32 |
|
|
|
|
|
| 33 |
|
|
|
|
static std::unique_ptr<Project> read(const std::string& filePath); |
| 34 |
|
|
|
|
static void write(const std::string& filePath, const Project& project); |
| 35 |
|
|
|
|
|
| 36 |
|
|
|
|
std::string getName(); |
| 37 |
|
|
|
|
void setName(const std::string& name); |
| 38 |
|
|
|
|
|
| 39 |
|
|
|
|
void execute(); |
| 40 |
|
|
|
|
void onExecuted(const std::function<void()>& function); |
| 41 |
|
|
|
|
|
| 42 |
|
|
|
|
[[nodiscard]] ProjectSpace* getSpace() const; |
| 43 |
|
|
|
|
[[nodiscard]] OptionsContainer* getOptions() const; |
| 44 |
|
|
|
|
[[nodiscard]] PatternsContainer* getPatterns() const; |
| 45 |
|
|
|
|
[[nodiscard]] ParametersContainer* getParameters() const; |
| 46 |
|
|
|
|
[[nodiscard]] ExpressionsContainer* getExpressions() const; |
| 47 |
|
|
|
|
[[nodiscard]] InstructionsContainer* getInstructions() const; |
| 48 |
|
|
|
|
private: |
| 49 |
|
|
|
|
std::mutex mutex_; |
| 50 |
|
|
|
|
std::condition_variable startExecution_; |
| 51 |
|
|
|
|
std::atomic<bool> pendingExecution_ = false; |
| 52 |
|
|
|
|
|
| 53 |
|
|
|
|
std::queue<std::function<void()>> queue_; |
| 54 |
|
|
|
|
std::jthread thread_; |
| 55 |
|
|
|
|
|
| 56 |
|
|
|
|
std::string name_; |
| 57 |
|
|
|
|
/// @uml{composition} |
| 58 |
|
|
|
|
std::unique_ptr<ProjectSpace> space_; |
| 59 |
|
|
|
|
/// @uml{composition} |
| 60 |
|
|
|
|
std::unique_ptr<OptionsContainer> options_; |
| 61 |
|
|
|
|
/// @uml{composition} |
| 62 |
|
|
|
|
std::unique_ptr<PatternsContainer> patterns_; |
| 63 |
|
|
|
|
/// @uml{composition} |
| 64 |
|
|
|
|
std::unique_ptr<ParametersContainer> parameters_; |
| 65 |
|
|
|
|
/// @uml{composition} |
| 66 |
|
|
|
|
std::unique_ptr<ExpressionsContainer> expressions_; |
| 67 |
|
|
|
|
/// @uml{composition} |
| 68 |
|
|
|
|
std::unique_ptr<InstructionsContainer> instructions_; |
| 69 |
|
|
|
|
}; |
| 70 |
8/18
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
✓ Branch 14 taken 2 times.
✗ Branch 15 not taken.
✓ Branch 18 taken 2 times.
✗ Branch 19 not taken.
✓ Branch 22 taken 2 times.
✗ Branch 23 not taken.
✓ Branch 26 taken 2 times.
✗ Branch 27 not taken.
✓ Branch 30 taken 2 times.
✗ Branch 31 not taken.
✓ Branch 34 taken 2 times.
✗ Branch 35 not taken.
✓ Branch 60 taken 2 times.
✗ Branch 61 not taken.
✗ Branch 97 not taken.
✗ Branch 98 not taken.
|
|
81/103
✓ Call 0 invoked.
✓ Call 1 invoked.
✓ Call 2 invoked.
✓ Call 3 invoked.
✓ Call 4 invoked.
✓ Call 5 invoked.
✓ Call 6 invoked.
✓ Call 7 invoked.
✓ Call 8 invoked.
✓ Call 9 invoked.
✓ Call 10 invoked.
✓ Call 11 invoked.
✓ Call 12 invoked.
✓ Call 13 invoked.
✓ Call 14 invoked.
✓ Call 15 invoked.
✓ Call 16 invoked.
✓ Call 17 invoked.
✓ Call 18 invoked.
✓ Call 19 invoked.
✓ Call 20 invoked.
✓ Call 21 invoked.
✓ Call 22 invoked.
✓ Call 23 invoked.
✓ Call 24 invoked.
✓ Call 25 invoked.
✓ Call 26 invoked.
✓ Call 27 invoked.
✓ Call 28 invoked.
✓ Call 29 invoked.
✓ Call 30 invoked.
✓ Call 31 invoked.
✓ Call 32 invoked.
✓ Call 33 invoked.
✓ Call 34 invoked.
✓ Call 35 invoked.
✓ Call 36 invoked.
✓ Call 37 invoked.
✓ Call 38 invoked.
✓ Call 39 invoked.
✓ Call 40 invoked.
✓ Call 41 invoked.
✓ Call 42 invoked.
✓ Call 43 invoked.
✓ Call 44 invoked.
✓ Call 45 invoked.
✓ Call 46 invoked.
✓ Call 47 invoked.
✓ Call 48 invoked.
✓ Call 49 invoked.
✓ Call 50 invoked.
✓ Call 51 invoked.
✓ Call 52 invoked.
✓ Call 53 invoked.
✓ Call 54 invoked.
✓ Call 55 invoked.
✓ Call 56 invoked.
✓ Call 57 invoked.
✓ Call 58 invoked.
✓ Call 59 invoked.
✓ Call 62 invoked.
✓ Call 63 invoked.
✓ Call 64 invoked.
✓ Call 65 invoked.
✓ Call 66 invoked.
✓ Call 67 invoked.
✓ Call 68 invoked.
✓ Call 69 invoked.
✓ Call 70 invoked.
✓ Call 71 invoked.
✓ Call 72 invoked.
✓ Call 73 invoked.
✓ Call 74 invoked.
✓ Call 75 invoked.
✓ Call 76 invoked.
✓ Call 77 invoked.
✓ Call 78 invoked.
✓ Call 79 invoked.
✓ Call 80 invoked.
✓ Call 81 invoked.
✓ Call 82 invoked.
✗ Call 83 not invoked.
✗ Call 84 not invoked.
✗ Call 85 not invoked.
✗ Call 86 not invoked.
✗ Call 87 not invoked.
✗ Call 88 not invoked.
✗ Call 89 not invoked.
✗ Call 90 not invoked.
✗ Call 91 not invoked.
✗ Call 92 not invoked.
✗ Call 93 not invoked.
✗ Call 94 not invoked.
✗ Call 95 not invoked.
✗ Call 96 not invoked.
✗ Call 99 not invoked.
✗ Call 100 not invoked.
✗ Call 101 not invoked.
✗ Call 102 not invoked.
✗ Call 103 not invoked.
✗ Call 104 not invoked.
✗ Call 105 not invoked.
✗ Call 106 not invoked.
|
20 |
SERIALIZE_CONSTRUCTION(Project, name_, space_, patterns_, parameters_, options_, expressions_, instructions_) |
| 71 |
|
|
|
|
} |
| 72 |
|
|
|
|
|
| 73 |
|
|
|
|
#endif //CHRYSALIS_PROJECT_H |
| 74 |
|
|
|
|
|