/** * * SylphideProcessorをswig経由で * スクリプトで使用するためのインターフェイスファイル * */ %module Pitot %{ #define USE_AS_HEADER #include "pitot_tube3.cpp" #undef USE_AS_HEADER %} %include %include %include "arg_std_iostream.i" %exception { try { $action } catch (const std::exception& e) { SWIG_exception(SWIG_RuntimeError, e.what()); } } %feature("autodoc", "1"); %inline %{ struct Pitot3_input { bool analyzing; double time; double raw[4]; double offset[4]; Pitot3_input() : analyzing(false) { for(int i(0); i < sizeof(offset) / sizeof(offset[0]); i++){ offset[i] = 0; } } ~Pitot3_input(){} void set_raw( const double &raw0, const double &raw1, const double &raw2, const double &raw3){ raw[0] = raw0; raw[1] = raw1; raw[2] = raw2; raw[3] = raw3; } }; struct Pitot3_output { double time; double aspd, angle1, angle2, alt; }; %} %extend Pitot3 { %ignore input_t; %ignore output_t; %ignore analyze_1step(input_t &, output_t &); %alias set_offset_calc_start "offset_calc_start="; void set_offset_calc_start(const double &t){ self->offset_calc_start() = t; } %alias set_t_start "t_start="; void set_t_start(const double &t){ self->t_start() = t; } bool analyze_1step(Pitot3_input &input, Pitot3_output &output){ return self->analyze_1step( reinterpret_cast(input), reinterpret_cast(output)); } } %ignore ::main; %include pitot_tube3.cpp