Stellarium  0.90.0
List of all members | Public Member Functions | Static Protected Member Functions | Friends
SyncProtocol::SyncMessage Class Referenceabstract

Base interface for the messages themselves, allowing to serialize/deserialize them. More...

#include <SyncProtocol.hpp>

+ Inheritance diagram for SyncProtocol::SyncMessage:

Public Member Functions

virtual SyncProtocol::SyncMessageType getMessageType () const =0
 Subclasses must return the message type this message represents. More...
 
qint64 createFullMessage (QByteArray &target) const
 Writes a full message (with header) to the specified byte array. More...
 
virtual void serialize (QDataStream &stream) const
 Subclasses should override this to serialize their contents to the data stream. More...
 
virtual bool deserialize (QDataStream &stream, SyncProtocol::tPayloadSize dataSize)
 Subclasses should override this to load their contents from the data stream. More...
 
virtual QDebug debugOutput (QDebug dbg) const
 Subclasses can override this to provide proper debug output. More...
 

Static Protected Member Functions

static void writeString (QDataStream &stream, const QString &str)
 
static QString readString (QDataStream &stream)
 

Friends

QDebug operator<< (QDebug dbg, const SyncMessage &msg)
 

Detailed Description

Base interface for the messages themselves, allowing to serialize/deserialize them.

Definition at line 124 of file SyncProtocol.hpp.

Member Function Documentation

qint64 SyncProtocol::SyncMessage::createFullMessage ( QByteArray &  target) const

Writes a full message (with header) to the specified byte array.

Returns the total message size. If zero, the payload is too large for a SyncMessage.

virtual QDebug SyncProtocol::SyncMessage::debugOutput ( QDebug  dbg) const
inlinevirtual

Subclasses can override this to provide proper debug output.

The default just prints the message type.

Reimplemented in SyncProtocol::StelPropertyUpdate, and SyncProtocol::Selection.

Definition at line 145 of file SyncProtocol.hpp.

virtual bool SyncProtocol::SyncMessage::deserialize ( QDataStream &  stream,
SyncProtocol::tPayloadSize  dataSize 
)
virtual

Subclasses should override this to load their contents from the data stream.

The default implementation expects a zero dataSize, and reads nothing.

Reimplemented in SyncProtocol::Fov, SyncProtocol::View, SyncProtocol::StelPropertyUpdate, SyncProtocol::Selection, SyncProtocol::Location, SyncProtocol::Time, SyncProtocol::ClientChallengeResponse, SyncProtocol::ServerChallenge, and SyncProtocol::ErrorMessage.

virtual SyncProtocol::SyncMessageType SyncProtocol::SyncMessage::getMessageType ( ) const
pure virtual
virtual void SyncProtocol::SyncMessage::serialize ( QDataStream &  stream) const
virtual

Subclasses should override this to serialize their contents to the data stream.

The default implementation writes nothing.

Reimplemented in SyncProtocol::Fov, SyncProtocol::View, SyncProtocol::StelPropertyUpdate, SyncProtocol::Selection, SyncProtocol::Location, SyncProtocol::Time, SyncProtocol::ClientChallengeResponse, SyncProtocol::ServerChallenge, and SyncProtocol::ErrorMessage.


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