AI Watch A1
Multi-person 3D skeleton detection using Intel RealSense and OpenPose with Kafka support.
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SystemCommand Class Referenceabstract

SystemCommand class is a class that represents a command given by the program to the system. More...

#include <SystemCommand.hpp>

Inheritance diagram for SystemCommand:
CleanCommand MoveCommand OpenPoseCommand

Public Member Functions

virtual ~SystemCommand ()=default
 Destroy the SystemCommand object. More...
 
void executeCommand (int *argc, char ***argv)
 This method is responsible for executing commands on the system based on the filled command string. If the string is empty, then no command is executed. More...
 

Protected Member Functions

virtual void setCommand (int *argc, char ***argv)=0
 Set the string command. The method is inherited from the subclasses and overridden in order to express a specific behavior. More...
 
void setCommand (std::string command)
 Set the string command with a particularly given string passed as a parameter. More...
 
std::string getCommand (void)
 Get the string command. More...
 

Private Attributes

std::string command
 The final command given to the system by the program. More...
 

Detailed Description

SystemCommand class is a class that represents a command given by the program to the system.

SystemCommand class is a class that represents a command given by the program to the system. Examples of commands are the following: start and run OpenPose, move files, and clean the build folder by deleting old files. SystemCommand implements a variant of the Command design pattern. Each concrete command is realized by a specific subclass that implements the parent abstract method.

Definition at line 28 of file SystemCommand.hpp.

Constructor & Destructor Documentation

◆ ~SystemCommand()

virtual SystemCommand::~SystemCommand ( )
virtualdefault

Destroy the SystemCommand object.

Member Function Documentation

◆ executeCommand()

void SystemCommand::executeCommand ( int *  argc,
char ***  argv 
)

This method is responsible for executing commands on the system based on the filled command string. If the string is empty, then no command is executed.

Parameters
argcpointer to argc from the main function or based on what the program reads from the configuration file.
argvpointer to argv from the main function or based on what the program reads from the configuration file.

Definition at line 23 of file SystemCommand.cpp.

23 {
24 setCommand(argc, argv);
25 if (getCommand().size() > 0 && getCommand() != "OP") std::system(getCommand().c_str());
26}
std::string getCommand(void)
Get the string command.
virtual void setCommand(int *argc, char ***argv)=0
Set the string command. The method is inherited from the subclasses and overridden in order to expres...

References getCommand(), and setCommand().

Referenced by FacadeSingleton::cleanBuildFolder(), and FacadeSingleton::getVideoBodyKeyPoints().

◆ getCommand()

std::string SystemCommand::getCommand ( void  )
protected

Get the string command.

Returns
std::string

Definition at line 19 of file SystemCommand.cpp.

19 {
20 return this->command;
21}
std::string command
The final command given to the system by the program.

References command.

Referenced by executeCommand().

◆ setCommand() [1/2]

virtual void SystemCommand::setCommand ( int *  argc,
char ***  argv 
)
protectedpure virtual

Set the string command. The method is inherited from the subclasses and overridden in order to express a specific behavior.

Parameters
argcpointer to argc based on what program reads from configuration file.
argvpointer to argv based on what program reads from configuration file.

Implemented in CleanCommand, OpenPoseCommand, and MoveCommand.

Referenced by executeCommand(), CleanCommand::setCommand(), OpenPoseCommand::setCommand(), and MoveCommand::setCommand().

◆ setCommand() [2/2]

void SystemCommand::setCommand ( std::string  command)
protected

Set the string command with a particularly given string passed as a parameter.

Parameters
command

Definition at line 15 of file SystemCommand.cpp.

15 {
16 this->command = command;
17}

References command.

Member Data Documentation

◆ command

std::string SystemCommand::command
private

The final command given to the system by the program.

Definition at line 33 of file SystemCommand.hpp.

Referenced by getCommand(), and setCommand().


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