Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 31, 2007, 7:40:23 PM (16 years ago)
Author:
rgrieder
Message:
  • added dll support to the network library
  • improved header file dependency in network
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/network/Synchronisable.h

    r774 r777  
    1414
    1515#include <list>
    16 #include <iostream>
    17 #include <string>
    1816
     17#include "NetworkPrereqs.h"
    1918#include "core/CoreIncludes.h"
    20 #include "core/OrxonoxClass.h"
    2119
    22 namespace network {
     20namespace network
     21{
     22  enum variableType{
     23    DATA,
     24    STRING,
     25  };
    2326
    24 enum variableType{
    25   DATA,
    26   STRING,
    27 };
    28  
    29 struct syncData{
    30   int length;
    31   int objectID;
    32   int classID;
    33   unsigned char *data;
    34 };
     27  struct syncData{
     28    int length;
     29    int objectID;
     30    int classID;
     31    unsigned char *data;
     32  };
    3533
    36 typedef struct synchronisableVariable{
    37   int size;
    38   const void *var;
    39   variableType type;
    40 }SYNCVAR;
     34  typedef struct synchronisableVariable{
     35    int size;
     36    const void *var;
     37    variableType type;
     38  }SYNCVAR;
    4139
    42  
    43 /**
    44  * This class is the base class of all the Objects in the universe that need to be synchronised over the network
    45  * 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.
    46  * @author Oliver Scheuss
    47 */
    48 class Synchronisable : virtual public orxonox::OrxonoxClass{
    49 public:
    5040
    51   virtual ~Synchronisable();
    52   int objectID;
    53   int classID;
    54    
    55   void registerVar(const void *var, int size, variableType t);
    56 //  syncData getData();
    57   syncData getData(unsigned char *mem);
    58   int getSize();
    59   bool updateData(syncData vars);
    60   void registerAllVariables();
    61   virtual bool create()=0;
    62 protected:
    63   Synchronisable();
    64 private:
    65 /*  bool removeObject(Iterator<Synchronisable> it);*/
    66  
    67   std::list<SYNCVAR> syncList;
    68   int datasize;
    69 };
     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  ExportAbstractClass(Synchronisable, Network);
    7069
    7170}
Note: See TracChangeset for help on using the changeset viewer.