Pakman
SerialMaster Class Reference

#include <SerialMaster.h>

Inheritance diagram for SerialMaster:
Collaboration diagram for SerialMaster:

Public Member Functions

 SerialMaster (const Command &simulator, bool *p_program_terminated)
 
virtual ~SerialMaster () override=default
 
virtual bool isActive () const override
 
virtual bool needMorePendingTasks () const override
 
virtual void pushPendingTask (const std::string &input_string) override
 
virtual bool finishedTasksEmpty () const override
 
virtual TaskHandlerfrontFinishedTask () override
 
virtual void popFinishedTask () override
 
virtual void flush () override
 
virtual void terminate () override
 
- Public Member Functions inherited from AbstractMaster
 AbstractMaster (bool *p_program_terminated)
 
virtual ~AbstractMaster ()=default
 

Static Public Member Functions

static std::string help ()
 
static void addLongOptions (LongOptions &lopts)
 
static void run (controller_t controller, const Arguments &args)
 
static void cleanup ()
 
- Static Public Member Functions inherited from AbstractMaster
static master_t getMaster (const std::string &arg)
 
static std::string help (master_t master)
 
static void addLongOptions (master_t master, LongOptions &lopts)
 
static void run (master_t master, controller_t controller, const Arguments &args)
 
static void cleanup (master_t master)
 

Protected Member Functions

virtual void iterate () override
 
- Protected Member Functions inherited from AbstractMaster
void assignController (std::shared_ptr< AbstractController > p_controller)
 
bool programTerminated () const
 

Additional Inherited Members

- Protected Attributes inherited from AbstractMaster
std::weak_ptr< AbstractControllerm_p_controller
 

Detailed Description

A Master class for performing simulation tasks serially.

The SerialMaster class performs simulation tasks serially by spawning child processes with fork()exec() to run simulations.

For instructions on how to use Pakman with the serial master, execute the following command

$ pakman serial --help

Definition at line 26 of file SerialMaster.h.

Constructor & Destructor Documentation

◆ SerialMaster()

SerialMaster::SerialMaster ( const Command simulator,
bool *  p_program_terminated 
)

Constructor saves simulator command and program termination flag.

Parameters
simulatorcommand to run simulation.
p_program_terminatedpointer to boolean flag that is set when the execution of Pakman is terminated by the user.

Definition at line 13 of file SerialMaster.cc.

◆ ~SerialMaster()

virtual SerialMaster::~SerialMaster ( )
overridevirtualdefault

Default destructor does nothing.

Member Function Documentation

◆ addLongOptions()

void SerialMaster::addLongOptions ( LongOptions lopts)
static

Add long command-line options.

Parameters
loptslong command-line options that the SerialMaster needs.

Definition at line 29 of file SerialMasterStatic.cc.

◆ cleanup()

void SerialMaster::cleanup ( )
static

For SerialMaster, this function does nothing.

Definition at line 65 of file SerialMasterStatic.cc.

◆ finishedTasksEmpty()

bool SerialMaster::finishedTasksEmpty ( ) const
overridevirtual
Returns
whether finished tasks queue is empty.

Implements AbstractMaster.

Definition at line 67 of file SerialMaster.cc.

◆ flush()

void SerialMaster::flush ( )
overridevirtual

Flush all finished, busy and pending tasks.

Implements AbstractMaster.

Definition at line 85 of file SerialMaster.cc.

◆ frontFinishedTask()

TaskHandler & SerialMaster::frontFinishedTask ( )
overridevirtual
Returns
reference to front finished task.

Implements AbstractMaster.

Definition at line 73 of file SerialMaster.cc.

◆ help()

std::string SerialMaster::help ( )
static
Returns
help message string.

Definition at line 17 of file SerialMasterStatic.cc.

◆ isActive()

bool SerialMaster::isActive ( ) const
overridevirtual
Returns
whether the AbstractMaster is active.

Implements AbstractMaster.

Definition at line 20 of file SerialMaster.cc.

◆ iterate()

void SerialMaster::iterate ( )
overrideprotectedvirtual

Iterates the SerialMaster in an event loop.

Implements AbstractMaster.

Definition at line 26 of file SerialMaster.cc.

◆ needMorePendingTasks()

bool SerialMaster::needMorePendingTasks ( ) const
overridevirtual
Returns
whether more pending tasks are needed.

Implements AbstractMaster.

Definition at line 55 of file SerialMaster.cc.

◆ popFinishedTask()

void SerialMaster::popFinishedTask ( )
overridevirtual

Pop front finished task.

Implements AbstractMaster.

Definition at line 79 of file SerialMaster.cc.

◆ pushPendingTask()

void SerialMaster::pushPendingTask ( const std::string &  input_string)
overridevirtual

Push a new pending task.

Parameters
input_stringinput string to simulation job.

Implements AbstractMaster.

Definition at line 61 of file SerialMaster.cc.

◆ run()

void SerialMaster::run ( controller_t  controller,
const Arguments args 
)
static

Run SerialMaster in an event loop.

This function creates the SerialMaster and Controller objects, and runs them in an event loop.

Parameters
controllercontroller type.
argscommand-line arguments.

Definition at line 35 of file SerialMasterStatic.cc.

◆ terminate()

void SerialMaster::terminate ( )
overridevirtual

Terminate SerialMaster.

Implements AbstractMaster.

Definition at line 92 of file SerialMaster.cc.


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