Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/network/Synchronisable.h @ 1230

Last change on this file since 1230 was 1062, checked in by rgrieder, 17 years ago
  • changed header file inclusion order
File size: 2.5 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Oliver Scheuss, (C) 2007
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29//
30// C++ Interface: synchronisable
31//
32// Description:
33//
34//
35// Author:  Oliver Scheuss, (C) 2007
36//
37// Copyright: See COPYING file that comes with this distribution
38//
39//
40#ifndef _Synchronisable_H__
41#define _Synchronisable_H__
42
43#include "NetworkPrereqs.h"
44
45#include <list>
46#include "core/OrxonoxClass.h"
47
48namespace network
49{
50  enum variableType{
51    DATA,
52    STRING,
53  };
54
55  struct syncData{
56    int length;
57    int objectID;
58    int classID;
59    unsigned char *data;
60  };
61
62  typedef struct synchronisableVariable{
63    int size;
64    const void *var;
65    variableType type;
66  }SYNCVAR;
67
68
69  /**
70  * This class is the base class of all the Objects in the universe that need to be synchronised over the network
71  * 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.
72  * @author Oliver Scheuss
73  */
74  class _NetworkExport Synchronisable : virtual public orxonox::OrxonoxClass{
75  public:
76
77      virtual ~Synchronisable();
78    int objectID;
79    int classID;
80
81    void registerVar(const void *var, int size, variableType t);
82    //  syncData getData();
83    syncData getData(unsigned char *mem);
84    int getSize();
85    bool updateData(syncData vars);
86    virtual void registerAllVariables()=0;
87    virtual bool create()=0;
88  protected:
89    Synchronisable();
90  private:
91    /*  bool removeObject(Iterator<Synchronisable> it);*/
92
93    std::list<SYNCVAR> syncList;
94    int datasize;
95  };
96}
97
98#endif /* _Synchronisable_H__ */
Note: See TracBrowser for help on using the repository browser.