Last change
on this file since 556 was
496,
checked in by landauf, 17 years ago
|
added files from objecthierarchy, changed includes
|
File size:
1.4 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 NETWORK_SYNCHRONISABLE_H |
---|
13 | #define NETWORK_SYNCHRONISABLE_H |
---|
14 | |
---|
15 | #include <list> |
---|
16 | #include <iostream> |
---|
17 | |
---|
18 | #include "orxonox/core/CoreIncludes.h" |
---|
19 | #include "orxonox/core/OrxonoxClass.h" |
---|
20 | |
---|
21 | namespace network { |
---|
22 | |
---|
23 | |
---|
24 | struct syncData{ |
---|
25 | int length; |
---|
26 | int objectID; |
---|
27 | int classID; |
---|
28 | unsigned char *data; |
---|
29 | }; |
---|
30 | |
---|
31 | typedef struct synchronisableVariable{ |
---|
32 | int size; |
---|
33 | const void *var; |
---|
34 | }SYNCVAR; |
---|
35 | |
---|
36 | |
---|
37 | /** |
---|
38 | * This class is the base class of all the Objects in the universe that need to be synchronised over the network |
---|
39 | * 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. |
---|
40 | * @author Oliver Scheuss |
---|
41 | */ |
---|
42 | class Synchronisable : public orxonox::OrxonoxClass{ |
---|
43 | public: |
---|
44 | Synchronisable(); |
---|
45 | |
---|
46 | virtual ~Synchronisable(); |
---|
47 | int objectID; |
---|
48 | int classID; |
---|
49 | |
---|
50 | void registerVar(const void *var, int size); |
---|
51 | syncData getData(); |
---|
52 | syncData getData(unsigned char *mem); |
---|
53 | int getSize(); |
---|
54 | bool updateData(syncData vars); |
---|
55 | virtual void registerAllVariables() = 0; |
---|
56 | |
---|
57 | private: |
---|
58 | /* bool removeObject(Iterator<Synchronisable> it);*/ |
---|
59 | |
---|
60 | std::list<SYNCVAR> syncList; |
---|
61 | int datasize; |
---|
62 | }; |
---|
63 | |
---|
64 | } |
---|
65 | |
---|
66 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.