Classes | Public Member Functions | Private Attributes

Fastcgipp::Manager< T > Class Template Reference

General task and protocol management class. More...

#include <manager.hpp>

Inheritance diagram for Fastcgipp::Manager< T >:
Fastcgipp::ManagerPar

List of all members.

Classes

class  Requests
 Associative container type for active requests. More...

Public Member Functions

 Manager (int fd=0)
 Construct from a file descriptor.
void handler ()
 General handling function to be called after construction.
void push (Protocol::FullId id, Message message)
 Passes messages to requests.

Private Attributes

Requests requests
 Associative container type for active requests.

Detailed Description

template<class T>
class Fastcgipp::Manager< T >

General task and protocol management class.

Handles all task and protocol management, creation/destruction of requests and passing of messages to requests. The template argument should be a class type derived from the Request class with at least the response() function defined. To operate this class all that needs to be done is creating an object and calling handler() on it.

Template Parameters:
TClass that will handle individual requests. Should be derived from the Request class.

Definition at line 180 of file manager.hpp.


Constructor & Destructor Documentation

template<class T>
Fastcgipp::Manager< T >::Manager ( int  fd = 0 ) [inline]

Construct from a file descriptor.

The only piece of data required to construct a Manager object is a file descriptor to listen on for incoming connections. By default mod_fastcgi sets up file descriptor 0 to do this so it is the value passed by default to the constructor. The only time it would be another value is if an external FastCGI server was defined.

Parameters:
[in]fdFile descriptor to listen on.

Definition at line 193 of file manager.hpp.


Member Function Documentation

template<class T >
void Fastcgipp::Manager< T >::handler (  )

General handling function to be called after construction.

This function will loop continuously manager tasks and FastCGI requests until either the stop() function is called (obviously from another thread) or the appropriate signals are caught.

See also:
setupSignals()

Definition at line 281 of file manager.hpp.

template<class T >
void Fastcgipp::Manager< T >::push ( Protocol::FullId  id,
Message  message 
)

Passes messages to requests.

Whenever a message needs to be passed to a request, it must be done through this function. Requests are associated with their Protocol::FullId value so that and the message itself is all that is needed. Calling this function from another thread is safe. Although this function can be called from outside the fastcgi++ library, the Request class contains a callback function based on this that is more usable. An id with a Protocol::RequestId of 0 means the message is destined for the Manager itself. Should a message by passed with an id that doesn't exist, it will be discarded.

Parameters:
[in]idThe id of the request the message should go to
[in]messageThe message itself
See also:
Request::callback

Definition at line 238 of file manager.hpp.

References Fastcgipp::Protocol::BEGIN_REQUEST, Fastcgipp::Message::data, and Fastcgipp::Message::type.


Member Data Documentation

template<class T>
Requests Fastcgipp::Manager< T >::requests [private]

Associative container type for active requests.

This container associated the Protocol::FullId of each active request with a pointer to the actual Request object.

Definition at line 234 of file manager.hpp.


The documentation for this class was generated from the following file: