rlmm::basic_callback< Lock > Struct Template Reference
[The Readline classes.]

#include <rlmm/callback.hh>

Inheritance diagram for rlmm::basic_callback< Lock >:

Inheritance graph
[legend]
Collaboration diagram for rlmm::basic_callback< Lock >:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename Lock>
struct rlmm::basic_callback< Lock >

Readline in call-back mode.

In this mode, the user application controls the event loop, and readline is only executed when so requested from the application. The member function read should be called when the application deems that terminal input is ok. This mode is useful for for example GUIs, and probably also multithreaded programs. There can only be one call back handler at a given time. The member function handle is called when a full line is read by successive call-backs.

Note, that you still need to instantice a rlmm::readline object to control other aspects of the C library.

Simply instanising an object of a sub-class will not install the handler - the member function install must be called on the object. When the object is deleted (out of scope or explicit delete), the call back handler is removed.


Public Member Functions

virtual ~basic_callback ()
virtual void read ()
const std::string & prompt () const
void install (const std::string &p)
virtual void handle (char *line)

Protected Member Functions

 basic_callback ()
 basic_callback (const basic_callback &o)
basic_callbackoperator= (const basic_callback &o)

Protected Attributes

std::string _prompt

Friends

class singleton


Constructor & Destructor Documentation

template<typename Lock>
rlmm::basic_callback< Lock >::basic_callback  )  [inline, protected]
 

Create the call back.

template<typename Lock>
rlmm::basic_callback< Lock >::basic_callback const basic_callback< Lock > &  o  )  [inline, protected]
 

Create the call back.

template<typename Lock>
rlmm::basic_callback< Lock >::~basic_callback  )  [inline, virtual]
 

Remove and free the call back handler.


Member Function Documentation

template<typename Lock>
virtual void rlmm::basic_callback< Lock >::handle char *  line  )  [inline, virtual]
 

Abstract member function to overload.

This member function is called when a full line is read from the input.

Parameters:
line The read line.

template<typename Lock>
void rlmm::basic_callback< Lock >::install const std::string &  p  )  [inline]
 

Set the prompt, and install call back handler.

template<typename Lock>
basic_callback& rlmm::basic_callback< Lock >::operator= const basic_callback< Lock > &  o  )  [inline, protected]
 

template<typename Lock>
const std::string& rlmm::basic_callback< Lock >::prompt  )  const [inline]
 

Get the prompt.

template<typename Lock>
void rlmm::basic_callback< Lock >::read  )  [inline, virtual]
 

Method to execute periodically.

Read one (or more) character from the input.

Examples:
callback.cc.


Friends And Related Function Documentation

template<typename Lock>
friend class singleton [friend]
 

Base class is a friend.


Member Data Documentation

template<typename Lock>
std::string rlmm::basic_callback< Lock >::_prompt [protected]
 

The prompt.


The documentation for this struct was generated from the following file:
Top of page
Last update Fri Aug 26 15:19:53 2005
Christian Holm
Created by DoxyGen 1.4.4