WARNING: USE THIS SOFTWARE AT YOUR OWN RISK! THIS IS EXPERIMENTAL SOFTWARE NOT INTENDED FOR PRODUCTION USE! Zuble is currently an early stage prototype. As such Zuble is minimally tested and inherently unstable. It is provided for experimental, development, and demonstration purposes only. Zuble QML Types   |  Zuble C++ Classes   |  Zuble Overview
Zuble  0.1
Zuble Framework C++/QML extension API
Signals | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Types | List of all members
Zbl::ZMailbox Class Reference

A two-way messaging communication channel that supports buffered message streams to multiple end points. More...

#include <ZMailbox.h>

Inheritance diagram for Zbl::ZMailbox:
Inheritance graph
[legend]
Collaboration diagram for Zbl::ZMailbox:
Collaboration graph
[legend]

Signals

void mailslotCreated (const QString &owner, const QString &mailslot)
 Sent when a mail slot has been created. More...
 
void mailslotRemoved (const QString &owner, const QString &mailslot)
 Sent when a mail slot has been removed. More...
 

Public Member Functions

 ZMailbox (QObject *parent=0)
 
Q_INVOKABLE void setOwnerName (const QString &name)
 Set the name of the mailbox owner. More...
 
Q_INVOKABLE const QString getOwnerName ()
 Get the name of the mailbox owner. More...
 
Q_INVOKABLE QObject * mailslot (const QString &slotName)
 Returns the ZMailslot object for the named mailslot. More...
 
Q_INVOKABLE QObject * createMailslot (const QString &mailslot)
 creates and returns the ZMailslot object for the named mailslot. More...
 
Q_INVOKABLE void removeMailslot (const QString &mailslot)
 removes the ZMailslot object for the named mailslot from the Mailbox. More...
 
Q_INVOKABLE bool hasMailslot (const QString &mailslot)
 Checks to see if a mailslot exists. More...
 
Q_INVOKABLE QStringList getSlotNames ()
 Returns an array containing the names of all mailslots in the mailbox. More...
 

Static Public Member Functions

static void registerType ()
 Register ZMailbox as a QML type. More...
 

Protected Attributes

zMailslotMap m_slots
 Mail slots mapped by name. More...
 
QString m_ownerName
 Name of the mailbox owner. More...
 

Private Types

typedef QMap< QString, ZMailslot * > zMailslotMap
 

Detailed Description

A two-way messaging communication channel that supports buffered message streams to multiple end points.

The mailbox provides bidirectional communication between the mailslot owner and multiple named endpoints. Each endpoint communicates with the owner through its own mailslot object. Each mailslot supports two message queues - one each for sending and receiving messages with the endpoint.

ZMailbox, ZMailslot and ZMessageQueue are reentrant but not thread safe. The mailbox owner and the enpoints must all have the same thread affinity (ie. be in the same thread).

See also
ZMailslot ZMessageQueue

Definition at line 52 of file ZMailbox.h.

Member Typedef Documentation

◆ zMailslotMap

typedef QMap<QString, ZMailslot*> Zbl::ZMailbox::zMailslotMap
private

Definition at line 56 of file ZMailbox.h.

Constructor & Destructor Documentation

◆ ZMailbox()

Zbl::ZMailbox::ZMailbox ( QObject *  parent = 0)
explicit

Definition at line 33 of file ZMailbox.cpp.

Member Function Documentation

◆ createMailslot()

QObject * Zbl::ZMailbox::createMailslot ( const QString &  mailslot)

creates and returns the ZMailslot object for the named mailslot.

Returns
A ZMailslot object or NULL if the named mailslot already exists

Definition at line 59 of file ZMailbox.cpp.

◆ getOwnerName()

const QString Zbl::ZMailbox::getOwnerName ( )

Get the name of the mailbox owner.

Definition at line 49 of file ZMailbox.cpp.

◆ getSlotNames()

QStringList Zbl::ZMailbox::getSlotNames ( )

Returns an array containing the names of all mailslots in the mailbox.

Definition at line 94 of file ZMailbox.cpp.

◆ hasMailslot()

bool Zbl::ZMailbox::hasMailslot ( const QString &  mailslot)

Checks to see if a mailslot exists.

Definition at line 89 of file ZMailbox.cpp.

◆ mailslot()

QObject * Zbl::ZMailbox::mailslot ( const QString &  slotName)

Returns the ZMailslot object for the named mailslot.

Returns
A ZMailslot object or NULL if the named mailslot doesn't exist

Definition at line 54 of file ZMailbox.cpp.

◆ mailslotCreated

void Zbl::ZMailbox::mailslotCreated ( const QString &  owner,
const QString &  mailslot 
)
signal

Sent when a mail slot has been created.

Referenced by createMailslot().

◆ mailslotRemoved

void Zbl::ZMailbox::mailslotRemoved ( const QString &  owner,
const QString &  mailslot 
)
signal

Sent when a mail slot has been removed.

Referenced by removeMailslot().

◆ registerType()

void Zbl::ZMailbox::registerType ( )
static

Register ZMailbox as a QML type.

Definition at line 38 of file ZMailbox.cpp.

Referenced by Zbl::Zblcore::registerTypes().

◆ removeMailslot()

void Zbl::ZMailbox::removeMailslot ( const QString &  mailslot)

removes the ZMailslot object for the named mailslot from the Mailbox.

The removed ZMailslot object will be deleted by calling deleteLater(). Issues the mailslotRemoved() signal.

Definition at line 75 of file ZMailbox.cpp.

◆ setOwnerName()

void Zbl::ZMailbox::setOwnerName ( const QString &  name)

Set the name of the mailbox owner.

Definition at line 44 of file ZMailbox.cpp.

Member Data Documentation

◆ m_ownerName

QString Zbl::ZMailbox::m_ownerName
protected

Name of the mailbox owner.

Definition at line 141 of file ZMailbox.h.

Referenced by createMailslot(), getOwnerName(), removeMailslot(), and setOwnerName().

◆ m_slots

zMailslotMap Zbl::ZMailbox::m_slots
protected

Mail slots mapped by name.

Definition at line 135 of file ZMailbox.h.

Referenced by createMailslot(), getSlotNames(), hasMailslot(), mailslot(), and removeMailslot().


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