SMP::SMPKernel Class Reference

SMP Kernel. More...

#include <kernel.h>

Collaboration diagram for SMP::SMPKernel:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ~SMPKernel (void)
void pat_dog (int id)
 for filter to pat the watchdog at regular time (when processing in the main loop)
void set_unmonitored (int fid)
 for filter to unregister itself to the watchdog, so that watchdog will not check this thread's heartbeat
SMPConfigurationget_config ()
void set_config (SMPConfiguration &c)
void set_config (string name, int value)
int destruct_filters (void)
 construct a filter destruct all the filters in the system, this will free any resources related to filters
int construct_binding (size_t size, int input, int input_port, vector< int > &output, vector< int > &output_port, int type)
 construct a buffer this function also updates filter's buffer information
int destruct_buffers (void)
 destruct all the buffers in the system, this will free any resources related to buffers
int init (void)
 initialization of SMP kernel, does filter initialize() function
void start (void)
void pause (void)
void resume (void)
void stop (void)
void halt (void)
void set_buf_status (int buf_id, int status)
 add buffer to the filter's input port add buffer to the filter's output port set filter property get filter property set if kernel will run in real time scheduling set buffer status
int get_buf_status (int buf_id)
 get buffer status
void flush_buffer (int buf_id)
 reset buffer flags so that it becomes empty
ssize_t buf_read (int buf_id, void *buff, size_t nbytes, int fid=0)
ssize_t buf_write (int buf_id, const void *buff, size_t nbytes)
ssize_t buf_read_nonblock (int buf_id, void *buff, size_t nbytes, int fid=0)
ssize_t buf_write_nonblock (int buf_id, const void *buff, size_t nbytes)
ssize_t buf_read_space (int buf_id, int fid)
ssize_t buf_write_space (int buf_id)
void show_buffers (void)
 display each buffer's status in the system
void show_buffer (int bid)
 display a buffer's status by buffer id
void show_threads (void)
 display each threads' status in the system
void show_thread (int fid)
 display a thread's status by filter id
void set_priority (int fid, int prio)
 set thread priority
void update_property (int fid, map< string, property_item > &prop)
 update filter property using given property map
void set_env (int pargc, char **pargv)
void get_env (int *pargc, char ***pargv)
void run_additional ()
void begin ()
void join ()

Static Public Member Functions

static SMPKernelget_kernel (void)
 return a kernel object If there are already a kernel there, do not new

Public Attributes

SMPSignalManagersignal_manager
char version [6]
bool stopped
bool paused
bool buf_rw_info
int argc
char ** argv

Friends

class SMPWatchdog

Detailed Description

SMP Kernel.


Constructor & Destructor Documentation

SMP::SMPKernel::~SMPKernel ( void   ) 

public destructor


Member Function Documentation

void SMP::SMPKernel::pat_dog ( int  id  ) 

for filter to pat the watchdog at regular time (when processing in the main loop)

Parameters:
id this is the same as the filter's id, specifying which flag to raise

void SMP::SMPKernel::set_unmonitored ( int  fid  ) 

for filter to unregister itself to the watchdog, so that watchdog will not check this thread's heartbeat

Parameters:
fid the filter id

int SMP::SMPKernel::destruct_filters ( void   ) 

construct a filter destruct all the filters in the system, this will free any resources related to filters

Returns:
0 if success, nonzero if error

int SMP::SMPKernel::construct_binding ( size_t  size,
int  input,
int  input_port,
vector< int > &  output,
vector< int > &  output_port,
int  type 
)

construct a buffer this function also updates filter's buffer information

Parameters:
size number of MAX bytes allowed in the buffer
input input filter id
input_port input filter port id
output output filters' id, as a vector
output_port output filter port id, as a vector
type 0: DATA_BUFFER, 1:SIGNAL_BUFFER
Returns:
buffer id, -1 indicates error

int SMP::SMPKernel::destruct_buffers ( void   ) 

destruct all the buffers in the system, this will free any resources related to buffers

Returns:
0 if success, nonzero if error

int SMP::SMPKernel::init ( void   ) 

initialization of SMP kernel, does filter initialize() function

Returns:
0 if all filters are successfully initialized. -1 if any error occurs

void SMP::SMPKernel::start ( void   ) 

start execution of SMP kernel

void SMP::SMPKernel::pause ( void   ) 

pause execution of SMP kernel

void SMP::SMPKernel::resume ( void   ) 

resume execution of SMP kernel

void SMP::SMPKernel::stop ( void   ) 

stop execution of SMP kernel

void SMP::SMPKernel::set_buf_status ( int  buf_id,
int  status 
)

add buffer to the filter's input port add buffer to the filter's output port set filter property get filter property set if kernel will run in real time scheduling set buffer status

Parameters:
buf_id the buffer id
status the status to set

int SMP::SMPKernel::get_buf_status ( int  buf_id  ) 

get buffer status

Parameters:
buf_id the buffer id

void SMP::SMPKernel::flush_buffer ( int  buf_id  ) 

reset buffer flags so that it becomes empty

Parameters:
buf_id the buffer id

ssize_t SMP::SMPKernel::buf_read ( int  buf_id,
void *  buff,
size_t  nbytes,
int  fid = 0 
)

blocking read from buf_id

ssize_t SMP::SMPKernel::buf_write ( int  buf_id,
const void *  buff,
size_t  nbytes 
)

blocking write to buf_id

ssize_t SMP::SMPKernel::buf_read_nonblock ( int  buf_id,
void *  buff,
size_t  nbytes,
int  fid = 0 
)

nonblocking read from buf_id

ssize_t SMP::SMPKernel::buf_write_nonblock ( int  buf_id,
const void *  buff,
size_t  nbytes 
)

nonblocking write to buf_id

void SMP::SMPKernel::show_buffer ( int  bid  ) 

display a buffer's status by buffer id

Parameters:
bid buffer id

void SMP::SMPKernel::show_thread ( int  fid  ) 

display a thread's status by filter id

Parameters:
fid filter id

void SMP::SMPKernel::set_priority ( int  fid,
int  prio 
)

set thread priority

Parameters:
fid the thread of filter id = fid
prio the priority to set. Min = -5, Max = 5

void SMP::SMPKernel::update_property ( int  fid,
map< string, property_item > &  prop 
)

update filter property using given property map

Parameters:
fid the filter id
prop reference of the property map

void SMP::SMPKernel::run_additional (  ) 

run additional components after kernel has started

void SMP::SMPKernel::begin (  ) 

a function for invoking start() as a thread

void SMP::SMPKernel::join (  ) 

a function which blocks until kernel stops


Member Data Documentation

SMPSignalManager* SMP::SMPKernel::signal_manager

the signal manager (watchdog for each signal handler thread)

char SMP::SMPKernel::version[6]

SMP kernel version

bool SMP::SMPKernel::stopped

to note if this kernel has stopped

bool SMP::SMPKernel::paused

to note if this kernel has paused

bool SMP::SMPKernel::buf_rw_info

flag to control the display of buffer r/w information


The documentation for this class was generated from the following files:
Generated on Fri Aug 31 15:41:59 2007 for SCREAMLinuxMiddleware(SLIM) by  doxygen 1.5.1