Last change
on this file since 374 was
346,
checked in by rgrieder, 17 years ago
|
- adjusted the entire source to compile under windows visual studio too:
- added some ugly conversions
- changed some illegal code pieces (gcc however accepted it)
- added a few files from reto's framework to evade linker errors (no more dynamic linking)
- inserted some 'return true' to justify the return type
- excluded the levelLoader in the orxonox.cc (couldn't make it work, parsing error)
- wrote about 5 code #branches to compensate for missing usleep() under windows
|
File size:
1.3 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/IdentifierIncludes.h" |
---|
19 | |
---|
20 | namespace network { |
---|
21 | |
---|
22 | |
---|
23 | struct syncData{ |
---|
24 | int length; |
---|
25 | int objectID; |
---|
26 | int classID; |
---|
27 | unsigned char *data; |
---|
28 | }; |
---|
29 | |
---|
30 | typedef struct synchronisableVariable{ |
---|
31 | int size; |
---|
32 | const void *var; |
---|
33 | }SYNCVAR; |
---|
34 | |
---|
35 | |
---|
36 | /** |
---|
37 | * This class is the base class of all the Objects in the universe that need to be synchronised over the network |
---|
38 | * 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. |
---|
39 | * @author Oliver Scheuss |
---|
40 | */ |
---|
41 | class Synchronisable{ |
---|
42 | public: |
---|
43 | Synchronisable(); |
---|
44 | |
---|
45 | virtual ~Synchronisable(); |
---|
46 | int objectID; |
---|
47 | int classID; |
---|
48 | |
---|
49 | void registerVar(const void *var, int size); |
---|
50 | syncData getData(); |
---|
51 | syncData getData(unsigned char *mem); |
---|
52 | int getSize(); |
---|
53 | bool updateData(syncData vars); |
---|
54 | virtual void registerAllVariables() = 0; |
---|
55 | |
---|
56 | private: |
---|
57 | /* bool removeObject(Iterator<Synchronisable> it);*/ |
---|
58 | |
---|
59 | std::list<SYNCVAR> syncList; |
---|
60 | int datasize; |
---|
61 | }; |
---|
62 | |
---|
63 | } |
---|
64 | |
---|
65 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.