#include <filter.h>
Collaboration diagram for SMP::SMPFilter:

Public Member Functions | |
| SMPFilter (void) | |
| constructor | |
| virtual | ~SMPFilter (void) |
| destructor | |
| void | get_env (int *argc, char ***argv) |
| ssize_t | smp_read (int port_id, void *buff, size_t nbytes) |
| read bytes from buffer (Blocking read) | |
| ssize_t | smp_write (int port_id, const void *buff, size_t nbytes) |
| write bytes to buffer (Blocking write) | |
| ssize_t | smp_read_nonblock (int port_id, void *buff, size_t nbytes) |
| read bytes from buffer (Nonblocking read) | |
| ssize_t | smp_write_nonblock (int port_id, const void *buff, size_t nbytes) |
| write bytes to buffer (Nonblocking write) | |
| ssize_t | smp_read_space (int port_id) |
| ssize_t | smp_write_space (int port_id) |
| void | smp_yield () |
| ssize_t | smp_p_read (int port_id, packet *p_buff, size_t npackets) |
| read packets from buffer (Blocking read) | |
| ssize_t | smp_p_write (int port_id, const packet *p_buff, size_t npackets) |
| write packets to buffer (Blocking write) | |
| ssize_t | smp_p_read_nonblock (int port_id, packet *p_buff, size_t npackets) |
| read packets from buffer (Nonblocking read) | |
| ssize_t | smp_p_write_nonblock (int port_id, const packet *p_buff, size_t npackets) |
| write packets to buffer (Nonblocking write) | |
| bool | smp_input_flush (int port_id, port_model model=DATA_PORT) |
| flush data in the input buffer | |
| bool | smp_output_flush (int port_id, port_model model=DATA_PORT) |
| flush data in the output buffer | |
| bool | inport_connected (port_model model=DATA_PORT) |
| check if all input ports are connected | |
| bool | inport_connected (int port_id, port_model model=DATA_PORT) |
| check if an input port is connected | |
| bool | outport_connected (port_model model=DATA_PORT) |
| check if all output ports are connected | |
| bool | outport_connected (int port_id, port_model model=DATA_PORT) |
| check if an output port is connected | |
| void | set_buf_status (port_type port, int port_id, int status) |
| set buffer status at port port_id | |
| int | get_buf_status (port_type port, int port_id) |
| get buffer status at port port_id | |
| template<class Type> | |
| bool | get_property (const char *property_name, Type &data) |
| get property item to local class member, it also does type auto conversion | |
| string & | get_property (const char *property_name) |
| get property item to local class member, of type string | |
| bool | set_property (const char *property_name, const char *data) |
| set property. Because each property is stored as string indexed by another string this function only accepts string type data | |
| bool | exit_check (void) |
| return true if kernel has stopped, else return false | |
| void | slim_exit (void) |
| set the exit flag so that kernel will stop | |
| bool | is_realtime (void) |
| return true if this filter runs in realtime priority | |
| void | set_output_buf (int output_port, int buf_id, port_model model=DATA_PORT) |
| set a buffer id to a output port | |
| void | set_signal_timeout (int usec) |
| set signal handler's timeout in usec | |
| int | get_signal_timeout (void) |
| get signal handler's timeout in usec | |
| SMPSignal * | create_signal (SMP_SIGNAL_TYPE type=SMP_USEREVENT) |
| a utility to create a signal | |
| void | unregister_watchdog () |
| Unregister the filter itself to watchdog, asking for it to stop watching it. | |
| virtual int | initialize () |
| Filter Initialization (optional) User may define this function to do initialization tasks to their own private data. Constructor for filter. | |
| virtual int | finalize () |
| Filter Finalization (optional) User may define this function to do finalization tasks to their own private data. Destructor for filter. | |
| virtual int | pause () |
| Filter Pause (optional). | |
| virtual int | resume () |
| Filter Resume (optional). | |
| virtual int | process ()=0 |
| Filter's main function. The Filter does things in this function. | |
| virtual int | property_handler () |
| import property to local variables (from string to user-defined) (optional) | |
| int | get_id () |
| get the filter's system id | |
| void | set_watchdog (bool enabled) |
| void | set_signal_watchdog (bool enabled) |
Static Public Member Functions | |
| static void | signal_handler_cleanup (void *arg) |
Protected Member Functions | |
| void | setup (int fid, const char *fname, int major_version, int minor_version, int *in_buf, int num_in, int *out_buf, int num_out) |
| setup basic filter property | |
| void | set_input_buf (int input_port, int buf_id, port_model model=DATA_PORT) |
| set a buffer id to a input port | |
| void | process_wrapper () |
| this function calls process(), and after it returns, unregister itself to watchdog so that watchdog will not think of this filter as problematic | |
| void | set_rt_status (bool realtime) |
| set realtime status of the filter this function is for kernel to set the bool flag in the filter which indicates whether the filter now runs in realtime priority | |
Protected Attributes | |
| int | id |
| char | name [MAX_LEN] |
| int | major |
| int | minor |
| int | priority |
| bool | realtime_on |
| int | num_inport |
| int | num_outport |
| int * | input_buffer |
| int * | output_buffer |
| SMPKernel * | kernel |
| map< string, property_item > | property |
Friends | |
| class | SMPKernel |
| void SMP::SMPFilter::setup | ( | int | fid, | |
| const char * | fname, | |||
| int | major_version, | |||
| int | minor_version, | |||
| int * | in_buf, | |||
| int | num_in, | |||
| int * | out_buf, | |||
| int | num_out | |||
| ) | [protected] |
setup basic filter property
| fid | filter id | |
| fname | filter name | |
| major_version | the major version number | |
| minor_version | the minor version number | |
| in_buf | input buffer id array | |
| num_in | number of input port | |
| out_buf | output buffer id array | |
| num_out | number of output port |
| void SMP::SMPFilter::set_input_buf | ( | int | input_port, | |
| int | buf_id, | |||
| port_model | model = DATA_PORT | |||
| ) | [protected] |
set a buffer id to a input port
| input_port | the input port to set | |
| buf_id | the buffer id to assign |
| ssize_t SMP::SMPFilter::smp_read | ( | int | port_id, | |
| void * | buff, | |||
| size_t | nbytes | |||
| ) |
read bytes from buffer (Blocking read)
| port_id | input port id | |
| buff | memory area for read data | |
| nbytes | number of bytes to read |
| ssize_t SMP::SMPFilter::smp_write | ( | int | port_id, | |
| const void * | buff, | |||
| size_t | nbytes | |||
| ) |
write bytes to buffer (Blocking write)
| port_id | output port id | |
| buff | memory area for data | |
| nbytes | number of bytes to write |
| ssize_t SMP::SMPFilter::smp_read_nonblock | ( | int | port_id, | |
| void * | buff, | |||
| size_t | nbytes | |||
| ) |
| ssize_t SMP::SMPFilter::smp_write_nonblock | ( | int | port_id, | |
| const void * | buff, | |||
| size_t | nbytes | |||
| ) |
| ssize_t SMP::SMPFilter::smp_read_space | ( | int | port_id | ) |
return the available spaces to read on port=port_id
| ssize_t SMP::SMPFilter::smp_write_space | ( | int | port_id | ) |
return the available spaces to write on port=port_id
| void SMP::SMPFilter::smp_yield | ( | ) |
yield execution temporarily to other component
| ssize_t SMP::SMPFilter::smp_p_read | ( | int | port_id, | |
| packet * | p_buff, | |||
| size_t | npackets | |||
| ) |
read packets from buffer (Blocking read)
| port_id | input port id | |
| p_buff | memory area for read packet array | |
| npackets | number of packets to read |
| ssize_t SMP::SMPFilter::smp_p_write | ( | int | port_id, | |
| const packet * | p_buff, | |||
| size_t | npackets | |||
| ) |
write packets to buffer (Blocking write)
| port_id | output port id | |
| p_buff | memory area for packet array | |
| npackets | number of packets to write |
| ssize_t SMP::SMPFilter::smp_p_read_nonblock | ( | int | port_id, | |
| packet * | p_buff, | |||
| size_t | npackets | |||
| ) |
| ssize_t SMP::SMPFilter::smp_p_write_nonblock | ( | int | port_id, | |
| const packet * | p_buff, | |||
| size_t | npackets | |||
| ) |
| bool SMP::SMPFilter::smp_input_flush | ( | int | port_id, | |
| port_model | model = DATA_PORT | |||
| ) |
flush data in the input buffer
| port_id | the port id | |
| model | the port model, DATA_PORT or SIGNAL_PORT. |
| bool SMP::SMPFilter::smp_output_flush | ( | int | port_id, | |
| port_model | model = DATA_PORT | |||
| ) |
flush data in the output buffer
| port_id | the port id | |
| model | the port model, DATA_PORT or SIGNAL_PORT. |
| bool SMP::SMPFilter::inport_connected | ( | port_model | model = DATA_PORT |
) | [inline] |
check if all input ports are connected
| bool SMP::SMPFilter::inport_connected | ( | int | port_id, | |
| port_model | model = DATA_PORT | |||
| ) | [inline] |
check if an input port is connected
| port_id | the input port id to be checked |
| bool SMP::SMPFilter::outport_connected | ( | port_model | model = DATA_PORT |
) | [inline] |
check if all output ports are connected
| bool SMP::SMPFilter::outport_connected | ( | int | port_id, | |
| port_model | model = DATA_PORT | |||
| ) | [inline] |
check if an output port is connected
| port_id | the output port id to be checked |
| bool SMP::SMPFilter::get_property | ( | const char * | property_name, | |
| Type & | data | |||
| ) | [inline] |
get property item to local class member, it also does type auto conversion
| property_name | the property indexed by this string | |
| data | the data which property will save to. |
| string & SMP::SMPFilter::get_property | ( | const char * | property_name | ) | [inline] |
get property item to local class member, of type string
| void SMP::SMPFilter::set_output_buf | ( | int | output_port, | |
| int | buf_id, | |||
| port_model | model = DATA_PORT | |||
| ) |
| SMPSignal* SMP::SMPFilter::create_signal | ( | SMP_SIGNAL_TYPE | type = SMP_USEREVENT |
) |
a utility to create a signal
| type | the type of the signal |
| virtual int SMP::SMPFilter::initialize | ( | ) | [virtual] |
Filter Initialization (optional) User may define this function to do initialization tasks to their own private data. Constructor for filter.
| virtual int SMP::SMPFilter::finalize | ( | ) | [virtual] |
Filter Finalization (optional) User may define this function to do finalization tasks to their own private data. Destructor for filter.
| virtual int SMP::SMPFilter::pause | ( | ) | [virtual] |
Filter Pause (optional).
| virtual int SMP::SMPFilter::resume | ( | ) | [virtual] |
Filter Resume (optional).
| virtual int SMP::SMPFilter::process | ( | ) | [pure virtual] |
Filter's main function. The Filter does things in this function.
| virtual int SMP::SMPFilter::property_handler | ( | ) | [virtual] |
import property to local variables (from string to user-defined) (optional)
| static void SMP::SMPFilter::signal_handler_cleanup | ( | void * | arg | ) | [static] |
unused so far, depricated
int SMP::SMPFilter::id [protected] |
the system id of filter
char SMP::SMPFilter::name[MAX_LEN] [protected] |
the name of the filter
int SMP::SMPFilter::major [protected] |
the version of the filter
int SMP::SMPFilter::priority [protected] |
priority, min = -5, max = 5, currently only for PTH
int SMP::SMPFilter::num_inport [protected] |
number of input ports
int SMP::SMPFilter::num_outport [protected] |
number of output ports
int* SMP::SMPFilter::input_buffer [protected] |
input buffers' id array if the value equals -1, it is not connected size is num_inport
int* SMP::SMPFilter::output_buffer [protected] |
output buffers' id array if the value equals -1, it is not connected size is num_output
SMPKernel* SMP::SMPFilter::kernel [protected] |
SMP kernel
map<string, property_item> SMP::SMPFilter::property [protected] |
filter property double hash. 1st: Key is the item name, Value is the second hash; 2st: Key is the property name, Value is the item's value
1.5.1