Hi There,
I want to derive from a c++ class in ruby and then pass an instance back to a c++ call. Specifically I want to derive from Xapian::Weight (http://xapian.org/docs/apidoc/html/classXapian%5F1%5F1Weight.html) and then tell Xapian to use my implemention.
I have Xapian talking correctly with acts_as_xapian, but can't get to accept my object.
Does anyone have any examples or solutions?
Cheers
edit:
Specifically this is what I want to implement:
class CoordWeight : public Xapian::Weight {
public:
MyWeight * clone() const {
return new MyWeight;
}
MyWeight() { }
~MyWeight() { }
std::string name() const { return "Coord"; }
std::string serialise() const { return ""; }
MyWeight * unserialise(const std::string & /*s*/) const {
return new MyWeight;
}
Xapian::weight get_sumpart(Xapian::termcount /*wdf*/, Xapian::doclength /*len*/) const { return 1; }
Xapian::weight get_maxpart() const { return 1; }
Xapian::weight get_sumextra(Xapian::doclength /*len*/) const { return 0; }
Xapian::weight get_maxextra() const { return 0; }
bool get_sumpart_needs_doclength() const { return false; }
};