Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 21, 2006, 1:41:39 PM (19 years ago)
Author:
bensch
Message:

orxonox/proxy: removed the dependency of the netdefs in pnode, which should decrease compile time enormously.

Location:
branches/proxy/src/lib/network/synchronizeable_var
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_bool.cc

    r7954 r9386  
    1616
    1717#include "synchronizeable_bool.h"
     18#include <cassert>
    1819
    1920
     
    4445{
    4546  assert( maxLength >= 1 );
    46  
     47
    4748  buf[0] = ( *vPtrIn ) ? 1 : 0;
    48  
     49
    4950  return 1;
    5051}
     
    5960{
    6061  assert( maxLength >= 1 );
    61  
     62
    6263  bool oldVal = *vPtrOut;
    63  
     64
    6465  *vPtrOut = buf[0] != 0;
    65  
     66
    6667  setHasChanged( oldVal != *vPtrOut );
    67  
     68
    6869  return 1;
    6970}
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_bool.h

    r9347 r9386  
    22 * @file synchronizeable_int.h
    33 * @brief Definition of SynchronizeableInt
    4 */
    5 
    6 #include "synchronizeable_var/synchronizeable_var.h"
     4 */
    75
    86#ifndef _SYNCHRONIZEABLE_BOOL_H
    97#define _SYNCHRONIZEABLE_BOOL_H
     8
     9#include "synchronizeable_var.h"
    1010
    1111class SynchronizeableBool : public SynchronizeableVar {
     
    1414    SynchronizeableBool( bool * ptrIn, bool * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1515    virtual ~SynchronizeableBool();
    16    
     16
    1717    virtual int writeToBuf( byte * buf, int maxLength );
    1818    virtual int readFromBuf( byte * buf, int maxLength );
    19    
     19
    2020    /**
    2121     * check if writeToBuf will return the same size every time
     
    2323     */
    2424    virtual bool hasStaticSize(){ return true; };
    25    
     25
    2626    virtual void debug();
    27    
     27
    2828  private:
    2929    bool * vPtrIn;       //!< pointer to data (read)
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_float.cc

    r7954 r9386  
    1717#include "synchronizeable_float.h"
    1818#include "converter.h"
     19#include <cassert>
    1920
    2021
     
    4647{
    4748  int res = Converter::floatToByteArray( *vPtrIn, buf, maxLength );
    48  
     49
    4950  assert( res == FLOATSIZE );
    50  
     51
    5152  return res;
    5253}
     
    6162{
    6263  assert( maxLength >= FLOATSIZE );
    63  
     64
    6465  float oldVal = *vPtrOut;
    65  
     66
    6667  int res = Converter::byteArrayToFloat( buf, vPtrOut );
    67  
     68
    6869  setHasChanged( oldVal != *vPtrOut );
    69  
     70
    7071  assert( res == FLOATSIZE );
    71  
     72
    7273  return res;
    7374}
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_float.h

    r9347 r9386  
    22 * @file synchronizeable_float.h
    33 * @brief Definition of SynchronizeableFloat
    4 */
     4 */
    55
    6 #include "synchronizeable_var/synchronizeable_var.h"
    76
    87#ifndef _SYNCHRONIZEABLE_FLOAT_H
    98#define _SYNCHRONIZEABLE_FLOAT_H
     9
     10#include "synchronizeable_var.h"
    1011
    1112class SynchronizeableFloat : public SynchronizeableVar {
     
    1415    SynchronizeableFloat( float * ptrIn, float * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1516    virtual ~SynchronizeableFloat();
    16    
     17
    1718    virtual int writeToBuf( byte * buf, int maxLength );
    1819    virtual int readFromBuf( byte * buf, int maxLength );
    19        
     20
    2021    /**
    2122     * check if writeToBuf will return the same size every time
     
    2324     */
    2425    virtual bool hasStaticSize(){ return true; };
    25    
     26
    2627    virtual void debug();
    27    
     28
    2829  private:
    2930    float * vPtrIn;       //!< pointer to data (read)
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_int.cc

    r7954 r9386  
    1818#include "converter.h"
    1919
     20#include <cassert>
    2021
    2122/**
     
    4647{
    4748  int res = Converter::intToByteArray( *vPtrIn, buf, maxLength );
    48  
     49
    4950  assert( res == INTSIZE );
    50  
     51
    5152  return res;
    5253}
     
    6162{
    6263  assert( maxLength >= INTSIZE );
    63  
     64
    6465  int oldVal = *vPtrOut;
    65  
     66
    6667  int res = Converter::byteArrayToInt( buf, vPtrOut );
    67  
     68
    6869  setHasChanged( oldVal != *vPtrOut );
    69  
     70
    7071  assert( res == INTSIZE );
    71  
     72
    7273  return res;
    7374}
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_int.h

    r9347 r9386  
    44*/
    55
    6 #include "synchronizeable_var/synchronizeable_var.h"
    76
    87#ifndef _SYNCHRONIZEABLE_INT_H
    98#define _SYNCHRONIZEABLE_INT_H
     9
     10#include "synchronizeable_var.h"
    1011
    1112class SynchronizeableInt : public SynchronizeableVar {
     
    1415    SynchronizeableInt( int * ptrIn, int * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1516    virtual ~SynchronizeableInt();
    16    
     17
    1718    virtual int writeToBuf( byte * buf, int maxLength );
    1819    virtual int readFromBuf( byte * buf, int maxLength );
    19    
     20
    2021    /**
    2122     * check if writeToBuf will return the same size every time
     
    2324     */
    2425    virtual bool hasStaticSize(){ return true; };
    25    
     26
    2627    virtual void debug();
    27    
     28
    2829  protected:
    2930    int * vPtrIn;       //!< pointer to data (read)
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_ip.cc

    r9377 r9386  
    1616#include "synchronizeable_ip.h"
    1717#include "converter.h"
    18 // #include "ip.h"
     18#include "netdefs.h"
     19#include "ip.h"
     20#include <cassert>
    1921
    2022/**
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_ip.h

    r9347 r9386  
    44*/
    55
    6 #include "synchronizeable_var/synchronizeable_var.h"
    76
    87#ifndef _SYNCHRONIZEABLE_IP_H
    98#define _SYNCHRONIZEABLE_IP_H
    109
    11 #include "vector.h"
     10#include "synchronizeable_var.h"
    1211
    13 #include "netdefs.h"
    14 #include "ip.h"
     12class IP;
    1513
    1614class SynchronizeableIP : public SynchronizeableVar {
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_quaternion.cc

    r7954 r9386  
    1717#include "synchronizeable_quaternion.h"
    1818#include "converter.h"
     19#include <cassert>
    1920
    2021
     
    9899  assert( res > 0 );
    99100  n += res;
    100  
     101
    101102  Quaternion oldVal = *vPtrOut;
    102103
    103104  *vPtrOut = Quaternion( Vector(x, y, z), w );
    104  
     105
    105106  setHasChanged( ! ( oldVal == *vPtrOut ) );
    106107
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_quaternion.h

    r9347 r9386  
    44*/
    55
    6 #include "synchronizeable_var/synchronizeable_var.h"
    7 
    86#ifndef _SYNCHRONIZEABLE_QUATERNION_H
    97#define _SYNCHRONIZEABLE_QUATERNION_H
     8
     9#include "synchronizeable_var.h"
    1010
    1111#include "quaternion.h"
     
    1616    SynchronizeableQuaternion( Quaternion * ptrIn, Quaternion * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1717    virtual ~SynchronizeableQuaternion();
    18    
     18
    1919    virtual int writeToBuf( byte * buf, int maxLength );
    2020    virtual int readFromBuf( byte * buf, int maxLength );
    21        
     21
    2222    /**
    2323     * check if writeToBuf will return the same size every time
     
    2525     */
    2626    virtual bool hasStaticSize(){ return true; };
    27    
     27
    2828    virtual void debug();
    29    
     29
    3030  private:
    3131    Quaternion * vPtrIn;       //!< pointer to data (read)
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_string.cc

    r8147 r9386  
    1717#include "synchronizeable_string.h"
    1818#include "converter.h"
     19#include <cassert>
    1920
    2021
     
    4647{
    4748  int res = Converter::stringToByteArray( *vPtrIn, buf, maxLength );
    48  
     49
    4950  assert( res > 0 );
    5051  assert( res == vPtrIn->length()+INTSIZE );
    51  
     52
    5253  return res;
     54}
     55
     56int SynchronizeableString::getSize()
     57{
     58   return vPtrIn->length()+INTSIZE;
    5359}
    5460
     
    6268{
    6369  std::string oldVal = *vPtrOut;
    64      
     70
    6571  int res = Converter::byteArrayToString( buf, *vPtrOut, maxLength );
    66  
     72
    6773  setHasChanged( oldVal != *vPtrOut );
    68  
     74
    6975  if ( res < 0 )
    7076  {
     
    7278  }
    7379  assert( res > 0 );
    74  
     80
    7581  return res;
    7682}
     
    94100{
    95101  std::string t;
    96  
     102
    97103  int res = Converter::byteArrayToString( buf, t, maxLength );
    98  
     104
    99105  assert( res > 0 );
    100  
     106
    101107  return res;
    102108}
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_string.h

    r9347 r9386  
    44*/
    55
    6 #include "synchronizeable_var/synchronizeable_var.h"
    7 #include "converter.h"
    8 
    96#ifndef _SYNCHRONIZEABLE_STRING_H
    107#define _SYNCHRONIZEABLE_STRING_H
     8
     9#include "synchronizeable_var.h"
    1110
    1211#include <string>
     
    1716    SynchronizeableString( std::string * ptrIn, std::string * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1817    virtual ~SynchronizeableString();
    19    
     18
    2019    virtual int writeToBuf( byte * buf, int maxLength );
    2120    virtual int readFromBuf( byte * buf, int maxLength );
    22    
    23        
     21
     22
    2423    /**
    2524     * check if writeToBuf will return the same size every time
     
    2726     */
    2827    virtual bool hasStaticSize(){ return false; };
    29    
    30     virtual int getSize(){ return vPtrIn->length()+INTSIZE; }
    31    
     28
     29    virtual int getSize();
     30
    3231    virtual int getSizeFromBuf( byte * buf, int maxLength );
    33    
     32
    3433    virtual void debug();
    35    
     34
    3635  private:
    3736    std::string * vPtrIn;       //!< pointer to data (read)
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_uint.h

    r9347 r9386  
    44*/
    55
    6 #include "synchronizeable_var/synchronizeable_int.h"
    76
    87#ifndef _SYNCHRONIZEABLE_UINT_H
    98#define _SYNCHRONIZEABLE_UINT_H
     9
     10#include "synchronizeable_int.h"
    1011
    1112class SynchronizeableUInt : public SynchronizeableInt {
     
    1415    SynchronizeableUInt( unsigned int * ptrIn, unsigned int * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1516    virtual ~SynchronizeableUInt();
    16    
     17
    1718    virtual void debug();
    1819
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_var.cc

    r7954 r9386  
    1616
    1717#include "synchronizeable_var.h"
    18 
     18#include "netdefs.h"
     19#include <cassert>
    1920
    2021
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_var.h

    r9347 r9386  
    77#define _SYNCHRONIZEABLE_VAR_H
    88
     9#include "net_types.h"
    910#include <string>
    10 #include "netdefs.h"
    11 #include <assert.h>
    1211
    1312enum {
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_vector.cc

    r7954 r9386  
    1717#include "synchronizeable_vector.h"
    1818#include "converter.h"
     19#include <cassert>
    1920
    2021
     
    7980  int res;
    8081  int n = 0;
    81  
     82
    8283  Vector oldVec = *vPtrOut;
    8384
     
    9596
    9697  *vPtrOut = Vector( x, y, z );
    97  
     98
    9899  setHasChanged( !(*vPtrOut == oldVec) );
    99100
  • branches/proxy/src/lib/network/synchronizeable_var/synchronizeable_vector.h

    r9347 r9386  
    44*/
    55
    6 #include "synchronizeable_var/synchronizeable_var.h"
    7 
    86#ifndef _SYNCHRONIZEABLE_VECTOR_H
    97#define _SYNCHRONIZEABLE_VECTOR_H
     8
     9#include "synchronizeable_var.h"
    1010
    1111#include "vector.h"
     
    1616    SynchronizeableVector( Vector * ptrIn, Vector * ptrOut, std::string name, int permission = PERMISSION_MASTER_SERVER, int priority = 0 );
    1717    virtual ~SynchronizeableVector();
    18    
     18
    1919    virtual int writeToBuf( byte * buf, int maxLength );
    2020    virtual int readFromBuf( byte * buf, int maxLength );
    21    
     21
    2222    /**
    2323     * check if writeToBuf will return the same size every time
     
    2525     */
    2626    virtual bool hasStaticSize(){ return true; }
    27    
     27
    2828    virtual void debug();
    29    
     29
    3030  private:
    3131    Vector * vPtrIn;       //!< pointer to data (read)
Note: See TracChangeset for help on using the changeset viewer.