DNA Calib 1.1
Project brief
Classes | Public Member Functions | Private Attributes | List of all members
dnac::CommandSequence Class Reference

CommandSequence is used to run a sequence of commands on the same DNA. More...

#include <CommandSequence.h>

Inheritance diagram for dnac::CommandSequence:
Inheritance graph
Collaboration diagram for dnac::CommandSequence:
Collaboration graph

Classes

class  Impl
 

Public Member Functions

DNACAPI CommandSequence (MemoryResource *memRes=nullptr)
 
DNACAPI ~CommandSequence ()
 
 CommandSequence (const CommandSequence &)=delete
 
CommandSequenceoperator= (const CommandSequence &)=delete
 
DNACAPI CommandSequence (CommandSequence &&)
 
DNACAPI CommandSequenceoperator= (CommandSequence &&)
 
DNACAPI void run (DNACalibDNAReader *output) override
 
DNACAPI void add (Command *command)
 Method for adding a command to a sequence of commands to run. More...
 
DNACAPI void add (ArrayView< Command > commands)
 Method for adding multiple commands to a sequence of commands to run. More...
 
template<class ... Commands>
void add (Commands... commands)
 
DNACAPI void remove (Command *command)
 Method for removing a command from the sequence of commands to run. More...
 
DNACAPI void remove (ArrayView< Command > commands)
 Method for removing an array of commands from the sequence of commands to run. More...
 
template<class ... Commands>
void remove (Commands... commands)
 
DNACAPI bool contains (Command *command) const
 Method for checking if the provided command is part of the command sequence. More...
 
DNACAPI std::size_t size () const
 Number of commands in command sequence. More...
 
- Public Member Functions inherited from dnac::Command
virtual ~Command ()
 
virtual void run (DNACalibDNAReader *output)=0
 

Private Attributes

ScopedPtr< ImplpImpl
 

Detailed Description

CommandSequence is used to run a sequence of commands on the same DNA.

Note
Commands will be run in the order in which they were added to the sequence.
CommandSequence holds pointers to commands, but does not own them.

Constructor & Destructor Documentation

◆ CommandSequence() [1/3]

dnac::CommandSequence::CommandSequence ( MemoryResource memRes = nullptr)
explicit
49 :
50 pImpl{makeScoped<Impl>(memRes)} {
51}
ScopedPtr< Impl > pImpl
Definition: CommandSequence.h:94

◆ ~CommandSequence()

dnac::CommandSequence::~CommandSequence ( )
default

◆ CommandSequence() [2/3]

dnac::CommandSequence::CommandSequence ( const CommandSequence )
delete

◆ CommandSequence() [3/3]

dnac::CommandSequence::CommandSequence ( CommandSequence &&  )
default

Member Function Documentation

◆ add() [1/3]

void dnac::CommandSequence::add ( ArrayView< Command commands)

Method for adding multiple commands to a sequence of commands to run.

Parameters
commandsThe commands to add.
65 {
66 for (auto& cmd : commands) {
67 pImpl->add(&cmd);
68 }
69}

References pImpl.

◆ add() [2/3]

void dnac::CommandSequence::add ( Command command)

Method for adding a command to a sequence of commands to run.

Parameters
commandThe command to add.
61 {
62 pImpl->add(command);
63}

References pImpl.

Referenced by add(), and main().

◆ add() [3/3]

template<class ... Commands>
void dnac::CommandSequence::add ( Commands...  commands)
inline
49 {
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 }
DNACAPI void add(Command *command)
Method for adding a command to a sequence of commands to run.
Definition: src/dnacalib/commands/CommandSequence.cpp:61

References add().

◆ contains()

bool dnac::CommandSequence::contains ( Command command) const

Method for checking if the provided command is part of the command sequence.

Parameters
commandThe command to check.
81 {
82 return pImpl->contains(command);
83}

References pImpl.

◆ operator=() [1/2]

CommandSequence & dnac::CommandSequence::operator= ( CommandSequence &&  )
default

◆ operator=() [2/2]

CommandSequence & dnac::CommandSequence::operator= ( const CommandSequence )
delete

◆ remove() [1/3]

void dnac::CommandSequence::remove ( ArrayView< Command commands)

Method for removing an array of commands from the sequence of commands to run.

Parameters
commandsThe commands to remove.
75 {
76 for (auto& cmd : commands) {
77 pImpl->remove(&cmd);
78 }
79}

References pImpl.

◆ remove() [2/3]

void dnac::CommandSequence::remove ( Command command)

Method for removing a command from the sequence of commands to run.

Parameters
commandThe command to remove.
71 {
72 pImpl->remove(command);
73}

References pImpl.

Referenced by main(), and remove().

◆ remove() [3/3]

template<class ... Commands>
void dnac::CommandSequence::remove ( Commands...  commands)
inline
72 {
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 }
DNACAPI void remove(Command *command)
Method for removing a command from the sequence of commands to run.
Definition: src/dnacalib/commands/CommandSequence.cpp:71

References remove().

◆ run()

void dnac::CommandSequence::run ( DNACalibDNAReader output)
overridevirtual

Implements dnac::Command.

57 {
58 pImpl->run(output);
59}

References pImpl.

Referenced by main().

◆ size()

std::size_t dnac::CommandSequence::size ( ) const

Number of commands in command sequence.

85 {
86 return pImpl->size();
87}

References pImpl.

Member Data Documentation

◆ pImpl

ScopedPtr<Impl> dnac::CommandSequence::pImpl
private

Referenced by add(), contains(), remove(), run(), and size().


The documentation for this class was generated from the following files: