Last change
on this file since 1284 was
790,
checked in by nicolasc, 17 years ago
|
merged FICN back into trunk
awaiting release.
|
File size:
1.7 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 | #include "core/CoreIncludes.h" |
---|
19 | |
---|
20 | namespace network |
---|
21 | { |
---|
22 | enum variableType{ |
---|
23 | DATA, |
---|
24 | STRING, |
---|
25 | }; |
---|
26 | |
---|
27 | struct syncData{ |
---|
28 | int length; |
---|
29 | int objectID; |
---|
30 | int classID; |
---|
31 | unsigned char *data; |
---|
32 | }; |
---|
33 | |
---|
34 | typedef struct synchronisableVariable{ |
---|
35 | int size; |
---|
36 | const void *var; |
---|
37 | variableType type; |
---|
38 | }SYNCVAR; |
---|
39 | |
---|
40 | |
---|
41 | /** |
---|
42 | * This class is the base class of all the Objects in the universe that need to be synchronised over the network |
---|
43 | * 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. |
---|
44 | * @author Oliver Scheuss |
---|
45 | */ |
---|
46 | class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{ |
---|
47 | public: |
---|
48 | |
---|
49 | virtual ~Synchronisable(); |
---|
50 | int objectID; |
---|
51 | int classID; |
---|
52 | |
---|
53 | void registerVar(const void *var, int size, variableType t); |
---|
54 | // syncData getData(); |
---|
55 | syncData getData(unsigned char *mem); |
---|
56 | int getSize(); |
---|
57 | bool updateData(syncData vars); |
---|
58 | void registerAllVariables(); |
---|
59 | virtual bool create()=0; |
---|
60 | protected: |
---|
61 | Synchronisable(); |
---|
62 | private: |
---|
63 | /* bool removeObject(Iterator<Synchronisable> it);*/ |
---|
64 | |
---|
65 | std::list<SYNCVAR> syncList; |
---|
66 | int datasize; |
---|
67 | }; |
---|
68 | |
---|
69 | } |
---|
70 | |
---|
71 | namespace orxonox |
---|
72 | { |
---|
73 | template class _NetworkExport ClassIdentifier<network::Synchronisable>; |
---|
74 | template class _NetworkExport ObjectList<network::Synchronisable>; |
---|
75 | } |
---|
76 | |
---|
77 | #endif /* _Synchronisable_H__ */ |
---|
Note: See
TracBrowser
for help on using the repository browser.