%{
/* csharp/local_extra.i: CLucene scripting csharp interface additional code.
 */
 
//no easy support for arrays, so add our own support in
#include "clucene_arrays.h"
#include "local_arrays.h"
%}
//no easy support for arrays, so add our own support in
%include "clucene_arrays.h"
%include "local_arrays.h"

////////////////////////////////////////////////////////////////////////
//CLUCENEARRAY typemap - csharp array handling...
////////////////////////////////////////////////////////////////////////
%typemap(ctype) CLUCENEARRAY "void*"
%typemap(imtype) CLUCENEARRAY "IntPtr"
%typemap(in) CLUCENEARRAY %{
  _CL$1_mangleArray* _obj_$1 =(_CL$1_mangleArray*)$input;
  $1 = _obj_$1->array;
%}
%typemap(out) CLUCENEARRAY %{
  _CL$1_mangleArray* _obj_$1 = _CLNEW _CL$1_mangleArray(result);
  jresult=(void*)_obj_$1;
%}
%typemap(csout) CLUCENEARRAY { return new _CL$1_mangleArray($imcall,true).toArray(); };
%typemap(csin) CLUCENEARRAY "_CL$1_mangleArray.getCPtr(new _CL$1_mangleArray($csinput))"


//specific types
%apply CLUCENEARRAY{ TCHAR**,TCHAR*[],TCHAR** const };
%apply CLUCENEARRAY{ uint8_t*,uint8_t* const };
%apply CLUCENEARRAY{ int32_t*,int32_t* const };
%apply CLUCENEARRAY{ lucene::index::IndexReader** };
%apply CLUCENEARRAY{ lucene::index::TermFreqVector** };
%apply CLUCENEARRAY{ lucene::search::SortField** };
%apply CLUCENEARRAY{ lucene::search::Searchable** };

%typemap(cstype) TCHAR**,TCHAR*[],TCHAR** const "string[]"
%typemap(cstype) uint8_t*,uint8_t* const "byte[]"
%typemap(cstype) int32_t*,int32_t* const "int[]"
%typemap(cstype) lucene::index::IndexReader**,lucene::index::IndexReader** const "IndexReader[]"
%typemap(cstype) lucene::index::TermFreqVector**,lucene::index::TermFreqVector** const "TermFreqVector[]"
%typemap(cstype) lucene::search::SortField**,lucene::search::SortField** const "SortField[]"
%typemap(cstype) lucene::search::Searchable**,lucene::search::Searchable** const "Searchable[]"
//
////////////////////////////////////////////////////////////////////////

