mb_mblock Class Reference

#include <mb_mblock.h>

Inheritance diagram for mb_mblock:

Inheritance graph
[legend]
Collaboration diagram for mb_mblock:

Collaboration graph
[legend]
List of all members.

Detailed Description

Parent class for all message passing blocks.

Subclass this to define your mblocks.


Public Member Functions

virtual ~mb_mblock ()
bool walk_tree (mb_visitor *visitor, const std::string &path="")
 Perform a pre-order depth-first traversal of the hierarchy.
mb_mblock_impl_sptr impl () const
 

Protected Member Functions

 mb_mblock ()
 mblock constructor.
virtual void init_fsm ()
 Called by the runtime system to execute the initial transition of the finite state machine.
virtual void handle_message (mb_message_sptr msg)
 Called by the runtime system when there's a message to handle.
mb_port_sptr define_port (const std::string &port_name, const std::string &protocol_class_name, bool conjugated, mb_port::port_type_t port_type)
 Define a port.
void define_component (const std::string &component_name, mb_mblock_sptr component)
 Define a subcomponent by name.
void connect (const std::string &comp_name1, const std::string &port_name1, const std::string &comp_name2, const std::string &port_name2)
 connect endpoint_1 to endpoint_2
void disconnect (const std::string &comp_name1, const std::string &port_name1, const std::string &comp_name2, const std::string &port_name2)
 disconnect endpoint_1 from endpoint_2
void disconnect_component (const std::string component_name)
 disconnect all connections to specified component
void disconnect_all ()
 disconnect all connections to all components
int nconnections () const
 Return number of connections (QA mostly).

Friends

class mb_runtime
class mb_mblock_impl


Constructor & Destructor Documentation

mb_mblock::mb_mblock  )  [protected]
 

mblock constructor.

Initializing all mblocks in the system is a 3 step procedure.

The top level mblock's constructor is run. That constructor (a) registers all of its ports using define_port, (b) constructs and registers any subcomponents it may have via the define_component method, and then (c) issues connect calls to wire its subcomponents together.

mb_mblock::~mb_mblock  )  [virtual]
 


Member Function Documentation

void mb_mblock::connect const std::string &  comp_name1,
const std::string &  port_name1,
const std::string &  comp_name2,
const std::string &  port_name2
[protected]
 

connect endpoint_1 to endpoint_2

Parameters:
comp_name1 component on one end of the connection
port_name1 the name of the port on comp1
comp_name2 component on the other end of the connection
port_name2 the name of the port on comp2
An endpoint is specified by the component's local name (given as component_name in the call to register_component) and the name of the port on that component.

To connect an internal or relay port, use "self" as the component name.

void mb_mblock::define_component const std::string &  component_name,
mb_mblock_sptr  component
[protected]
 

Define a subcomponent by name.

Called within the constructor to tell the system the names and identities of our sub-component mblocks.

Parameters:
component_name The name of the sub-component (must be unique with this mblock).
component The sub-component instance.

mb_port_sptr mb_mblock::define_port const std::string &  port_name,
const std::string &  protocol_class_name,
bool  conjugated,
mb_port::port_type_t  port_type
[protected]
 

Define a port.

EXTERNAL and RELAY ports are part of our peer interface. INTERNAL ports are used to talk to sub-components.

Parameters:
port_name The name of the port (must be unique within this mblock).
protocol_class_name The name of the protocol class associated with this port. It must already be defined.
conjugated Are the incoming and outgoing message sets swapped?
port_type INTERNAL, EXTERNAL or RELAY.

void mb_mblock::disconnect const std::string &  comp_name1,
const std::string &  port_name1,
const std::string &  comp_name2,
const std::string &  port_name2
[protected]
 

disconnect endpoint_1 from endpoint_2

Parameters:
comp_name1 component on one end of the connection
port_name1 the name of the port on comp1
comp_name2 component on the other end of the connection
port_name2 the name of the port on comp2
An endpoint is specified by the component's local name (given as component_name in the call to register_component) and the name of the port on that component.

To disconnect an internal or relay port, use "self" as the component name.

void mb_mblock::disconnect_all  )  [protected]
 

disconnect all connections to all components

void mb_mblock::disconnect_component const std::string  component_name  )  [protected]
 

disconnect all connections to specified component

Parameters:
component_name component to disconnect

void mb_mblock::handle_message mb_message_sptr  msg  )  [protected, virtual]
 

Called by the runtime system when there's a message to handle.

Override this to define your behavior.

Do not issue any potentially blocking calls in this method. This includes things such reads or writes on sockets, pipes or slow i/o devices.

mb_mblock_impl_sptr mb_mblock::impl  )  const [inline]
 

void mb_mblock::init_fsm  )  [protected, virtual]
 

Called by the runtime system to execute the initial transition of the finite state machine.

Override this to initialize your finite state machine.

int mb_mblock::nconnections  )  const [protected]
 

Return number of connections (QA mostly).

bool mb_mblock::walk_tree mb_visitor visitor,
const std::string &  path = ""
 

Perform a pre-order depth-first traversal of the hierarchy.

The traversal stops and returns false if any call to visitor returns false.


Friends And Related Function Documentation

friend class mb_mblock_impl [friend]
 

friend class mb_runtime [friend]
 


The documentation for this class was generated from the following files:
Generated on Wed Jan 31 17:21:16 2007 for GNU Radio 3.0svn by  doxygen 1.4.6