Recently I've been trying to autogenerate some data structures that
will work for both C++ and Java. I've made many that work with Java,
but every time I try to generate one for C++ the generator breaks
down. For instance, I was trying to create a Text class for C++, so I
created a text.jr:
module io {
class Text {
ustring text;
}
}
that in Java works fine, but in C++, this is generated (implementation
is fine for the methods defined):
#ifndef __TEXT_DDL__
#define __TEXT_DDL__
#include "recordio.hh"
namespace io {
class Text : public ::hadoop::Record {
private:
::std::string text;
public:
virtual void serialize(::hadoop::OArchive& a_, const char* tag) const;
virtual void deserialize(::hadoop::IArchive& a_, const char* tag);
virtual const ::std::string& type() const;
virtual const ::std::string& signature() const;
virtual bool operator<(const Text& peer_) const;
virtual bool operator==(const Text& peer_) const;
virtual ~Text() {};
virtual const ::std::string& getText() const {
return text;
}
virtual ::std::string& getText() {
return text;
}
}; // end record Text
} // end namespace io
#endif //TEXT_DDL__
What is obviously missing is
-a constructor,
-a setter (there are getters for const and non-const...)
This is with hadoop-0.15.1 and I've also tried following the examples
given in the API to no luck. Thanks for any feedback!