[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
OOP and load/save
From: |
John W. Eaton |
Subject: |
OOP and load/save |
Date: |
Wed, 22 Apr 2009 21:35:21 -0400 |
On 22-Apr-2009, Robert T. Short wrote:
| I have no idea how to cause the constructor to
| be parsed and executed, but I am sure I can figure this out.
Something like this should work:
DEFUN (doit, args, , "")
{
octave_value retval;
if (args.length () == 1)
{
std::string cname = args(0).string_value ();
octave_value ctor = symbol_table::find_method (cname, cname);
if (ctor.is_defined ())
{
octave_value_list result = feval (ctor, 1);
if (result.length () == 1)
{
octave_value object = result(0);
// do something with the newly constructed object...
retval = object;
}
else
error ("call to constructor for class %s failed", cname.c_str ());
}
else
error ("no constructor for class %s", cname.c_str ());
}
else
print_usage ();
return retval;
}
Play with it as is, or extract what you need...
jwe
- Re: OOP and load/save, (continued)
- Re: OOP and load/save, Judd Storrs, 2009/04/24
- Re: OOP and load/save, John W. Eaton, 2009/04/24
- Re: OOP and load/save, Robert T. Short, 2009/04/24
- Message not available
- Message not available
- Re: OOP and load/save, Robert T. Short, 2009/04/24
- Re: OOP and load/save, Judd Storrs, 2009/04/23
- Re: OOP and load/save, John W. Eaton, 2009/04/23
- Re: OOP and load/save, John W. Eaton, 2009/04/23
- Re: OOP and load/save, John W. Eaton, 2009/04/23
OOP and load/save,
John W. Eaton <=