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
CleanCommand Class Reference

The CleanCommand class is a class that implements a command to clean the build folder by deleting old files. More...

#include <SystemCommand.hpp>

Inheritance diagram for CleanCommand:
SystemCommand

Public Member Functions

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

void setCommand (int *argc, char ***argv) override
 Set the string command to a cleaning command. 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

The CleanCommand class is a class that implements a command to clean the build folder by deleting old files.

The CleanCommand class is a class that implements a command to clean the build folder by deleting old files. It deletes all the images captured and computed when the current "JSONs' sending session with Kafka" is completed, as well as it deletes all the JSONs files produced in the meanwhile.

Definition at line 73 of file SystemCommand.hpp.

Member Function Documentation

◆ executeCommand()

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

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 SystemCommand::getCommand(), and SystemCommand::setCommand().

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

◆ getCommand()

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

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 SystemCommand::command.

Referenced by SystemCommand::executeCommand().

◆ setCommand() [1/2]

void CleanCommand::setCommand ( int *  argc,
char ***  argv 
)
overrideprotectedvirtual

Set the string command to a cleaning command.

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

Implements SystemCommand.

Definition at line 15 of file CleanCommand.cpp.

15 {
16 std::stringstream cleanTerminalCommand;
17 UsageManager * usageManagerInstance = UsageManager::getInstance();
18 if (usageManagerInstance == nullptr) CV_Error(USAGE_MANAGER_NULLPTR_ERROR, USAGE_MANAGER_NULLPTR_SCOPE);
19
20 char *** localArgv = usageManagerInstance->get_argv();
21 const char * imagesFolder = (* localArgv)[imagesFolderOffset];
22 const char * outputFolder = (* localArgv)[outputFolderOffset];
23 cleanTerminalCommand << "rm -r " << imagesFolder << "rgb/ > /dev/null && "
24 "rm -r " << imagesFolder << "d/ > /dev/null && "
25 "rm -r " << imagesFolder << "skeleton/ > /dev/null && "
26 "rm -r " << imagesFolder << "videoframe/ > /dev/null && "
27 "rm -r " << outputFolder << "op/ > /dev/null && "
28 "rm -r " << imagesFolder << "depth/ > /dev/null && "
29 "rm -r " << imagesFolder << "sk/ > /dev/null && "
30 "rm -r " << outputFolder << "movement/ > /dev/null && "
31 "mkdir " << imagesFolder << "rgb && "
32 "mkdir " << imagesFolder << "d && "
33 "mkdir " << imagesFolder << "videoframe && "
34 "mkdir " << imagesFolder << "skeleton && "
35 "mkdir " << imagesFolder << "depth && "
36 "mkdir " << imagesFolder << "sk && "
37 "mkdir " << outputFolder << "movement/ && "
38 "mkdir " << outputFolder << "op/";
39 SystemCommand::setCommand(std::string(cleanTerminalCommand.str()));
40}
UsageManager class is a utility class that helps with configuration parameters.
char *** get_argv(void)
Get the argv's pointer.
static UsageManager * getInstance(void)
Get the unique class instance. This methods should be called in the following scenario: when we just ...
static const short int imagesFolderOffset
Definition: constants.hpp:64
static const short int USAGE_MANAGER_NULLPTR_ERROR
Definition: constants.hpp:35
static const short int outputFolderOffset
Definition: constants.hpp:65
static const char * USAGE_MANAGER_NULLPTR_SCOPE
Definition: constants.hpp:36

References UsageManager::get_argv(), UsageManager::getInstance(), imagesFolderOffset, outputFolderOffset, SystemCommand::setCommand(), USAGE_MANAGER_NULLPTR_ERROR, and USAGE_MANAGER_NULLPTR_SCOPE.

◆ setCommand() [2/2]

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

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 SystemCommand::command.

Member Data Documentation

◆ command

std::string SystemCommand::command
privateinherited

The final command given to the system by the program.

Definition at line 33 of file SystemCommand.hpp.

Referenced by SystemCommand::getCommand(), and SystemCommand::setCommand().


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