#include <StrMod/StreamModule.h>
Inheritance diagram for strmod::strmod::StreamModule:

Public Methods | |
| StreamModule () | |
| Abstract class, doesn't do much. | |
| virtual | ~StreamModule () |
| Prudently virtual in an abstract base class. | |
| virtual int | AreYouA (const lcore::ClassIdent &id) const |
| Asks if a class is of a particular type, or publicly derived from that type. | |
| virtual bool | canCreate (int side) const=0 |
| Can a plug be created on the given side? | |
| Plug * | makePlug (int side) |
| Attempts to create a plug on the given side. | |
| virtual bool | ownsPlug (const Plug *plug) const=0 |
| Does the module own this plug? | |
| virtual bool | deletePlug (Plug *plug)=0 |
| Please delete this plug. | |
| PlugDisconnectStrategy * | getPDStrategy () const |
| Get the current PlugDisconnectStrategy. | |
| void | setPDStrategy (PlugDisconnectStrategy *pds) |
| Set the current PlugDisconnectStrategy. | |
Static Public Attributes | |
| const STR_ClassIdent | identifier |
| A unique identifier for this class. | |
Protected Methods | |
| virtual const lcore::ClassIdent * | i_GetIdent () const |
| Returns the class identifier for the class the object actually is. | |
| virtual void | plugDisconnected (Plug *plug) |
| Called whenever a plug is disconnected. | |
| virtual Plug * | i_MakePlug (int side)=0 |
| Makes a plug on the given side. | |
| void | setReadableFlagFor (Plug *p, bool val) |
| Used to set the readable flag of a plug since their set method is protected. | |
| void | setWriteableFlagFor (Plug *p, bool val) |
| Used to set the writeable flag of a plug since their set method is protected. | |
Friends | |
| class | Plug |
A StreamModule module can be thought of as a processing element in a stream of data. A StreamModule's 'sides' represent ports at which data can enter or leave the module.
If you were to think of the UNIX utility 'grep' as a StreamModule, it's 0 side would be stdin, and it's 1 side would be stdout. Depending on the implementation, it might also have a 2 side, where error messages are sent.
Of course, grep's 'sides' are not bi-directional, they are uni-directional. As a rule, a StreamModule's data port (a Plug) is bi-directional. One way to encapsulate a UNIX program designed to run in a pipeline would be to make a module that has a 0 side (stdin) a 1 side, with it either passing data unchanged in the reverse direction, or refusing to pass data in the reverse direction at all.
Another way would be to model it as a single sided StreamModule with it's input and output happening on the same plug. This would sort of violate the spirit of the StreamModule system though. There's currently only one module which operates this way, the EchoModule, which merely echoes all of its input to its output.
Definition at line 73 of file StreamModule.h.
|
|
Asks if a class is of a particular type, or publicly derived from that type. Overriden in every derived class (with a static identifier member) to compare against the identifier, then call the AreYouA methods of all the superclasses.
Reimplemented from strmod::lcore::Protocol. Reimplemented in strmod::strmod::EchoModule, strmod::strmod::InfiniteModule, strmod::strmod::ProcessorModule, strmod::strmod::RouterModule, strmod::strmod::SimpleMultiplexer, strmod::strmod::SimpleTelnetClient, strmod::strmod::SockListenModule, and strmod::strmod::StreamFDModule. Definition at line 391 of file StreamModule.h. |
|
|
Please delete this plug. Modules are supposed to own plugs, so you aren't supposed to delete them yourself. Returns false on failure. Failure could happen because module does not own the plug. Implemented in strmod::strmod::EchoModule, strmod::strmod::InfiniteModule, strmod::strmod::ProcessorModule, strmod::strmod::RouterModule, strmod::strmod::SimpleMultiplexer, strmod::strmod::SimpleTelnetClient, strmod::strmod::SockListenModule, strmod::strmod::StreamFDModule, and strmod::strmod::StreamSplitterModule. |
|
|
Get the current PlugDisconnectStrategy. Deleting the object you get this way is a BAD thing unless you set a new strategy before you do it. Definition at line 408 of file StreamModule.h. |
|
|
Returns the class identifier for the class the object actually is. Should always be overridden in any class that has a static identifier member. Reimplemented from strmod::lcore::Protocol. Reimplemented in strmod::strmod::EchoModule, strmod::strmod::InfiniteModule, strmod::strmod::ProcessorModule, strmod::strmod::RouterModule, strmod::strmod::SimpleTelnetClient, strmod::strmod::SockListenModule, strmod::strmod::StreamFDModule, and strmod::strmod::StreamSplitterModule. Definition at line 158 of file StreamModule.h. |
|
|
Makes a plug on the given side. Guaranteed to never be called if canCreate would return false. Must NEVER return 0 (NULL). Implemented in strmod::strmod::EchoModule, strmod::strmod::InfiniteModule, strmod::strmod::ProcessorModule, strmod::strmod::RouterModule, strmod::strmod::SimpleMultiplexer, strmod::strmod::SimpleTelnetClient, strmod::strmod::SockListenModule, strmod::strmod::StreamFDModule, and strmod::strmod::StreamSplitterModule. |
|
|
Attempts to create a plug on the given side. When writing a derived class, your MakePlug function should ALWAYS call CanCreate first before calling i_MakePlug. Returns 0 (NULL) on failure. Only fails if CanCreate would return false. Reimplemented in strmod::strmod::EchoModule, strmod::strmod::InfiniteModule, and strmod::strmod::SockListenModule. Definition at line 396 of file StreamModule.h. |
|
|
Called whenever a plug is disconnected. This function isn't called when a plug is disconnected as a result of its destructor being called. This is used to provide a hook to do what you think you should do when a plug is disconnected. It calls the pdstrategy_ by default, if there is one. Reimplemented in strmod::strmod::EchoModule, strmod::strmod::SimpleMultiplexer, and strmod::strmod::StreamSplitterModule. Definition at line 418 of file StreamModule.h. |
|
|
Set the current PlugDisconnectStrategy. The StreamModule does not assume responsibility for deleting the object you pass in. Of course, if you delete it while the StreamModule has it set, that will probably cause bad things to happen. Setting the strategy to NULL essentially turns it off. Definition at line 413 of file StreamModule.h. |
1.3-rc1