[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
struct() handling in C++
From: |
Jan Trmal |
Subject: |
struct() handling in C++ |
Date: |
Wed, 1 Feb 2006 10:23:12 +0100 |
User-agent: |
KMail/1.9 |
Hi,
can anyone tell me, or show me some C++ code, where the DLD function have
struct as input argument?
for example, when I create in octave
struct("svm_type", "c_svc", "kernel_type", "linear")
I use this code for parsing (just example)
DEFUN_DLD(svmpredict,args, nargout,
"Trains the Support Vector Machine")
{
if (!args.is_map()) {
throw eValueConversionError("model parameter must be struct");
}
Octave_map map = args.map_value();
octave_value o1 = (map.contents("kernel_type"));
octave_value q1 = o1.list_value().operator()(0);
cout << q1.string_value();
return octave_value_list()
}
But It seems very complicated to get such as simple datatype as string.
Is here any less complicated way than the one I've found? :)
Regards,
JT
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- struct() handling in C++,
Jan Trmal <=