Page 1 of 1

Return values of c++ functions connected to perl

Posted: 20 Apr 2019, 12:20
by jrei
Hello Everyone,

I wrote a c++ function that i want to connect to perl by using Function4perl. In its current implementation the function returns a vector of a structure "region". When executing the function in polymake i get

Code: Select all

ERROR: no output operators known for std::vector<graph::region, std::allocator<graph::region>>
I understand that polymake is unable to interpret a vector as a polymake object. Is there a list of some kind which types are admissable as return value?

Kind Regards,
JR

Re: Return values of c++ functions connected to perl

Posted: 20 Apr 2019, 14:24
by gawrilow
std::vector is fine but your specific region class is unknown to polymake. You should introduce some serialization for it. If it's something that can easily be parsed from a string and printed out, you can define operator<< and operator>> for std::ostream resp. std::istream. If it's a complex data structure, you can define a conversion to/from Serialized<region>. Look for example at RationalFunction, it's serialized as a tuple of numerator and denominator, so you can do something similar with your data members.