File: Message.h

package info (click to toggle)
between 6%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 3,532 kB
  • sloc: cpp: 28,110; php: 718; ansic: 638; objc: 245; sh: 236; makefile: 97; perl: 67
file content (49 lines) | stat: -rw-r--r-- 917 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * Modification History
 *
 * 2001-January-15		Jason Rohrer
 * Created.
 *
 * 2001-February-3		Jason Rohrer
 * Updated serialization code to use new interfaces.  
 */

#include "minorGems/common.h"


#ifndef MESSAGE_CLASS_INCLUDED
#define MESSAGE_CLASS_INCLUDED

#include "minorGems/io/Serializable.h"

/**
 * A simple message that carries a 4 byte opcode.  Useful for sending a 
 * simple service request.
 *
 * @author Jason Rohrer
 */ 
class Message : public Serializable {

	public:
		
		long mOpcode;
		
		// implement the Serializable interface
		virtual int serialize( OutputStream *inOutputStream );
		virtual int deserialize( InputStream *inInputStream );		
	};		



inline int Message::serialize( OutputStream *inOutputStream ) {
	return inOutputStream->writeLong( mOpcode );
	}
	


inline int Message::deserialize( InputStream *inInputStream ) {
	return inInputStream->readLong( &mOpcode );
	}


#endif