Console Input/OutputThe ConsoleEchoer component outputs whatever it receives to the console. The ConsoleReader component outputs whatever is typed at the console, a line at a time. Example UsageWhatever it typed is echoed back, a line at a time: Pipeline( ConsoleReader(), ConsoleEchoer() ).run() How does it work?ConsoleReader is a threaded component. It provides a 'prompt' at which you can type. Your input is taken, a line a a time, and output to its "outbox" outbox, with the specified end-of-line character(s) suffixed onto it. The ConsoleReader component ignores any input on its "inbox" and "control" inboxes. It does not output anything from its "signal" outbox. The ConsoleReader component does not terminate. The ConsoleEchoer component receives data on its "inbox" inbox. Anything it receives this way is displayed on standard output. All items are passed through the str() builtin function to convert them to strings suitable for display. However, if the 'use_repr' argument is set to True during initialization, then repr() will be used instead of str(). Similarly if a "tag" is provided it's prepended before the data. If the 'forwarder' argument is set to True during initialisation, then whatever is received is not only displayed, but also set on to the "outbox" outbox (unchanged). If a producerFinished or shutdownMicroprocess message is received on the ConsoleEchoer component's "control" inbox, then it is sent on to the "signal" outbox and the component then terminates. Kamaelia.Util.Console.ConsoleEchoerclass ConsoleEchoer(Axon.Component.component)ConsoleEchoer([forwarder][,use_repr][,tag]) -> new ConsoleEchoer component. A component that outputs anything it is sent to standard output (the console). Keyword arguments:
Inboxes
Outboxes
Methods defined hereWarning! You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers. __init__(self[, forwarder][, use_repr][, tag])x.__init__(...) initializes x; see x.__class__.__doc__ for signature main(self)Main loop body. Kamaelia.Util.Console.ConsoleReaderclass ConsoleReader(Axon.ThreadedComponent.threadedcomponent)ConsoleReader([prompt][,eol]) -> new ConsoleReader component. Component that provides a console for typing in stuff. Each line is output from the "outbox" outbox one at a time. Keyword arguments:
Inboxes
Outboxes
Methods defined hereWarning! You should be using the inbox/outbox interface, not these methods (except construction). This documentation is designed as a roadmap as to their functionalilty for maintainers and new component developers. __init__(self[, prompt][, eol])x.__init__(...) initializes x; see x.__class__.__doc__ for signature main(self)Main thread loop. FeedbackGot a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording! Please leave you feedback here in reply to the documentation thread in the Kamaelia blog. -- Automatic documentation generator, 05 Jun 2009 at 03:01:38 UTC/GMT |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved.