We are providing Premake files so that you can reproduce the build systems.
+
To do this, engage Premake on the command line, as many of the .bat and .sh files will show.
+
Unfortunately, for the produced CodeBlocks files, modifications needed to be made because of bugs that appear in Linux, which are the fault of CodeBlocks or Premake.
+
+
diff --git a/Compile/premake/premake_cb-gcc.bat b/Compile/premake/premake_cb-gcc.bat
new file mode 100644
index 00000000..e0fe2ef0
--- /dev/null
+++ b/Compile/premake/premake_cb-gcc.bat
@@ -0,0 +1,4 @@
+pushd Projects
+premake --file DIS.lua --target cb-gcc
+popd
+pause
\ No newline at end of file
diff --git a/Compile/premake/premake_cb-gcc.sh b/Compile/premake/premake_cb-gcc.sh
new file mode 100755
index 00000000..7e1e5429
--- /dev/null
+++ b/Compile/premake/premake_cb-gcc.sh
@@ -0,0 +1,8 @@
+pushd Projects
+#export DIS_LIB_INSTALL="where you want the build system to send the binary library files to"
+#export DIS_BIN_INSTALL="where you want the build system to send the other binary files to"
+#export HAWKNL_INC_DIR="where the headers for HawkNL exist."
+#export HAWKNL_LIB_DIR="where the library for HawkNL exists."
+premake --file DIS.lua --target cb-gcc
+popd
+
diff --git a/Compile/premake/premake_gnumake_linux.sh b/Compile/premake/premake_gnumake_linux.sh
new file mode 100755
index 00000000..454040d9
--- /dev/null
+++ b/Compile/premake/premake_gnumake_linux.sh
@@ -0,0 +1,9 @@
+pushd Projects
+#export DIS_LIB_INSTALL="where you want the build system to send the binary library files to"
+#export DIS_BIN_INSTALL="where you want the build system to send the other binary files to"
+#export HAWKNL_INC_DIR="where the headers for HawkNL exist."
+#export HAWKNL_LIB_DIR="where the library for HawkNL exists."
+premake --file DIS.lua --target gnu
+premake --file DIS.lua --target vs2003
+premake --file DIS.lua --target vs2005
+popd
diff --git a/Compile/premake/premake_gnumake_osx.sh b/Compile/premake/premake_gnumake_osx.sh
new file mode 100644
index 00000000..1dd5f721
--- /dev/null
+++ b/Compile/premake/premake_gnumake_osx.sh
@@ -0,0 +1,9 @@
+pushd Projects
+#export DIS_LIB_INSTALL="where you want the build system to send the binary library files to"
+#export DIS_BIN_INSTALL="where you want the build system to send the other binary files to"
+#export HAWKNL_INC_DIR="where the headers for HawkNL exist."
+#export HAWKNL_LIB_DIR="where the library for HawkNL exists."
+../premake.osx --file DIS.lua --target gnu
+../premake.osx --file DIS.lua --target vs2003
+../premake.osx --file DIS.lua --target vs2005
+popd
diff --git a/Compile/premake/premake_vs2003.bat b/Compile/premake/premake_vs2003.bat
new file mode 100644
index 00000000..32ab5a3f
--- /dev/null
+++ b/Compile/premake/premake_vs2003.bat
@@ -0,0 +1,8 @@
+pushd Projects
+rem set DIS_LIB_INSTALL="where you want the build system to send the binary library files to"
+rem set DIS_BIN_INSTALL="where you want the build system to send the other binary files to"
+rem set HAWKNL_INC_DIR="where the headers for HawkNL exist."
+rem set HAWKNL_LIB_DIR="where the library for HawkNL exists."
+premake --file DIS.lua --target vs2003
+popd
+pause
\ No newline at end of file
diff --git a/Compile/premake/premake_vs2005.bat b/Compile/premake/premake_vs2005.bat
new file mode 100644
index 00000000..af87f513
--- /dev/null
+++ b/Compile/premake/premake_vs2005.bat
@@ -0,0 +1,8 @@
+pushd Projects
+rem set DIS_LIB_INSTALL="where you want the build system to send the binary library files to"
+rem set DIS_BIN_INSTALL="where you want the build system to send the other binary files to"premake --file DIS.lua --target vs2005
+rem set HAWKNL_INC_DIR="where the headers for HawkNL exist."
+rem set HAWKNL_LIB_DIR="where the library for HawkNL exists."
+premake --file DIS.lua --target vs2005
+popd
+pause
\ No newline at end of file
diff --git a/Compile/vs2003/DIS.sln b/Compile/vs2003/DIS.sln
new file mode 100644
index 00000000..465188e4
--- /dev/null
+++ b/Compile/vs2003/DIS.sln
@@ -0,0 +1,48 @@
+Microsoft Visual Studio Solution File, Format Version 8.00
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DIS", "./DIS.vcproj", "{05F5CCC2-8942-2C48-9226-F4FC896B0EDF}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest_DIS", "./UnitTest_DIS.vcproj", "{8676E83B-09E4-E64B-839B-6FB9D65A8885}"
+ ProjectSection(ProjectDependencies) = postProject
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF} = {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example_Send", "./Example_Send.vcproj", "{06AFE49F-1482-0643-9705-561F888DF60D}"
+ ProjectSection(ProjectDependencies) = postProject
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF} = {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example_Receive", "./Example_Receive.vcproj", "{F56EBA2B-E44C-0447-8596-7C6C59404C83}"
+ ProjectSection(ProjectDependencies) = postProject
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF} = {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfiguration) = preSolution
+ Debug = Debug
+ Release = Release
+ EndGlobalSection
+ GlobalSection(ProjectConfiguration) = postSolution
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}.Debug.ActiveCfg = Debug|Win32
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}.Debug.Build.0 = Debug|Win32
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}.Release.ActiveCfg = Release|Win32
+ {05F5CCC2-8942-2C48-9226-F4FC896B0EDF}.Release.Build.0 = Release|Win32
+ {8676E83B-09E4-E64B-839B-6FB9D65A8885}.Debug.ActiveCfg = Debug|Win32
+ {8676E83B-09E4-E64B-839B-6FB9D65A8885}.Debug.Build.0 = Debug|Win32
+ {8676E83B-09E4-E64B-839B-6FB9D65A8885}.Release.ActiveCfg = Release|Win32
+ {8676E83B-09E4-E64B-839B-6FB9D65A8885}.Release.Build.0 = Release|Win32
+ {06AFE49F-1482-0643-9705-561F888DF60D}.Debug.ActiveCfg = Debug|Win32
+ {06AFE49F-1482-0643-9705-561F888DF60D}.Debug.Build.0 = Debug|Win32
+ {06AFE49F-1482-0643-9705-561F888DF60D}.Release.ActiveCfg = Release|Win32
+ {06AFE49F-1482-0643-9705-561F888DF60D}.Release.Build.0 = Release|Win32
+ {F56EBA2B-E44C-0447-8596-7C6C59404C83}.Debug.ActiveCfg = Debug|Win32
+ {F56EBA2B-E44C-0447-8596-7C6C59404C83}.Debug.Build.0 = Debug|Win32
+ {F56EBA2B-E44C-0447-8596-7C6C59404C83}.Release.ActiveCfg = Release|Win32
+ {F56EBA2B-E44C-0447-8596-7C6C59404C83}.Release.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ EndGlobalSection
+ GlobalSection(ExtensibilityAddIns) = postSolution
+ EndGlobalSection
+EndGlobal
diff --git a/Compile/vs2003/DIS.vcproj b/Compile/vs2003/DIS.vcproj
new file mode 100644
index 00000000..202577e6
--- /dev/null
+++ b/Compile/vs2003/DIS.vcproj
@@ -0,0 +1,1016 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Compile/vs2003/Example_Send.vcproj b/Compile/vs2003/Example_Send.vcproj
new file mode 100644
index 00000000..72f4c4ed
--- /dev/null
+++ b/Compile/vs2003/Example_Send.vcproj
@@ -0,0 +1,157 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Compile/vs2003/UnitTest_DIS.vcproj b/Compile/vs2003/UnitTest_DIS.vcproj
new file mode 100644
index 00000000..2b271da5
--- /dev/null
+++ b/Compile/vs2003/UnitTest_DIS.vcproj
@@ -0,0 +1,154 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Compile/vs2005/DIS.sln b/Compile/vs2005/DIS.sln
new file mode 100644
index 00000000..032e8c3d
--- /dev/null
+++ b/Compile/vs2005/DIS.sln
@@ -0,0 +1,48 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DIS", "./DIS.vcproj", "{FC35B329-3A9F-7441-952C-883B9CFFEA1E}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTest_DIS", "./UnitTest_DIS.vcproj", "{326F5888-9721-AB45-A83A-87BD0D5D025E}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E} = {FC35B329-3A9F-7441-952C-883B9CFFEA1E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example_Send", "./Example_Send.vcproj", "{EFEE2D9C-66CA-E749-844B-386EA4DD9BF6}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E} = {FC35B329-3A9F-7441-952C-883B9CFFEA1E}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example_Receive", "./Example_Receive.vcproj", "{45B671BB-2E8A-3B4B-8059-4E66E6B5ED11}"
+ ProjectSection(ProjectDependencies) = postProject
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E} = {FC35B329-3A9F-7441-952C-883B9CFFEA1E}
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E}.Debug|Win32.Build.0 = Debug|Win32
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E}.Release|Win32.ActiveCfg = Release|Win32
+ {FC35B329-3A9F-7441-952C-883B9CFFEA1E}.Release|Win32.Build.0 = Release|Win32
+ {326F5888-9721-AB45-A83A-87BD0D5D025E}.Debug|Win32.ActiveCfg = Debug|Win32
+ {326F5888-9721-AB45-A83A-87BD0D5D025E}.Debug|Win32.Build.0 = Debug|Win32
+ {326F5888-9721-AB45-A83A-87BD0D5D025E}.Release|Win32.ActiveCfg = Release|Win32
+ {326F5888-9721-AB45-A83A-87BD0D5D025E}.Release|Win32.Build.0 = Release|Win32
+ {EFEE2D9C-66CA-E749-844B-386EA4DD9BF6}.Debug|Win32.ActiveCfg = Debug|Win32
+ {EFEE2D9C-66CA-E749-844B-386EA4DD9BF6}.Debug|Win32.Build.0 = Debug|Win32
+ {EFEE2D9C-66CA-E749-844B-386EA4DD9BF6}.Release|Win32.ActiveCfg = Release|Win32
+ {EFEE2D9C-66CA-E749-844B-386EA4DD9BF6}.Release|Win32.Build.0 = Release|Win32
+ {45B671BB-2E8A-3B4B-8059-4E66E6B5ED11}.Debug|Win32.ActiveCfg = Debug|Win32
+ {45B671BB-2E8A-3B4B-8059-4E66E6B5ED11}.Debug|Win32.Build.0 = Debug|Win32
+ {45B671BB-2E8A-3B4B-8059-4E66E6B5ED11}.Release|Win32.ActiveCfg = Release|Win32
+ {45B671BB-2E8A-3B4B-8059-4E66E6B5ED11}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Compile/vs2005/DIS.vcproj b/Compile/vs2005/DIS.vcproj
new file mode 100644
index 00000000..9ed924ed
--- /dev/null
+++ b/Compile/vs2005/DIS.vcproj
@@ -0,0 +1,1081 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Compile/vs2005/Example_Send.vcproj b/Compile/vs2005/Example_Send.vcproj
new file mode 100644
index 00000000..acbc4815
--- /dev/null
+++ b/Compile/vs2005/Example_Send.vcproj
@@ -0,0 +1,219 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Compile/vs2005/UnitTest_DIS.vcproj b/Compile/vs2005/UnitTest_DIS.vcproj
new file mode 100644
index 00000000..3d2fb0bd
--- /dev/null
+++ b/Compile/vs2005/UnitTest_DIS.vcproj
@@ -0,0 +1,216 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CppUtils/DIS/Conversion.cpp b/CppUtils/DIS/Conversion.cpp
new file mode 100644
index 00000000..34251f49
--- /dev/null
+++ b/CppUtils/DIS/Conversion.cpp
@@ -0,0 +1,30 @@
+#include
+#include
+
+using namespace DIS;
+
+//const unsigned char Convert::ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS = 5;
+
+
+int Convert::MakeArticulationParameterType(int typeclass, int typemetric)
+{
+ // enforce a ceiling on typemetric
+ typemetric = typemetric & ARTICULATION_PARAMETER_TYPE_METRIC_MASK;
+
+ // shift the typeclass bits to the left by the precision amount of typemetric
+ // and then add the typemetric bits
+ return( (typeclass << ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS)
+ + typemetric );
+}
+
+int Convert::GetArticulationTypeMetric(int parametertype)
+{
+ // wipe off the typeclass bits and return the typemetric bits
+ return( parametertype & ARTICULATION_PARAMETER_TYPE_METRIC_MASK);
+}
+
+int Convert::GetArticulationTypeClass(int parametertype)
+{
+ // wipe off the typemetric bits and return the typeclass bits
+ return( parametertype >> ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS );
+}
diff --git a/CppUtils/DIS/Conversion.h b/CppUtils/DIS/Conversion.h
new file mode 100644
index 00000000..231ca220
--- /dev/null
+++ b/CppUtils/DIS/Conversion.h
@@ -0,0 +1,43 @@
+/// Copyright goes here
+/// License goes here
+/// @author John K. Grant
+/// @author Michael Guerrero
+
+#ifndef _dcl_dis_conversion_h_
+#define _dcl_dis_conversion_h_
+
+#include // for library symbols
+
+namespace DIS
+{
+ /// a name-scope for conversion functions.
+ struct EXPORT_MACRO Convert
+ {
+ /// the number of bits used to store the type metric value
+ /// within the Articulation Parameter's parameter type value.
+ /// this mask is based on the IEEE Std 1278.1-1995
+ static const unsigned char ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS = 5;
+
+ /// make the value needed for the ArticulationParameter's Parameter Type.
+ /// @param typeclass the enumeration for the articulated part.
+ /// This must have less precision than ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS.
+ /// @param typemetric the enumeration for the motion description.
+ /// this must have less precision than 32 - ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS.
+ /// @return the value to be used as the Parameter Type, with 32 bits precision.
+ static int MakeArticulationParameterType(int typeclass, int typemetric);
+
+ /// extract the data for the type metric value stored within the parameter type value.
+ /// this an inverse to the function, MakeArticulationParameterType.
+ /// @param parametertype the value storing the type metric and type class values.
+ /// @return the type metric value, with ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision.
+ static int GetArticulationTypeMetric(int parametertype);
+
+ /// extract the data for the type class value stored within the parameter type value.
+ /// this an inverse to the function, MakeArticulationParameterType.
+ /// @param parametertype the value storing the type metric and type class values.
+ /// @return the type class value, with ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision
+ static int GetArticulationTypeClass(int parametertype);
+ };
+}
+
+#endif // _dcl_dis_conversion_h_
diff --git a/CppUtils/DIS/DataStream.cpp b/CppUtils/DIS/DataStream.cpp
new file mode 100644
index 00000000..e634fc25
--- /dev/null
+++ b/CppUtils/DIS/DataStream.cpp
@@ -0,0 +1,284 @@
+#include
+
+#include // for debug output
+
+using namespace DIS;
+
+DataStream::DataStream(Endian stream)
+ : _buffer()
+ , _read_pos(0)
+ , _write_pos(0)
+ , _stream_endian(stream)
+ , _machine_endian(LITTLE)
+{
+ long one(1);
+ char e = (reinterpret_cast( &one ))[0];
+
+ if( e == (char)1 )
+ {
+ _machine_endian = LITTLE;
+ }
+ else
+ {
+ _machine_endian = BIG;
+ }
+}
+
+DataStream::DataStream(const char* buffer, size_t length, Endian stream)
+ : _buffer()
+ , _read_pos(0)
+ , _write_pos(0)
+ , _stream_endian(stream)
+ , _machine_endian(LITTLE)
+{
+ long one(1);
+ char e = (reinterpret_cast( &one ))[0];
+
+ if( e == (char)1 )
+ {
+ _machine_endian = LITTLE;
+ }
+ else
+ {
+ _machine_endian = BIG;
+ }
+
+ SetStream( buffer, length, stream );
+}
+DataStream::~DataStream()
+{
+}
+
+//const DataStream::BufferType& DataStream::GetBuffer() const
+//{
+// return _buffer;
+//}
+
+Endian DataStream::GetStreamEndian() const
+{
+ return _stream_endian;
+}
+
+Endian DataStream::GetMachineEndian() const
+{
+ return _machine_endian;
+}
+
+size_t DataStream::GetWritePos() const
+{
+ return _write_pos;
+}
+
+size_t DataStream::GetReadPos() const
+{
+ return _read_pos;
+}
+
+size_t DataStream::size() const
+{
+ return _buffer.size();
+}
+
+void DataStream::clear()
+{
+ _write_pos = 0;
+ _read_pos = 0;
+ _buffer.clear();
+}
+
+bool DataStream::empty() const
+{
+ return _buffer.empty();
+}
+
+const char& DataStream::operator [](unsigned int offset) const
+{
+ return _buffer[_read_pos+offset];
+}
+
+// currently copies the source data.
+void DataStream::SetStream(const char* buffer, size_t length, Endian stream)
+{
+ // reassign the endian
+ _stream_endian = stream;
+
+ _write_pos = length;
+ _read_pos = 0;
+
+ // resize the array
+ if( _buffer.size() < length )
+ {
+ _buffer.resize( length );
+ }
+
+ // take ownership of the data
+ // copy the data, expensive!
+ for(unsigned int i=0; i>(char& c)
+{
+ ReadAlgorithm( c );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(unsigned char& c)
+{
+ ReadAlgorithm( c );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(float& f)
+{
+ ReadAlgorithm( f );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(double& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(int& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(unsigned int& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(long& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(unsigned long& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(unsigned short& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
+
+DataStream& DataStream::operator >>(short& d)
+{
+ ReadAlgorithm( d );
+ return *this;
+}
diff --git a/CppUtils/DIS/DataStream.h b/CppUtils/DIS/DataStream.h
new file mode 100644
index 00000000..a2cdc422
--- /dev/null
+++ b/CppUtils/DIS/DataStream.h
@@ -0,0 +1,152 @@
+/// Copyright goes here
+/// License goes here
+/// @author John K. Grant
+
+#ifndef _dcl_dis_data_stream_h_
+#define _dcl_dis_data_stream_h_
+
+// the class member, DataStream::BufferType is causing warnign 4251.
+// disable it until a proper fix is found, as instructed from the enlightening article:
+// http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
+#if _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4251 )
+#endif
+
+#include // for typedef, member
+#include // for typedef, member
+#include // for enum
+#include // for library symbols
+#include // for size_t and NULL definition
+
+namespace DIS
+{
+ /// a class to support managing a network buffer.
+ /// the clients are responsible for managing the char buffer memory.
+ /// this class explicitly defines operators for expected types.
+ class EXPORT_MACRO DataStream
+ {
+ public:
+ /// Setup the internal buffer's Endian type.
+ /// @param stream the Endian type to use for the internal buffer,
+ /// which will be used for network socket writes.
+ DataStream(Endian stream);
+
+ /// Setup the internal buffer.
+ /// @param buffer the data to copy and manage.
+ /// @param length the number of bytes in the buffer.
+ /// @param stream the Endian type to use for the internal buffer,
+ DataStream(const char* buffer, size_t length, Endian stream);
+ ~DataStream();
+
+ /// a method for reading the stored buffer data.
+ /// @param offset the index distance with respect to the current read point.
+ const char& operator [](unsigned int offset) const;
+
+ /// take ownership of the data buffer.
+ void SetStream(const char* buffer, size_t length, Endian order);
+
+ // write operations
+ DataStream& operator <<(bool c);
+ DataStream& operator <<(char c);
+ DataStream& operator <<(unsigned char c);
+ DataStream& operator <<(float c);
+ DataStream& operator <<(double c);
+ DataStream& operator <<(int c);
+ DataStream& operator <<(unsigned int c);
+ DataStream& operator <<(long c);
+ DataStream& operator <<(unsigned long c);
+ DataStream& operator <<(unsigned short c);
+ DataStream& operator <<(short c);
+
+ // read operations
+ DataStream& operator >>(bool& c);
+ DataStream& operator >>(char& c);
+ DataStream& operator >>(unsigned char& c);
+ DataStream& operator >>(float& c);
+ DataStream& operator >>(double& c);
+ DataStream& operator >>(int& c);
+ DataStream& operator >>(unsigned int& c);
+ DataStream& operator >>(long& c);
+ DataStream& operator >>(unsigned long& c);
+ DataStream& operator >>(unsigned short& c);
+ DataStream& operator >>(short& c);
+
+ Endian GetStreamEndian() const;
+ Endian GetMachineEndian() const;
+
+ size_t GetWritePos() const;
+ size_t GetReadPos() const;
+
+ size_t size() const;
+
+ void clear();
+
+ bool empty() const;
+
+ private:
+ template
+ void IncrementPointer(IterT& iter)
+ {
+ iter += sizeof(T);
+ }
+
+ template
+ void DecrementPointer(IterT& iter)
+ {
+ iter -= sizeof(T);
+ }
+
+ /// this algorithm should only be used for primitive types,
+ /// because the class size takes into account the virtual function table.
+ template
+ void WriteAlgorithm(T t)
+ {
+ char* ch = reinterpret_cast( &t );
+ DoFlip( ch , sizeof(T) );
+ DoWrite( ch , sizeof(T) );
+ IncrementPointer( _write_pos );
+ }
+
+ /// this algorithm should only be used for primitive types,
+ /// because the class size takes into account the virtual function table.
+ template
+ void ReadAlgorithm(T& t)
+ {
+ char ch[sizeof(T)];
+ DoRead( ch , sizeof(T) );
+ DoFlip( ch , sizeof(T) );
+ t = *reinterpret_cast( ch );
+ IncrementPointer( _read_pos );
+ }
+
+ /// will flip the buffer if the buffer endian is different than the machine's.
+ void DoFlip(char* buf, size_t bufsize);
+
+ void DoWrite(const char* buf, size_t bufsize);
+
+ void DoRead(char* ch, size_t bufsize);
+
+
+ typedef std::vector BufferType;
+ //const BufferType& GetBuffer() const;
+
+ BufferType _buffer;
+
+ /// the location of the read/write.
+ size_t _read_pos;
+ size_t _write_pos;
+
+ /// the requirement for the managed buffer
+ Endian _stream_endian;
+
+ /// the native endian type
+ Endian _machine_endian;
+ };
+}
+
+#if _MSC_VER
+#pragma warning( pop )
+#endif
+
+#endif // _dcl_dis_data_stream_h_
diff --git a/CppUtils/DIS/Endian.h b/CppUtils/DIS/Endian.h
new file mode 100644
index 00000000..dbb89b8e
--- /dev/null
+++ b/CppUtils/DIS/Endian.h
@@ -0,0 +1,16 @@
+#ifndef _dcl_dis_endian_h_
+#define _dcl_dis_endian_h_
+
+#include // for library symbols
+
+namespace DIS
+{
+ /// the order of bytes that are on the left
+ EXPORT_MACRO enum Endian
+ {
+ LITTLE=1,
+ BIG=0,
+ };
+}
+
+#endif // _dcl_dis_endian_h_
diff --git a/CppUtils/DIS/IBufferProcessor.h b/CppUtils/DIS/IBufferProcessor.h
new file mode 100644
index 00000000..0c7ec70d
--- /dev/null
+++ b/CppUtils/DIS/IBufferProcessor.h
@@ -0,0 +1,20 @@
+/// Copyright goes here
+/// License goes here
+/// @author John K. Grant
+
+#ifndef _dcl_dis_i_buffer_processor_h_
+#define _dcl_dis_i_buffer_processor_h_
+
+#include
+
+namespace DIS
+{
+ /// the interface class for handling read operations.
+ class IBufferProcessor
+ {
+ public:
+ virtual void Process(const char* buf, unsigned int size, Endian e)=0;
+ };
+}
+
+#endif // _dcl_dis_i_buffer_processor_h_
diff --git a/CppUtils/DIS/IPacketProcessor.h b/CppUtils/DIS/IPacketProcessor.h
new file mode 100644
index 00000000..1b614214
--- /dev/null
+++ b/CppUtils/DIS/IPacketProcessor.h
@@ -0,0 +1,22 @@
+/// Copyright goes here
+/// License goes here
+/// @author John K. Grant
+
+#ifndef _dcl_dis_i_packet_processor_h_
+#define _dcl_dis_i_packet_processor_h_
+
+namespace DIS
+{
+ class Pdu;
+
+ /// it is the responsibility of the processor to use the packet
+ /// because it will be deleted after this call.
+ class IPacketProcessor
+ {
+ public:
+ virtual void Process(const Pdu& p)=0;
+ };
+
+}
+
+#endif // _dcl_dis_i_packet_processor_h_
diff --git a/CppUtils/DIS/IncomingMessage.cpp b/CppUtils/DIS/IncomingMessage.cpp
new file mode 100644
index 00000000..524357c7
--- /dev/null
+++ b/CppUtils/DIS/IncomingMessage.cpp
@@ -0,0 +1,132 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+#include
+
+using namespace DIS;
+
+// the DIS specification says the type is known for all PDUs at the 3rd byte of the PDU buffer.
+const unsigned int PDU_TYPE_POSITION = 2;
+
+IncomingMessage::IncomingMessage()
+: _processors()
+{
+}
+
+IncomingMessage::~IncomingMessage()
+{
+}
+
+void IncomingMessage::Process(const char* buf, unsigned int size, Endian e)
+{
+ if( size < 1 )
+ {
+ return;
+ }
+
+ DataStream ds( buf , size , e );
+
+ while( ds.GetReadPos() < ds.size() )
+ {
+ unsigned int pdu_type = ds[PDU_TYPE_POSITION];
+ SwitchOnType( pdu_type, ds );
+ }
+}
+
+void IncomingMessage::SwitchOnType(unsigned int pdu_type, DataStream& ds)
+{
+ DIS::PDUType enumType = (DIS::PDUType)pdu_type;
+ Pdu *pdu = PduBank::GetStaticPDU(enumType);
+
+ if (pdu)
+ {
+ pdu->unmarshal( ds );
+ }
+ else
+ {
+ ds.clear();
+ }
+
+ // assumes the location in the buffer is the packet id.
+ typedef std::pair RangePair;
+ RangePair rangepair = _processors.equal_range( pdu_type );
+ PacketProcessorContainer::iterator processor_iter = rangepair.first;
+ PacketProcessorContainer::iterator processor_end = rangepair.second;
+ while( processor_iter != processor_end )
+ {
+ (processor_iter->second)->Process( *pdu );
+ ++processor_iter;
+ }
+}
+
+
+bool IncomingMessage::AddProcessor(unsigned char id, IPacketProcessor* pp)
+{
+ PacketProcessorContainer::value_type candidate(id,pp);
+ PacketProcessorContainer::iterator containerIter;
+
+ // If this id doesn't already have this processor (it shouldn't)
+ if (!FindProccessorContainer(id, pp, containerIter))
+ {
+ _processors.insert( candidate );
+ return true;
+ }
+
+ return false;
+}
+
+///\todo add proper support for erasing from a multimap.
+///\warning erases any processor registered for the id
+bool IncomingMessage::RemoveProcessor(unsigned char id, const IPacketProcessor* pp)
+{
+ PacketProcessorContainer::iterator containerIter;
+
+ if (FindProccessorContainer(id, pp, containerIter))
+ {
+ // Erases only the single pair found in the interator
+ _processors.erase( containerIter );
+ return true;
+ }
+
+ // The pair doesn't exist
+ return false;
+}
+
+IncomingMessage::PacketProcessorContainer& IncomingMessage::GetProcessors()
+{
+ return _processors;
+}
+
+const IncomingMessage::PacketProcessorContainer& IncomingMessage::GetProcessors() const
+{
+ return _processors;
+}
+
+
+bool IncomingMessage::FindProccessorContainer(unsigned char id, const IPacketProcessor* pp, PacketProcessorContainer::iterator &containerIter)
+{
+ PacketProcessIteratorPair iterPair = _processors.equal_range(id);
+
+ // Check to make sure that the processor we're trying to add is not already there
+ while (iterPair.first != iterPair.second)
+ {
+ // If this processor with a matching id has a the exact same processor, bail
+ if ((iterPair.first)->second == pp)
+ {
+ containerIter = iterPair.first;
+ return true;
+ }
+
+ iterPair.first++;
+ }
+
+ // No matches were found in the loop
+ return false;
+}
diff --git a/CppUtils/DIS/IncomingMessage.h b/CppUtils/DIS/IncomingMessage.h
new file mode 100644
index 00000000..51e4656b
--- /dev/null
+++ b/CppUtils/DIS/IncomingMessage.h
@@ -0,0 +1,56 @@
+/// Copyright goes here
+/// License goes here
+/// @author John K. Grant
+
+#ifndef _dcl_dis_incoming_message_
+#define _dcl_dis_incoming_message_
+
+#include // for base class
+#include