%{ #include #include #include #include #include using namespace ATOOLS; %} namespace ATOOLS { template class Vec4; template class Vec3; typedef Vec4 Vec4D; typedef std::vector Vec4D_Vector; template class Vec4 { public: Vec4(); Vec4(const Scalar& x0, const Scalar& x1, const Scalar& x2, const Scalar& x3); Scalar Mass() const; %extend{ Scalar __getitem__(unsigned int i){ return (*self)[i]; }; Scalar __mul__(const Vec4& v){ return (*self)*v; }; Vec4 __mul__(const Scalar& s){ return (*self)*s; }; Vec4 __rmul__(const Scalar& s){ return (*self)*s; }; Vec4 __add__(const Vec4& v){ return (*self)+v; }; Vec4 __sub__(const Vec4& v){ return (*self)-v; } Vec4 __neg__(){ return -(*self); } }; %extend { std::string __str__() { MyStrStream conv; conv<<*self; return conv.str(); }; }; }; } %include // Instantiate a "double" version of the Vec4-template that will be available as a Class Vec4D in python %template(Vec4D) ATOOLS::Vec4; // Instantiate a "Vec4D" version of the std::vector-template that will be available as a Class Vec4D_Vector in python %template(Vec4D_Vector) std::vector;