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