source:
orxonox.OLD/trunk/src/lib/network/synchronizeable.h
@
6053
| Last change on this file since 6053 was 5997, checked in by patrick, 20 years ago | |
|---|---|
| File size: 1.1 KB | |
| Rev | Line | |
|---|---|---|
| [5523] | 1 | /*! |
| 2 | * @file connection_monitor.h | |
| [5550] | 3 | \brief interface for all classes that have to be synchronized |
| [5547] | 4 | */ |
| [5523] | 5 | |
| [5547] | 6 | #ifndef _SYNCHRONIZEABLE_H |
| 7 | #define _SYNCHRONIZEABLE_H | |
| [5523] | 8 | |
| [5997] | 9 | #include "base_object.h" |
| [5547] | 10 | #include "netdefs.h" |
| 11 | ||
| [5997] | 12 | |
| 13 | ||
| 14 | #include <vector> | |
| 15 | #include <list> | |
| 16 | ||
| 17 | //State constants: They have to be of the form 2^n | |
| 18 | #define STATE_SERVER 1 | |
| 19 | #define STATE_OUTOFSYNC 2 | |
| 20 | ||
| 21 | ||
| [5581] | 22 | class Synchronizeable : virtual public BaseObject |
| [5804] | 23 | { |
| 24 | public: | |
| [5523] | 25 | |
| [5804] | 26 | Synchronizeable(const char* name); |
| [5996] | 27 | Synchronizeable(); |
| [5804] | 28 | ~Synchronizeable(); |
| [5523] | 29 | |
| [5806] | 30 | virtual void writeBytes(const byte* data, int length); |
| [5996] | 31 | virtual int readBytes(byte* data); |
| [5806] | 32 | virtual void writeDebug() const; |
| 33 | virtual void readDebug() const; | |
| [5997] | 34 | |
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | void setIsServer(bool isServer); | |
| 40 | void setIsOutOfSync(bool outOfSync); | |
| 41 | bool isServer(); | |
| 42 | bool isOutOfSync(); | |
| [5547] | 43 | |
| [5804] | 44 | private: |
| [5523] | 45 | |
| [5804] | 46 | int uniqueID; |
| [5997] | 47 | |
| 48 | ||
| 49 | ||
| 50 | //static std::vector<Synchronizeable*> classList; | |
| 51 | int owner; | |
| 52 | int hostID; | |
| 53 | int state; | |
| 54 | std::list<int> synchronizeRequests; | |
| [5547] | 55 | |
| [5804] | 56 | }; |
| [5548] | 57 | #endif /* _SYNCHRONIZEABLE_H */ |
Note: See TracBrowser
for help on using the repository browser.










