RakNet.i 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. //This is the main file that puts everything together, large sections are put into thier own file
  2. //Smaller sections are placed directly in this file
  3. %module(directors="1") RakNet
  4. #pragma SWIG nowarn=312,302,314,473,516,325
  5. #if defined(SWIG_ADDITIONAL_AUTOPATCHER_MYSQL) || defined(SWIG_ADDITIONAL_AUTOPATCHER_POSTGRESQL)
  6. #define SWIG_ADDITIONAL_AUTOPATCHER
  7. #endif
  8. %include "RakNetCSharpCPlusIncludes.i"
  9. //----------------Includes for swig functions -----------
  10. %include cpointer.i
  11. %include "arrays_csharp.i"
  12. %include "typemaps.i"
  13. %include "carrays.i"
  14. //----------------------Features--------------------
  15. //The director featur is required for C# function overrides to work on the C++ classes
  16. %feature("director") NatPunchthroughDebugInterface;
  17. %feature("director") FileListTransferCBInterface;
  18. %feature("director") UDPProxyClientResultHandler;
  19. %feature("director") UDPProxyServerResultHandler;
  20. %feature("director") NetworkIDObject;
  21. %nestedworkaround DataStructures::Table::Row;
  22. %nestedworkaround DataStructures::Table::Cell;
  23. %nestedworkaround DataStructures::Table::FilterQuery;
  24. %nestedworkaround DataStructures::Table::ColumnDescriptor;
  25. %nestedworkaround DataStructures::Table::SortQuery;
  26. %nestedworkaround RakNet::FileListTransferCBInterface::OnFileStruct;
  27. %nestedworkaround RakNet::FileListTransferCBInterface::FileProgressStruct;
  28. %nestedworkaround RakNet::FileListTransferCBInterface::DownloadCompleteStruct;
  29. //----------------Extra Swig PreProcessor------------
  30. %include "RakNetCSharpPreprocessor.i"
  31. //----------Ignores----------------
  32. %include "RakNetCSharpIgnores.i"
  33. //------------------------------TypeMaps--------------------------
  34. %include "RakNetCSharpTypeMaps.i"
  35. //----------------------------Method modifiers---------------------
  36. %include "RakNetCSharpMethodModifiers.i"
  37. //--------------------------Renames--------------------------------
  38. %include "RakNetCSharpRenames.i"
  39. //--------------------------------Extends-----------------------------------
  40. %include "RakNetCSharpExtends.i"
  41. //----------------------------Additional Class/Struct Defines-----------------------
  42. %include "RakNetStructsAndClasses.i"
  43. //---------------------------Extra global functions---------------
  44. //What these two functions are for, is to get around the string in/out problem I return the string
  45. //These helper functions are hidden from the user, the user sees the original in/out api
  46. //This is the C++ code insert
  47. %{
  48. char * StatisticsToStringHelper( RakNet::RakNetStatistics *s,char * buffer,int verbosityLevel )
  49. {
  50. StatisticsToString( s, buffer, verbosityLevel );
  51. return buffer;
  52. }
  53. %}
  54. //This code is for Swig parsing
  55. char * StatisticsToStringHelper( RakNet::RakNetStatistics *s,char * buffer,int verbosityLevel );
  56. #ifdef SWIG_ADDITIONAL_AUTOPATCHER
  57. //Swig parsing
  58. /*bool CreatePatchHelper(unsigned char *inByteArray, unsigned oldsize, unsigned char *inByteArray2, unsigned int newsize, unsigned char * inOutByteArray, unsigned *outSize);
  59. //Code include
  60. %{
  61. bool CreatePatchHelper(unsigned char *inByteArray, unsigned oldsize, unsigned char *inByteArray2, unsigned int newsize, unsigned char * inOutByteArray, unsigned *outSize)
  62. {
  63. char ** passedArrayPointer;
  64. *passedArrayPointer= new char[99];
  65. bool returnVal=CreatePatch((char *) inByteArray,oldsize,(char *) inByteArray2,newsize,passedArrayPointer,outSize);
  66. //memcpy(inOutByteArray, *passedArrayPointer, (size_t)1);
  67. return true;
  68. }
  69. %}*/
  70. #endif
  71. //------------------------------Header includes for parsing by swig----------------------------
  72. %include "RakNetCSharpSwigIncludes.i"
  73. using namespace RakNet;
  74. //-------------------------Special Extends----------------------------------
  75. //For whatever reason these extends need to be placed after swig parsing.
  76. //For the template to work the DataStructures namespace needs to be parsed by swig
  77. %extend DataStructures::Table
  78. {
  79. DataStructures::Page<unsigned, Row*, _TABLE_BPLUS_TREE_ORDER> * GetListHeadHelper()
  80. {//Bypass of strange bug reprted by user
  81. return self->GetListHead();
  82. }
  83. void SortTableHelper(DataStructures::List< SortQuery > *sortQueries, unsigned numSortQueries, DataStructures::List< Row > *out)
  84. {
  85. SortQuery * passedArray=NULL;
  86. if (sortQueries!=NULL)
  87. {
  88. passedArray=&((*sortQueries)[0]); /*The memory should be contigous since this is a vector class copy. It was last time I checked the implementation. So this will efficiently pass the array without needing to copy it*/
  89. }
  90. int numRows = self->GetRowCount();
  91. Row **tempIn = NULL;
  92. tempIn = new Row*[numRows];
  93. self->SortTable(passedArray,numSortQueries, tempIn);
  94. for (int i=0;i<numRows;i++)
  95. {
  96. out->Insert(*(tempIn[i]),__FILE__,__LINE__);
  97. }
  98. delete [] tempIn;
  99. }
  100. void GetCellValueByIndexHelper(unsigned rowIndex, unsigned columnIndex, unsigned char *inOutByteArray, int *outputLength)
  101. {
  102. self->GetCellValueByIndex(rowIndex, columnIndex, (char *)inOutByteArray, outputLength);
  103. }
  104. char * GetCellValueByIndexHelper(unsigned rowIndex, unsigned columnIndex, char *output)
  105. {
  106. self->GetCellValueByIndex(rowIndex,columnIndex,output);
  107. return output;
  108. }
  109. /// \brief Prints out the names of all the columns.
  110. /// \param[out] inOutByteArray A pointer to an array of bytes which will hold the output.
  111. /// \param[in] outLength The size of the \a out array
  112. /// \param[in] columnDelineator What character to print to delineate columns
  113. void PrintColumnHeaders(unsigned char *inOutByteArray, int byteArrayLength, char columnDelineator) const
  114. {
  115. self->PrintColumnHeaders((char *) inOutByteArray,byteArrayLength, columnDelineator);
  116. }
  117. /// \brief Writes a text representation of the row to \a out.
  118. /// \param[out] inOutByteArray A pointer to an array of bytes which will hold the output.
  119. /// \param[in] outLength The size of the \a out array
  120. /// \param[in] columnDelineator What character to print to delineate columns
  121. /// \param[in] printDelineatorForBinary Binary output is not printed. True to still print the delineator.
  122. /// \param[in] inputRow The row to print
  123. void PrintRow(unsigned char *inOutByteArray, int byteArrayLength, char columnDelineator, bool printDelineatorForBinary, DataStructures::Table::Row* inputRow) const
  124. {
  125. self->PrintRow((char *)inOutByteArray,byteArrayLength,columnDelineator,printDelineatorForBinary,inputRow);
  126. }
  127. void QueryTableHelper(unsigned *columnIndicesSubset, unsigned numColumnSubset, DataStructures::List <FilterQuery> * inclusionFilters, unsigned numInclusionFilters, unsigned *rowIds, unsigned numRowIDs, Table *result)
  128. {
  129. FilterQuery * passedArray=NULL;
  130. if (inclusionFilters!=NULL)
  131. {
  132. passedArray=&((*inclusionFilters)[0]); /*The memory should be contigous since this is a vector class copy. It was last time I checked the implementation. So this will efficiently pass the array without needing to copy it*/
  133. }
  134. self->QueryTable(columnIndicesSubset, numColumnSubset, passedArray, numInclusionFilters, rowIds, numRowIDs, result);
  135. }
  136. bool UpdateCell(unsigned rowId, unsigned columnIndex, int byteLength, unsigned char *inByteArray)
  137. {
  138. return self->UpdateCell( rowId, columnIndex, byteLength, (char *) inByteArray);
  139. }
  140. bool UpdateCellByIndex(unsigned rowIndex, unsigned columnIndex, int byteLength, unsigned char *inByteArray)
  141. {
  142. return self->UpdateCellByIndex( rowIndex, columnIndex, byteLength, (char *) inByteArray);
  143. }
  144. //This is needed because Swig Will not ignore the definistion I tell it to, so I need to ignore all ColumnIndexes
  145. unsigned ColumnIndexHelper(const char *columnName) const
  146. {
  147. return self->ColumnIndex(columnName);
  148. }
  149. }
  150. //---------------------------------Template Defines-------------------------
  151. %include "RakNetCSharpTemplateDefines.i"
粤ICP备19079148号