salsa 0.7.1
Loading...
Searching...
No Matches
Salsa::TaskState Class Reference

Base salsa TaskState class. More...

#include <TaskState.hh>

Inheritance diagram for Salsa::TaskState:
Salsa::Object

Public Types

enum  EState {
  idle , assigned , running , killed ,
  all
}
 Status of task. More...
 

Public Member Functions

 TaskState (TaskExecutor *te=nullptr)
 
virtual ~TaskState ()
 
void id (uint32_t id)
 
uint32_t id () const
 
void state (EState s)
 
EState state () const
 
TaskInfo * task () const
 
void task (TaskInfo *t)
 
void print (bool verbose=false) const
 
void pid (uint32_t pid)
 
uint32_t pid () const
 
void killTask ()
 
TaskExecutorexecutor ()
 

Static Public Member Functions

static std::shared_ptr< spdlog::logger > getConsoleOutput ()
 Get console output.
 
static void setConsoleLevel (spdlog::level::level_enum level)
 Sets console log level.
 

Protected Attributes

uint32_t mId = 0
 ID of task state.
 
EState mState = idle
 Status of actor.
 
TaskInfo * mpTask = nullptr
 TaskInfo held by said actor.
 
uint32_t mPID = 0
 Task PID.
 
TaskExecutormpTaskExecutor = nullptr
 Task Executor.
 

Static Private Attributes

static std::shared_ptr< spdlog::logger > mspConsoleLogger = spdlog::stdout_color_mt("salsa")
 Pointer to spd logger.
 

Detailed Description

Member Enumeration Documentation

◆ EState

Status of task.

Definition at line 19 of file TaskState.hh.

Constructor & Destructor Documentation

◆ TaskState()

Salsa::TaskState::TaskState ( TaskExecutor * te = nullptr)

Constructor

Definition at line 6 of file TaskState.cc.

◆ ~TaskState()

Salsa::TaskState::~TaskState ( )
virtual

Destructor

Definition at line 12 of file TaskState.cc.

References mpTask, and mpTaskExecutor.

Member Function Documentation

◆ executor()

TaskExecutor * Salsa::TaskState::executor ( )

Returns task executor

Definition at line 83 of file TaskState.cc.

References mpTaskExecutor.

Referenced by Salsa::NodeManagerZyre::addTaskSlot(), Salsa::TaskPool::handlePipe(), and Salsa::NodeManagerZyre::runTask().

◆ getConsoleOutput()

static std::shared_ptr< spdlog::logger > Salsa::Object::getConsoleOutput ( )
inlinestaticinherited

Get console output.

Definition at line 21 of file Object.hh.

References Salsa::Object::mspConsoleLogger.

Referenced by Salsa::ConfigZyre::apply().

◆ id() [1/2]

uint32_t Salsa::TaskState::id ( ) const

Returns id

Definition at line 28 of file TaskState.cc.

References mId.

Referenced by id().

◆ id() [2/2]

void Salsa::TaskState::id ( uint32_t id)

Seting id

Definition at line 21 of file TaskState.cc.

References id(), and mId.

Referenced by Salsa::TaskPool::add(), Salsa::TaskPool::handlePipe(), and Salsa::Worker::onWhisper().

◆ killTask()

void Salsa::TaskState::killTask ( )

Kill task

Definition at line 91 of file TaskState.cc.

References mPID, mpTask, and mState.

◆ pid() [1/2]

uint32_t Salsa::TaskState::pid ( ) const

Returns PID

Definition at line 58 of file TaskState.cc.

References mPID.

Referenced by pid().

◆ pid() [2/2]

void Salsa::TaskState::pid ( uint32_t pid)

Seting PID

Definition at line 51 of file TaskState.cc.

References mPID, and pid().

Referenced by Salsa::TaskExecutorForkZmq::handlePipe(), and Salsa::TaskPool::handlePipe().

◆ print()

void Salsa::TaskState::print ( bool verbose = false) const

Prints task pool info

Definition at line 111 of file TaskState.cc.

References mId, mpTask, and mState.

◆ setConsoleLevel()

static void Salsa::Object::setConsoleLevel ( spdlog::level::level_enum level)
inlinestaticinherited

Sets console log level.

Definition at line 29 of file Object.hh.

References Salsa::Object::mspConsoleLogger.

◆ state() [1/2]

TaskState::EState Salsa::TaskState::state ( ) const

Returns current state

Definition at line 43 of file TaskState.cc.

References mState.

◆ state() [2/2]

void Salsa::TaskState::state ( EState s)

◆ task() [1/2]

TaskInfo * Salsa::TaskState::task ( ) const

◆ task() [2/2]

void Salsa::TaskState::task ( TaskInfo * t)

Sets task

Definition at line 74 of file TaskState.cc.

References mpTask.

Member Data Documentation

◆ mId

uint32_t Salsa::TaskState::mId = 0
protected

ID of task state.

Definition at line 42 of file TaskState.hh.

Referenced by id(), id(), and print().

◆ mPID

uint32_t Salsa::TaskState::mPID = 0
protected

Task PID.

Definition at line 45 of file TaskState.hh.

Referenced by killTask(), pid(), and pid().

◆ mpTask

TaskInfo* Salsa::TaskState::mpTask = nullptr
protected

TaskInfo held by said actor.

Definition at line 44 of file TaskState.hh.

Referenced by killTask(), print(), task(), task(), and ~TaskState().

◆ mpTaskExecutor

TaskExecutor* Salsa::TaskState::mpTaskExecutor = nullptr
protected

Task Executor.

Definition at line 46 of file TaskState.hh.

Referenced by executor(), and ~TaskState().

◆ mspConsoleLogger

std::shared_ptr< spdlog::logger > Salsa::Object::mspConsoleLogger = spdlog::stdout_color_mt("salsa")
staticprivateinherited

Pointer to spd logger.

Definition at line 32 of file Object.hh.

Referenced by Salsa::Object::getConsoleOutput(), and Salsa::Object::setConsoleLevel().

◆ mState

EState Salsa::TaskState::mState = idle
protected

Status of actor.

Definition at line 43 of file TaskState.hh.

Referenced by killTask(), print(), state(), and state().


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