Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# DistributedNetworkObjectHeader.h File Reference

Provide Macro for the Distributed Object System. More...

`#include "DistributedNetworkObjectStub.h"`
`#include "DistributedNetworkObject.h"`
`#include "BitStream.h"`
`#include "GetTime.h"`
`#include <memory.h>`
`#include <assert.h>`

## Defines
#define | REGISTER_DISTRIBUTED_CLASS(className) DistributedNetworkObjectStub<className> distributedNetworkObjectStub_##className(#className);
#define | DOM_COPY_UNCOMPRESSED
#define | DOM_COPY_COMPRESSED
#define | DOM_INTERPOLATE_UNCOMPRESSED
#define | DOM_INTERPOLATE_COMPRESSED
#define | DOM_SERVER_AUTHORITATIVE (isServerAuthoritative==true)
#define | DOM_CLIENT_AUTHORITATIVE (isServerAuthoritative==false)
#define | REGISTER_1_DISTRIBUTED_OBJECT_MEMBERS(BaseClass, SynchronizationMethod1, AuthoritativeNetwork1, VariableType1, VariableName1)
#define | DOM_COPY_UNCOMPRESSED_INTERPOLATION_CODE(AuthoritativeNetwork, VariableName)
#define | DOM_COPY_COMPRESSED_INTERPOLATION_CODE(AuthoritativeNetwork, VariableName)
#define | DOM_INTERPOLATE_UNCOMPRESSED_INTERPOLATION_CODE(AuthoritativeNetwork, VariableName) DOM_INTERPOLATION_CODE(AuthoritativeNetwork,VariableName)
#define | DOM_INTERPOLATE_COMPRESSED_INTERPOLATION_CODE(AuthoritativeNetwork, VariableName) DOM_INTERPOLATION_CODE(AuthoritativeNetwork,VariableName)
#define | DOM_INTERPOLATION_CODE(AuthoritativeNetwork, VariableName)
#define | DOM_COPY_UNCOMPRESSED_INTERPOLATION_MEMBERS(VariableType, VariableName)
#define | DOM_COPY_COMPRESSED_INTERPOLATION_MEMBERS(VariableType, VariableName)
#define | DOM_INTERPOLATE_UNCOMPRESSED_INTERPOLATION_MEMBERS(VariableType, VariableName) unsigned long VariableName##_InterpolationStartTime,VariableName##_InterpolationEndTime; VariableType VariableName##_InitialValue, VariableName##_FinalValue, VariableName##_LastKnownValue;
#define | DOM_INTERPOLATE_COMPRESSED_INTERPOLATION_MEMBERS(VariableType, VariableName) unsigned long VariableName##_InterpolationStartTime,VariableName##_InterpolationEndTime; VariableType VariableName##_InitialValue, VariableName##_FinalValue, VariableName##_LastKnownValue;
#define | DOM_COPY_UNCOMPRESSED_INTERPOLATION_MEMORY_INIT(VariableName)
#define | DOM_COPY_COMPRESSED_INTERPOLATION_MEMORY_INIT(VariableName)
#define | DOM_INTERPOLATE_UNCOMPRESSED_INTERPOLATION_MEMORY_INIT(VariableName) memcpy((char*)&VariableName##_LastReadValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_LastKnownValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_FinalValue,(char*)&VariableName, sizeof(VariableName));
#define | DOM_INTERPOLATE_COMPRESSED_INTERPOLATION_MEMORY_INIT(VariableName) memcpy((char*)&VariableName##_LastReadValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_LastKnownValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_FinalValue,(char*)&VariableName, sizeof(VariableName));
#define | DOM_COPY_UNCOMPRESSED_EXPANDED(AuthoritativeNetwork, VariableType, VariableName)
#define | DOM_COPY_COMPRESSED_EXPANDED(AuthoritativeNetwork, VariableType, VariableName)
#define | DOM_INTERPOLATE_UNCOMPRESSED_EXPANDED(AuthoritativeNetwork, VariableType, VariableName)
#define | DOM_INTERPOLATE_COMPRESSED_EXPANDED(AuthoritativeNetwork, VariableType, VariableName)
#define | DOM_COPY_EXPANDED2(AuthoritativeNetwork, VariableType, VariableName, ReadCode, ReadDummyCode, WriteCode)
#define | DOM_INTERPOLATE_EXPANDED2(AuthoritativeNetwork, VariableType, VariableName, ReadCode, ReadDummyCode, WriteCode)
#define | DOM_CORE_EXPANDED(AuthoritativeNetwork, VariableType, VariableName, ReadCode, ReadDummyCode, WriteCode, InterpolationWriteCondition)
#define | REGISTER_2_DISTRIBUTED_OBJECT_MEMBERS(BaseClass, SynchronizationMethod1, AuthoritativeNetwork1, VariableType1, VariableName1, SynchronizationMethod2, AuthoritativeNetwork2, VariableType2, VariableName2)
#define | REGISTER_3_DISTRIBUTED_OBJECT_MEMBERS(BaseClass, SynchronizationMethod1, AuthoritativeNetwork1, VariableType1, VariableName1, SynchronizationMethod2, AuthoritativeNetwork2, VariableType2, VariableName2, SynchronizationMethod3, AuthoritativeNetwork3, VariableType3, VariableName3)
#define | REGISTER_4_DISTRIBUTED_OBJECT_MEMBERS(BaseClass, SynchronizationMethod1, AuthoritativeNetwork1, VariableType1, VariableName1, SynchronizationMethod2, AuthoritativeNetwork2, VariableType2, VariableName2, SynchronizationMethod3, AuthoritativeNetwork3, VariableType3, VariableName3, SynchronizationMethod4, AuthoritativeNetwork4, VariableType4, VariableName4)
#define | REGISTER_5_DISTRIBUTED_OBJECT_MEMBERS(BaseClass, SynchronizationMethod1, AuthoritativeNetwork1, VariableType1, VariableName1, SynchronizationMethod2, AuthoritativeNetwork2, VariableType2, VariableName2, SynchronizationMethod3, AuthoritativeNetwork3, VariableType3, VariableName3, SynchronizationMethod4, AuthoritativeNetwork4, VariableType4, VariableName4, SynchronizationMethod5, AuthoritativeNetwork5, VariableType5, VariableName5)
#define | REGISTER_6_DISTRIBUTED_OBJECT_MEMBERS(BaseClass, SynchronizationMethod1, AuthoritativeNetwork1, VariableType1, VariableName1, SynchronizationMethod2, AuthoritativeNetwork2, VariableType2, VariableName2, SynchronizationMethod3, AuthoritativeNetwork3, VariableType3, VariableName3, SynchronizationMethod4, AuthoritativeNetwork4, VariableType4, VariableName4, SynchronizationMethod5, AuthoritativeNetwork5, VariableType5, VariableName5, SynchronizationMethod6, AuthoritativeNetwork6, VariableType6, VariableName6)

## Detailed Description

Provide Macro for the Distributed Object System.

This file is part of RakNet Copyright 2003, 2004 Rakkarsoft LLC and Kevin Jenkins.

Usage of Raknet is subject to the appropriate licence agreement. "Shareware" Licensees with Rakkarsoft LLC are subject to the shareware license found at http://www.rakkarsoft.com/shareWareLicense.html which you agreed to upon purchase of a "Shareware license" "Commercial" Licensees with Rakkarsoft LLC are subject to the commercial license found at http://www.rakkarsoft.com/sourceCodeLicense.html which you agreed to upon purchase of a "Commercial license" All other users are subject to the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Refer to the appropriate license agreement for distribution, modification, and warranty rights.

## Define Documentation

#define DOM_CLIENT_AUTHORITATIVE (isServerAuthoritative==false)

#define DOM_COPY_COMPRESSED

#define DOM_COPY_COMPRESSED_EXPANDED | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName |  | ) |

| Value:
    DOM_COPY_EXPANDED2(AuthoritativeNetwork,VariableType,VariableName, readSuccess=bitStream->ReadCompressed(VariableName##_LastReadValue);,\
                               readSuccess=bitStream->ReadCompressed(dummy);,\
                               bitStream->WriteCompressed(VariableName);)

#define DOM_COPY_COMPRESSED_INTERPOLATION_CODE | ( | AuthoritativeNetwork,
|  | VariableName |  | ) |

#define DOM_COPY_COMPRESSED_INTERPOLATION_MEMBERS | ( | VariableType,
|  | VariableName |  | ) |

#define DOM_COPY_COMPRESSED_INTERPOLATION_MEMORY_INIT | ( | VariableName |  | ) |

#define DOM_COPY_EXPANDED2 | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName,
|  | ReadCode,
|  | ReadDummyCode,
|  | WriteCode |  | ) |

| Value:
    DOM_CORE_EXPANDED(AuthoritativeNetwork,VariableType,VariableName, ReadCode, ReadDummyCode, WriteCode, true) \
            if (isWrite==false && dataChanged==true) \
                    VariableName=VariableName##_LastReadValue;

#define DOM_COPY_UNCOMPRESSED_EXPANDED | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName |  | ) |

| Value:
    DOM_COPY_EXPANDED2(AuthoritativeNetwork,VariableType,VariableName, readSuccess=bitStream->Read((char*)&VariableName##_LastReadValue, sizeof(VariableName));,\
                               readSuccess=bitStream->Read((char*)&dummy, sizeof(VariableName));,\
                               bitStream->Write((char*)&VariableName, sizeof(VariableName));)

#define DOM_COPY_UNCOMPRESSED_INTERPOLATION_CODE | ( | AuthoritativeNetwork,
|  | VariableName |  | ) |

#define DOM_COPY_UNCOMPRESSED_INTERPOLATION_MEMBERS | ( | VariableType,
|  | VariableName |  | ) |

#define DOM_COPY_UNCOMPRESSED_INTERPOLATION_MEMORY_INIT | ( | VariableName |  | ) |

#define DOM_CORE_EXPANDED | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName,
|  | ReadCode,
|  | ReadDummyCode,
|  | WriteCode,
|  | InterpolationWriteCondition |  | ) |

#define DOM_INTERPOLATE_COMPRESSED

#define DOM_INTERPOLATE_COMPRESSED_EXPANDED | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName |  | ) |

| Value:
    DOM_INTERPOLATE_EXPANDED2(AuthoritativeNetwork,VariableType,VariableName, readSuccess=bitStream->ReadCompressed(VariableName##_LastReadValue);,\
                                      readSuccess=bitStream->ReadCompressed(dummy);,\
                                      if (VariableName##_LastKnownValue!=VariableName##_LastReadValue && VariableName##_LastKnownValue==VariableName) bitStream->WriteCompressed(VariableName##_FinalValue);\
                                      else bitStream->WriteCompressed(VariableName);)

#define DOM_INTERPOLATE_COMPRESSED_INTERPOLATION_CODE | ( | AuthoritativeNetwork,
|  | VariableName |  | ) | DOM_INTERPOLATION_CODE(AuthoritativeNetwork,VariableName)

#define DOM_INTERPOLATE_COMPRESSED_INTERPOLATION_MEMBERS | ( | VariableType,
|  | VariableName |  | ) | unsigned long VariableName##_InterpolationStartTime,VariableName##_InterpolationEndTime; VariableType VariableName##_InitialValue, VariableName##_FinalValue, VariableName##_LastKnownValue;

#define DOM_INTERPOLATE_COMPRESSED_INTERPOLATION_MEMORY_INIT | ( | VariableName |  | ) | memcpy((char*)&VariableName##_LastReadValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_LastKnownValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_FinalValue,(char*)&VariableName, sizeof(VariableName));

#define DOM_INTERPOLATE_EXPANDED2 | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName,
|  | ReadCode,
|  | ReadDummyCode,
|  | WriteCode |  | ) |

| Value:
    DOM_CORE_EXPANDED(AuthoritativeNetwork,VariableType,VariableName, ReadCode, ReadDummyCode, WriteCode, VariableName!=VariableName##_LastKnownValue) \
            if (isWrite==false && dataChanged==true) \
            { \
                    VariableName##_InterpolationStartTime=RakNet::GetTime(); \
                    VariableName##_InterpolationEndTime=VariableName##_InterpolationStartTime+maximumUpdateFrequency; \
                    VariableName##_InitialValue=VariableName; \
                    VariableName##_FinalValue=VariableName##_LastReadValue; \
                    VariableName##_LastKnownValue=VariableName; \
            }

#define DOM_INTERPOLATE_UNCOMPRESSED

#define DOM_INTERPOLATE_UNCOMPRESSED_EXPANDED | ( | AuthoritativeNetwork,
|  | VariableType,
|  | VariableName |  | ) |

| Value:
    DOM_INTERPOLATE_EXPANDED2(AuthoritativeNetwork,VariableType,VariableName, readSuccess=bitStream->Read((char*)&VariableName##_LastReadValue, sizeof(VariableName));,\
                                      readSuccess=bitStream->Read((char*)&dummy, sizeof(VariableName));,\
                                      if (VariableName##_LastKnownValue!=VariableName##_LastReadValue && VariableName##_LastKnownValue==VariableName) bitStream->Write((char*)&VariableName##_FinalValue, sizeof(VariableName));\
                                      else bitStream->Write((char*)&VariableName, sizeof(VariableName));)

#define DOM_INTERPOLATE_UNCOMPRESSED_INTERPOLATION_CODE | ( | AuthoritativeNetwork,
|  | VariableName |  | ) | DOM_INTERPOLATION_CODE(AuthoritativeNetwork,VariableName)

#define DOM_INTERPOLATE_UNCOMPRESSED_INTERPOLATION_MEMBERS | ( | VariableType,
|  | VariableName |  | ) | unsigned long VariableName##_InterpolationStartTime,VariableName##_InterpolationEndTime; VariableType VariableName##_InitialValue, VariableName##_FinalValue, VariableName##_LastKnownValue;

#define DOM_INTERPOLATE_UNCOMPRESSED_INTERPOLATION_MEMORY_INIT | ( | VariableName |  | ) | memcpy((char*)&VariableName##_LastReadValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_LastKnownValue,(char*)&VariableName, sizeof(VariableName)); memcpy((char*)&VariableName##_FinalValue,(char*)&VariableName, sizeof(VariableName));

#define DOM_SERVER_AUTHORITATIVE (isServerAuthoritative==true)

#define REGISTER_2_DISTRIBUTED_OBJECT_MEMBERS | ( | BaseClass,
|  | SynchronizationMethod1,
|  | AuthoritativeNetwork1,
|  | VariableType1,
|  | VariableName1,
|  | SynchronizationMethod2,
|  | AuthoritativeNetwork2,
|  | VariableType2,
|  | VariableName2 |  | ) |

#define REGISTER_3_DISTRIBUTED_OBJECT_MEMBERS | ( | BaseClass,
|  | SynchronizationMethod1,
|  | AuthoritativeNetwork1,
|  | VariableType1,
|  | VariableName1,
|  | SynchronizationMethod2,
|  | AuthoritativeNetwork2,
|  | VariableType2,
|  | VariableName2,
|  | SynchronizationMethod3,
|  | AuthoritativeNetwork3,
|  | VariableType3,
|  | VariableName3 |  | ) |

#define REGISTER_4_DISTRIBUTED_OBJECT_MEMBERS | ( | BaseClass,
|  | SynchronizationMethod1,
|  | AuthoritativeNetwork1,
|  | VariableType1,
|  | VariableName1,
|  | SynchronizationMethod2,
|  | AuthoritativeNetwork2,
|  | VariableType2,
|  | VariableName2,
|  | SynchronizationMethod3,
|  | AuthoritativeNetwork3,
|  | VariableType3,
|  | VariableName3,
|  | SynchronizationMethod4,
|  | AuthoritativeNetwork4,
|  | VariableType4,
|  | VariableName4 |  | ) |

#define REGISTER_5_DISTRIBUTED_OBJECT_MEMBERS | ( | BaseClass,
|  | SynchronizationMethod1,
|  | AuthoritativeNetwork1,
|  | VariableType1,
|  | VariableName1,
|  | SynchronizationMethod2,
|  | AuthoritativeNetwork2,
|  | VariableType2,
|  | VariableName2,
|  | SynchronizationMethod3,
|  | AuthoritativeNetwork3,
|  | VariableType3,
|  | VariableName3,
|  | SynchronizationMethod4,
|  | AuthoritativeNetwork4,
|  | VariableType4,
|  | VariableName4,
|  | SynchronizationMethod5,
|  | AuthoritativeNetwork5,
|  | VariableType5,
|  | VariableName5 |  | ) |

#define REGISTER_6_DISTRIBUTED_OBJECT_MEMBERS | ( | BaseClass,
|  | SynchronizationMethod1,
|  | AuthoritativeNetwork1,
|  | VariableType1,
|  | VariableName1,
|  | SynchronizationMethod2,
|  | AuthoritativeNetwork2,
|  | VariableType2,
|  | VariableName2,
|  | SynchronizationMethod3,
|  | AuthoritativeNetwork3,
|  | VariableType3,
|  | VariableName3,
|  | SynchronizationMethod4,
|  | AuthoritativeNetwork4,
|  | VariableType4,
|  | VariableName4,
|  | SynchronizationMethod5,
|  | AuthoritativeNetwork5,
|  | VariableType5,
|  | VariableName5,
|  | SynchronizationMethod6,
|  | AuthoritativeNetwork6,
|  | VariableType6,
|  | VariableName6 |  | ) |