libkdegames Library API Documentation

KMessageDirect Class Reference

This class implements the message communication using function calls directly. More...

#include <kmessageio.h>

Inheritance diagram for KMessageDirect:

KMessageIO QObject List of all members.

Public Methods

 KMessageDirect (KMessageDirect *partner=0, QObject *parent=0, const char *name=0)
 ~KMessageDirect ()
virtual int rtti () const
bool isNetwork () const
bool isConnected () const
void send (const QByteArray &msg)

Protected Attributes

KMessageDirect * mPartner

Detailed Description

This class implements the message communication using function calls directly.

It can only be used when both sides of the message pipe are within the same process. The communication is very fast.

To establish a communication, you have to create two instances of KMessageDirect, the first one with no parameters in the constructor, the second one with the first as parameter:

/code KMessageDirect *peer1, *peer2; peer1 = new KMessageDirect (); // unconnected peer2 = new KMessageDirect (peer1); // connect with peer1 /endcode

The connection is only closed when one of the instances is deleted.

Definition at line 295 of file kmessageio.h.


Constructor & Destructor Documentation

KMessageDirect::KMessageDirect KMessageDirect *    partner = 0,
QObject   parent = 0,
const char *    name = 0
 

Creates an object and connects it to the object given in the first parameter.

Use 0 as first parameter to create an unconnected object, that is later connected.

If that object is already connected, the object remains unconnected.

Definition at line 180 of file kmessageio.cpp.

References mPartner.

KMessageDirect::~KMessageDirect  
 

Destructor, closes the connection.

Definition at line 202 of file kmessageio.cpp.

References KMessageIO::connectionBroken(), and mPartner.


Member Function Documentation

virtual int KMessageDirect::rtti   const [inline, virtual]
 

The runtime idendifcation.

Reimplemented from KMessageIO.

Definition at line 318 of file kmessageio.h.

bool KMessageDirect::isNetwork   const [inline, virtual]
 

Returns:
FALSE as this is no network IO.

Reimplemented from KMessageIO.

Definition at line 324 of file kmessageio.h.

bool KMessageDirect::isConnected   const [virtual]
 

Returns true, if the object is connected to another instance.

If you use the first constructor, the object is unconnected unless another object is created with this one as parameter.

The connection can only be closed by deleting one of the objects.

Reimplemented from KMessageIO.

Definition at line 211 of file kmessageio.cpp.

void KMessageDirect::send const QByteArray   msg [virtual]
 

Overwritten slot method from KMessageIO.

Note: It is not declared as a slot method, since the slot is already defined in KMessageIO as a virtual method.

Implements KMessageIO.

Definition at line 216 of file kmessageio.cpp.

References KMessageIO::received().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for libkdegames Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 10:06:39 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003