#include <QString>
#include <QByteArray>
+#include <QMutex>
+
class SignalRelay;
class QMetaObject;
bool attachSlot(const QByteArray& sigName, QObject *recv, const char *slot);
void synchronize(QObject *obj);
- void synchronizeAsMaster(QObject *obj);
- void synchronizeAsSlave(QObject *obj);
void setInitialized(QObject *obj);
bool initialized(QObject *obj);
void requestInit(QObject *obj);
-
+
void detachObject(QObject *obj);
void detachSignals(QObject *sender);
void detachSlots(QObject *receiver);
-
+ void stopSync(QObject *obj);
+
+ //! Writes a QVariant to a device.
+ /** The data item is prefixed with the resulting blocksize,
+ * so the corresponding function readDataFromDevice() can check if enough data is available
+ * at the device to reread the item.
+ */
static void writeDataToDevice(QIODevice *dev, const QVariant &item);
+
+ //! Reads a data item from a device that has been written by writeDataToDevice().
+ /** If not enough data bytes are available, the function returns false and the QVariant reference
+ * remains untouched.
+ */
static bool readDataFromDevice(QIODevice *dev, quint32 &blockSize, QVariant &item);
static QString methodBaseName(const QMetaMethod &method);
const QList<int> &argTypes(QObject *obj, int methodId);
+ bool hasUpdateSignal(QObject *obj);
const QByteArray &methodName(QObject *obj, int methodId);
- const QHash<int, int> &syncMap(QObject *obj);
+ const QHash<QByteArray, int> &syncMap(QObject *obj);
typedef QHash<int, QList<int> > ArgHash;
typedef QHash<int, QByteArray> MethodNameHash;
struct ClassInfo {
ArgHash argTypes;
MethodNameHash methodNames;
- QHash<int, int> syncMap;
+ QHash<QByteArray, int> syncMap;
+ bool hasUpdateSignal;
};
void dumpProxyStats();
void _detachSignals(QObject *sender);
void _detachSlots(QObject *receiver);
+ void _stopSync(QObject *obj);
- void dumpSyncMap(QObject *object);
+ void dumpSyncMap(QObject *object);
+ // Hash of used QIODevices
+ QHash<QIODevice*, quint32> _peerByteCount;
+
// containg a list of argtypes for fast access
QHash<const QMetaObject *, ClassInfo*> _classInfo;
typedef QHash<QString, QObject *> ObjectId;
QHash<QByteArray, ObjectId> _syncSlave;
- // Hash of used QIODevices
- QHash<QIODevice*, quint32> _peerByteCount;
ProxyMode _proxyMode;
+ // the slaveMutex protects both containers:
+ // - _syncSlaves for sync and init calls
+ // - _attachedSlots
+ QMutex slaveMutex;
+
friend class SignalRelay;
};