Return values of c++ functions connected to perl

Questions and problems about using polymake go here.
jrei
Posts: 15
Joined: 31 Jan 2019, 15:37

Return values of c++ functions connected to perl

Postby jrei » 20 Apr 2019, 12:20

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

User avatar
gawrilow
Main Author
Posts: 423
Joined: 25 Dec 2010, 17:40

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

Postby gawrilow » 20 Apr 2019, 14:24

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.


Return to “Helpdesk”