Quassel IRC  Pre-Release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
SignalProxy Class Reference

#include </tmp/quassel/src/common/signalproxy.h>

Collaboration diagram for SignalProxy:

Classes

class  ExtendedMetaObject
class  SignalRelay

Public Types

enum  ProxyMode { Server, Client }
enum  EventType { RemovePeerEvent = QEvent::User }

Public Slots

void detachObject (QObject *obj)
void detachSignals (QObject *sender)
void detachSlots (QObject *receiver)

Signals

void peerRemoved (Peer *peer)
void connected ()
void disconnected ()
void objectInitialized (SyncableObject *)
void heartBeatIntervalChanged (int secs)
void maxHeartBeatCountChanged (int max)
void lagUpdated (int lag)
void secureStateChanged (bool)

Public Member Functions

 SignalProxy (QObject *parent)
 SignalProxy (ProxyMode mode, QObject *parent)
virtual ~SignalProxy ()
void setProxyMode (ProxyMode mode)
ProxyMode proxyMode () const
void setHeartBeatInterval (int secs)
int heartBeatInterval () const
void setMaxHeartBeatCount (int max)
int maxHeartBeatCount () const
bool addPeer (Peer *peer)
bool attachSignal (QObject *sender, const char *signal, const QByteArray &sigName=QByteArray())
bool attachSlot (const QByteArray &sigName, QObject *recv, const char *slot)
void synchronize (SyncableObject *obj)
void stopSynchronize (SyncableObject *obj)
ExtendedMetaObjectextendedMetaObject (const QMetaObject *meta) const
ExtendedMetaObjectcreateExtendedMetaObject (const QMetaObject *meta, bool checkConflicts=false)
ExtendedMetaObjectextendedMetaObject (const QObject *obj) const
ExtendedMetaObjectcreateExtendedMetaObject (const QObject *obj, bool checkConflicts=false)
bool isSecure () const
void dumpProxyStats ()
void dumpSyncMap (SyncableObject *object)
int peerCount () const

Protected Member Functions

void customEvent (QEvent *event)
void sync_call__ (const SyncableObject *obj, ProxyMode modeType, const char *funcname, va_list ap)
void renameObject (const SyncableObject *obj, const QString &newname, const QString &oldname)

Private Types

typedef QPair< QObject *, int > MethodId
typedef QMultiHash< QByteArray,
MethodId
SlotHash
typedef QHash< QString,
SyncableObject * > 
ObjectId

Private Slots

void removePeerBySender ()
void objectRenamed (const QByteArray &classname, const QString &newname, const QString &oldname)
void updateSecureState ()

Private Member Functions

void init ()
void initServer ()
void initClient ()
void removePeer (Peer *peer)
void removeAllPeers ()
template<class T >
void dispatch (const T &protoMessage)
template<class T >
void dispatch (Peer *peer, const T &protoMessage)
void handle (Peer *peer, const Protocol::SyncMessage &syncMessage)
void handle (Peer *peer, const Protocol::RpcCall &rpcCall)
void handle (Peer *peer, const Protocol::InitRequest &initRequest)
void handle (Peer *peer, const Protocol::InitData &initData)
template<class T >
void handle (Peer *, T)
bool invokeSlot (QObject *receiver, int methodId, const QVariantList &params, QVariant &returnValue, Peer *peer=0)
bool invokeSlot (QObject *receiver, int methodId, const QVariantList &params=QVariantList(), Peer *peer=0)
void requestInit (SyncableObject *obj)
QVariantMap initData (SyncableObject *obj) const
void setInitData (SyncableObject *obj, const QVariantMap &properties)

Static Private Member Functions

static const QMetaObject * metaObject (const QObject *obj)
static void disconnectDevice (QIODevice *dev, const QString &reason=QString())

Private Attributes

QSet< Peer * > _peers
QHash< const QMetaObject
*, ExtendedMetaObject * > 
_extendedMetaObjects
SignalRelay_signalRelay
SlotHash _attachedSlots
QHash< QByteArray, ObjectId_syncSlave
ProxyMode _proxyMode
int _heartBeatInterval
int _maxHeartBeatCount
bool _secure

Friends

class SignalRelay
class SyncableObject
class Peer

Detailed Description

Definition at line 35 of file signalproxy.h.

Member Typedef Documentation

typedef QPair<QObject *, int> MethodId
private

Definition at line 151 of file signalproxy.h.

typedef QMultiHash<QByteArray, MethodId> SlotHash
private

Definition at line 152 of file signalproxy.h.

typedef QHash<QString, SyncableObject *> ObjectId
private

Definition at line 156 of file signalproxy.h.

Member Enumeration Documentation

enum ProxyMode
Enumerator:
Server 
Client 

Definition at line 42 of file signalproxy.h.

enum EventType
Enumerator:
RemovePeerEvent 

Definition at line 47 of file signalproxy.h.

Constructor & Destructor Documentation

SignalProxy ( QObject *  parent)

Definition at line 174 of file signalproxy.cpp.

References init(), and setProxyMode().

SignalProxy ( ProxyMode  mode,
QObject *  parent 
)

Definition at line 182 of file signalproxy.cpp.

References init(), and setProxyMode().

~SignalProxy ( )
virtual

Definition at line 190 of file signalproxy.cpp.

References _syncSlave, removeAllPeers(), and SyncableObject::stopSynchronize().

Member Function Documentation

void setProxyMode ( ProxyMode  mode)

Definition at line 208 of file signalproxy.cpp.

References _peers, _proxyMode, initClient(), initServer(), and Server.

Referenced by SignalProxy().

ProxyMode proxyMode ( ) const
inline
void setHeartBeatInterval ( int  secs)
int heartBeatInterval ( ) const
inline

Definition at line 59 of file signalproxy.h.

References _heartBeatInterval.

Referenced by RemotePeer::setSignalProxy().

int maxHeartBeatCount ( ) const
inline

Definition at line 61 of file signalproxy.h.

References _maxHeartBeatCount.

bool attachSignal ( QObject *  sender,
const char *  signal,
const QByteArray &  sigName = QByteArray() 
)
bool attachSlot ( const QByteArray &  sigName,
QObject *  recv,
const char *  slot 
)
void stopSynchronize ( SyncableObject obj)

Definition at line 490 of file signalproxy.cpp.

References _syncSlave, and SyncableObject::stopSynchronize().

Referenced by SyncableObject::~SyncableObject().

SignalProxy::ExtendedMetaObject * extendedMetaObject ( const QMetaObject *  meta) const

Definition at line 384 of file signalproxy.cpp.

References _extendedMetaObjects.

Referenced by handle(), invokeSlot(), setInitData(), and sync_call__().

SignalProxy::ExtendedMetaObject * createExtendedMetaObject ( const QMetaObject *  meta,
bool  checkConflicts = false 
)

Definition at line 393 of file signalproxy.cpp.

References _extendedMetaObjects.

Referenced by attachSignal(), attachSlot(), and synchronize().

ExtendedMetaObject* extendedMetaObject ( const QObject *  obj) const
inline

Definition at line 74 of file signalproxy.h.

References extendedMetaObject(), and metaObject().

Referenced by extendedMetaObject().

ExtendedMetaObject* createExtendedMetaObject ( const QObject *  obj,
bool  checkConflicts = false 
)
inline

Definition at line 75 of file signalproxy.h.

References createExtendedMetaObject(), and metaObject().

Referenced by createExtendedMetaObject().

bool isSecure ( ) const
inline

Definition at line 77 of file signalproxy.h.

References _secure.

void dumpProxyStats ( )

Definition at line 780 of file signalproxy.cpp.

References _attachedSlots, _extendedMetaObjects, _syncSlave, proxyMode(), and Server.

void dumpSyncMap ( SyncableObject object)
int peerCount ( ) const
inline

Definition at line 80 of file signalproxy.h.

References _peers.

Referenced by CoreCoreInfo::coreData().

void detachObject ( QObject *  obj)
slot

Definition at line 464 of file signalproxy.cpp.

References detachSignals(), and detachSlots().

Referenced by attachSignal(), and attachSlot().

void detachSignals ( QObject *  sender)
slot

Definition at line 471 of file signalproxy.cpp.

References _signalRelay, and SignalProxy::SignalRelay::detachSignal().

Referenced by detachObject().

void detachSlots ( QObject *  receiver)
slot

Definition at line 477 of file signalproxy.cpp.

References _attachedSlots.

Referenced by detachObject().

void customEvent ( QEvent *  event)
protected

Definition at line 723 of file signalproxy.cpp.

References RemovePeerEvent::peer, and removePeer().

void renameObject ( const SyncableObject obj,
const QString &  newname,
const QString &  oldname 
)
protected
void removePeerBySender ( )
privateslot

Definition at line 347 of file signalproxy.cpp.

References removePeer().

Referenced by addPeer().

void objectRenamed ( const QByteArray &  classname,
const QString &  newname,
const QString &  oldname 
)
privateslot

Definition at line 366 of file signalproxy.cpp.

References _syncSlave, and requestInit().

Referenced by initClient(), and renameObject().

void updateSecureState ( )
privateslot

Definition at line 800 of file signalproxy.cpp.

References _peers, _secure, Peer::isSecure(), and secureStateChanged().

Referenced by addPeer(), init(), and removePeer().

void peerRemoved ( Peer peer)
signal

Referenced by removePeer().

void connected ( )
signal

Referenced by addPeer().

void disconnected ( )
signal

Referenced by addPeer(), and removePeer().

void objectInitialized ( SyncableObject )
signal

Referenced by setInitData(), and synchronize().

void heartBeatIntervalChanged ( int  secs)
signal

Referenced by setHeartBeatInterval().

void maxHeartBeatCountChanged ( int  max)
signal

Referenced by setMaxHeartBeatCount().

void lagUpdated ( int  lag)
signal

Referenced by addPeer().

void secureStateChanged ( bool  )
signal

Referenced by addPeer(), and updateSecureState().

void initServer ( )
private

Definition at line 235 of file signalproxy.cpp.

Referenced by setProxyMode().

void initClient ( )
private

Definition at line 240 of file signalproxy.cpp.

References attachSlot(), and objectRenamed().

Referenced by setProxyMode().

const QMetaObject * metaObject ( const QObject *  obj)
staticprivate

Definition at line 375 of file signalproxy.cpp.

Referenced by createExtendedMetaObject(), and extendedMetaObject().

void removePeer ( Peer peer)
private
void removeAllPeers ( )
private

Definition at line 303 of file signalproxy.cpp.

References _peers, proxyMode(), removePeer(), and Server.

Referenced by ~SignalProxy().

void dispatch ( const T &  protoMessage)
private

Definition at line 507 of file signalproxy.cpp.

References _peers, Peer::dispatch(), and Peer::isOpen().

Referenced by renameObject(), requestInit(), and sync_call__().

void dispatch ( Peer peer,
const T &  protoMessage 
)
private

Definition at line 519 of file signalproxy.cpp.

References Peer::dispatch(), and Peer::isOpen().

void handle ( Peer peer,
const Protocol::RpcCall rpcCall 
)
private
void handle ( Peer peer,
const Protocol::InitRequest initRequest 
)
private
void handle ( Peer peer,
const Protocol::InitData initData 
)
private
void handle ( Peer ,
 
)
inlineprivate

Definition at line 131 of file signalproxy.h.

bool invokeSlot ( QObject *  receiver,
int  methodId,
const QVariantList &  params,
QVariant &  returnValue,
Peer peer = 0 
)
private
bool invokeSlot ( QObject *  receiver,
int  methodId,
const QVariantList &  params = QVariantList(),
Peer peer = 0 
)
private

Definition at line 690 of file signalproxy.cpp.

References invokeSlot().

void requestInit ( SyncableObject obj)
private
QVariantMap initData ( SyncableObject obj) const
private

Definition at line 706 of file signalproxy.cpp.

References SyncableObject::toVariantMap().

Referenced by handle().

void setInitData ( SyncableObject obj,
const QVariantMap &  properties 
)
private
void disconnectDevice ( QIODevice *  dev,
const QString &  reason = QString() 
)
staticprivate

Definition at line 769 of file signalproxy.cpp.

Friends And Related Function Documentation

friend class SignalRelay
friend

Definition at line 165 of file signalproxy.h.

Referenced by init().

friend class SyncableObject
friend

Definition at line 166 of file signalproxy.h.

friend class Peer
friend

Definition at line 167 of file signalproxy.h.

Member Data Documentation

QSet<Peer *> _peers
private
QHash<const QMetaObject *, ExtendedMetaObject *> _extendedMetaObjects
private

Definition at line 145 of file signalproxy.h.

Referenced by createExtendedMetaObject(), dumpProxyStats(), and extendedMetaObject().

SignalRelay* _signalRelay
private

Definition at line 148 of file signalproxy.h.

Referenced by attachSignal(), detachSignals(), and init().

SlotHash _attachedSlots
private

Definition at line 153 of file signalproxy.h.

Referenced by attachSlot(), detachSlots(), dumpProxyStats(), and handle().

QHash<QByteArray, ObjectId> _syncSlave
private
ProxyMode _proxyMode
private

Definition at line 159 of file signalproxy.h.

Referenced by proxyMode(), setProxyMode(), and sync_call__().

int _heartBeatInterval
private

Definition at line 160 of file signalproxy.h.

Referenced by heartBeatInterval(), init(), and setHeartBeatInterval().

int _maxHeartBeatCount
private

Definition at line 161 of file signalproxy.h.

Referenced by init(), maxHeartBeatCount(), and setMaxHeartBeatCount().

bool _secure
private

Definition at line 163 of file signalproxy.h.

Referenced by init(), isSecure(), and updateSecureState().


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