#include class simple : public octave_base_value { public: // Constructor simple (const std::string _name = "") : octave_base_value (), name (_name) { } void print (std::ostream& os, bool pr_as_read_syntax = false) const { os << name << std::endl; } private: const std::string name; DECLARE_OCTAVE_ALLOCATOR DECLARE_OV_TYPEID_FUNCTIONS_AND_DATA }; DEFINE_OCTAVE_ALLOCATOR (simple); DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (simple, "simple", "simple"); static bool simple_type_loaded = false; DEFUN_DLD(simple, args, ,"") { if (!simple_type_loaded) { simple::register_type (); simple_type_loaded = true; mlock (); } octave_value retval; if (args.length () != 1 || !args (0).is_string ()) { error ("simple: first argument must be a string"); return retval; } const std::string name = args (0).string_value (); retval = new simple (name); return retval; }