DNA Calib 1.1
Project brief
CommandSequence.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "dnacalib/Command.h"
6#include "dnacalib/Defs.h"
8
9namespace dnac {
10
11class DNACalibDNAReader;
12
20class CommandSequence : public Command {
21 public:
22 DNACAPI explicit CommandSequence(MemoryResource* memRes = nullptr);
23
25
28
31
32 DNACAPI void run(DNACalibDNAReader* output) override;
33
39 DNACAPI void add(Command* command);
40
46 DNACAPI void add(ArrayView<Command> commands);
47
48 template<class ... Commands>
49 void add(Commands... commands) {
50 static_assert(sizeof...(commands) > 0, "At least one command must be passed.");
51 Command* commandList[] = {commands ...};
52 for (auto cmd : commandList) {
53 add(cmd);
54 }
55 }
56
62 DNACAPI void remove(Command* command);
63
69 DNACAPI void remove(ArrayView<Command> commands);
70
71 template<class ... Commands>
72 void remove(Commands... commands) {
73 static_assert(sizeof...(commands) > 0, "At least one command must be passed.");
74 Command* commandList[] = {commands ...};
75 for (auto cmd : commandList) {
76 remove(cmd);
77 }
78 }
79
85 DNACAPI bool contains(Command* command) const;
86
90 DNACAPI std::size_t size() const;
91
92 private:
93 class Impl;
95
96};
97
98} // namespace dnac
CommandSequence is used to run a sequence of commands on the same DNA.
Definition: CommandSequence.h:20
DNACAPI ~CommandSequence()
DNACAPI CommandSequence(CommandSequence &&)
void add(Commands... commands)
Definition: CommandSequence.h:49
CommandSequence(const CommandSequence &)=delete
void remove(Commands... commands)
Definition: CommandSequence.h:72
DNACAPI CommandSequence(MemoryResource *memRes=nullptr)
Definition: src/dnacalib/commands/CommandSequence.cpp:49
DNACAPI void run(DNACalibDNAReader *output) override
Definition: src/dnacalib/commands/CommandSequence.cpp:57
DNACAPI void add(Command *command)
Method for adding a command to a sequence of commands to run.
Definition: src/dnacalib/commands/CommandSequence.cpp:61
CommandSequence & operator=(const CommandSequence &)=delete
DNACAPI CommandSequence & operator=(CommandSequence &&)
DNACAPI void remove(Command *command)
Method for removing a command from the sequence of commands to run.
Definition: src/dnacalib/commands/CommandSequence.cpp:71
DNACAPI bool contains(Command *command) const
Method for checking if the provided command is part of the command sequence.
Definition: src/dnacalib/commands/CommandSequence.cpp:81
DNACAPI std::size_t size() const
Number of commands in command sequence.
Definition: src/dnacalib/commands/CommandSequence.cpp:85
ScopedPtr< Impl > pImpl
Definition: CommandSequence.h:94
Command is an abstract class whose implementations are expected to modify the DNA provided in the run...
Definition: Command.h:15
Definition: DNACalibDNAReader.h:12
MemoryResource is an abstract class that allows the implementation of polymorphic allocators.
Definition: MemoryResource.h:17
Takes ownership over the given pointer and handles it's lifetime.
Definition: ScopedPtr.h:116
A view over a continuous sequence of objects.
Definition: ArrayView.h:55
#define DNACAPI
Definition: dnacalib/Defs.h:26
Definition: Command.h:8