Last change
on this file since 852 was
852,
checked in by landauf, 17 years ago
|
removed some includes of CoreIncludes.h from other .h files (included in .cc only)
|
File size:
1.5 KB
|
Line | |
---|
1 | // |
---|
2 | // C++ Interface: synchronisable |
---|
3 | // |
---|
4 | // Description: |
---|
5 | // |
---|
6 | // |
---|
7 | // Author: Oliver Scheuss, (C) 2007 |
---|
8 | // |
---|
9 | // Copyright: See COPYING file that comes with this distribution |
---|
10 | // |
---|
11 | // |
---|
12 | #ifndef _Synchronisable_H__ |
---|
13 | #define _Synchronisable_H__ |
---|
14 | |
---|
15 | #include <list> |
---|
16 | |
---|
17 | #include "NetworkPrereqs.h" |
---|
18 | |
---|
19 | namespace network |
---|
20 | { |
---|
21 | enum variableType{ |
---|
22 | DATA, |
---|
23 | STRING, |
---|
24 | }; |
---|
25 | |
---|
26 | struct syncData{ |
---|
27 | int length; |
---|
28 | int objectID; |
---|
29 | int classID; |
---|
30 | unsigned char *data; |
---|
31 | }; |
---|
32 | |
---|
33 | typedef struct synchronisableVariable{ |
---|
34 | int size; |
---|
35 | const void *var; |
---|
36 | variableType type; |
---|
37 | }SYNCVAR; |
---|
38 | |
---|
39 | |
---|
40 | /** |
---|
41 | * This class is the base class of all the Objects in the universe that need to be synchronised over the network |
---|
42 | * Every class, that inherits from this class has to link the DATA THAT NEEDS TO BE SYNCHRONISED into the linked list. Additionally it also has to provide a Constructor, that takes exactly the variables in this linked list. |
---|
43 | * @author Oliver Scheuss |
---|
44 | */ |
---|
45 | class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{ |
---|
46 | public: |
---|
47 | |
---|
48 | virtual ~Synchronisable() {} |
---|
49 | int objectID; |
---|
50 | int classID; |
---|
51 | |
---|
52 | void registerVar(const void *var, int size, variableType t); |
---|
53 | // syncData getData(); |
---|
54 | syncData getData(unsigned char *mem); |
---|
55 | int getSize(); |
---|
56 | bool updateData(syncData vars); |
---|
57 | void registerAllVariables(); |
---|
58 | virtual bool create()=0; |
---|
59 | protected: |
---|
60 | Synchronisable(); |
---|
61 | private: |
---|
62 | /* bool removeObject(Iterator<Synchronisable> it);*/ |
---|
63 | |
---|
64 | std::list<SYNCVAR> syncList; |
---|
65 | int datasize; |
---|
66 | }; |
---|
67 | } |
---|
68 | |
---|
69 | #endif /* _Synchronisable_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.