%class Parameters
%language c++
%namespace Data
%{
  //C++ code here
  //it will be include before class declaration
#include &lt;iostream&gt;
%}

%var    float           param1(0.0)
%var    bool            param2(false)
%var    int             param3(0)
%var    std::string     param4("")

%{
  //C++ Code here
  //it will be include in class declaration
  public:
    void print(std::ostream& s) const
      {
        s &lt;&lt; _param1 &lt;&lt; ' ' &lt;&lt; _param2
          &lt;&lt; ' ' &lt;&lt; _param3 &lt;&lt; ' ' &lt;&lt; _param4
          &lt;&lt; std::endl;
      }
%}

%%

//Code outside classe declaration
inline std::ostream& operator&lt;&lt;(std::ostream& s, const Parameters& p)
{
  p.print(s);
  return s;
}
