salsa  0.4.15
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.
 

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

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().

◆ 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.

◆ 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.


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