Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Request Class Reference

The Request class is a unicast message directed at a given module. More...

#include <modules.h>

Inheritance diagram for Request:

Inheritance graph
[legend]
Collaboration diagram for Request:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Request (char *anydata, Module *src, Module *dst)
 Create a new Request.
char * GetData ()
 Fetch the Request data.
ModuleGetSource ()
 Fetch the request source.
ModuleGetDest ()
 Fetch the request destination (should be 'this' in the receiving module).
char * Send ()
 Send the Request.

Protected Attributes

char * data
 This member holds a pointer to arbitary data set by the emitter of the message.
Modulesource
 This is a pointer to the sender of the message, which can be used to directly trigger events, or to create a reply.
Moduledest
 The single destination of the Request.

Detailed Description

The Request class is a unicast message directed at a given module.

When this class is properly instantiated it may be sent to a module using the Send() method, which will call the given module's OnRequest method with this class as its parameter.

Definition at line 157 of file modules.h.


Constructor & Destructor Documentation

Request::Request char *  anydata,
Module src,
Module dst
 

Create a new Request.

Definition at line 173 of file modules.cpp.

00173 : data(anydata), source(src), dest(dst) { };


Member Function Documentation

char * Request::GetData  ) 
 

Fetch the Request data.

Definition at line 175 of file modules.cpp.

References data.

00176 {
00177         return this->data;
00178 }

Module * Request::GetDest  ) 
 

Fetch the request destination (should be 'this' in the receiving module).

Definition at line 185 of file modules.cpp.

References dest.

00186 {
00187         return this->dest;
00188 }

Module * Request::GetSource  ) 
 

Fetch the request source.

Definition at line 180 of file modules.cpp.

References source.

00181 {
00182         return this->source;
00183 }

char * Request::Send  )  [virtual]
 

Send the Request.

Upon returning the result will be arbitary data returned by the module you sent the request to. It is up to your module to know what this data is and how to deal with it.

Implements ModuleMessage.

Definition at line 190 of file modules.cpp.

References dest, and Module::OnRequest().

00191 {
00192         if (this->dest)
00193         {
00194                 return dest->OnRequest(this);
00195         }
00196         else
00197         {
00198                 return NULL;
00199         }
00200 }


Member Data Documentation

char* Request::data [protected]
 

This member holds a pointer to arbitary data set by the emitter of the message.

Definition at line 162 of file modules.h.

Referenced by GetData().

Module* Request::dest [protected]
 

The single destination of the Request.

Definition at line 169 of file modules.h.

Referenced by GetDest(), and Send().

Module* Request::source [protected]
 

This is a pointer to the sender of the message, which can be used to directly trigger events, or to create a reply.

Definition at line 166 of file modules.h.

Referenced by GetSource().


The documentation for this class was generated from the following files:
Generated on Wed Dec 14 14:49:32 2005 for InspIRCd by  doxygen 1.4.4-20050815