@@ -111,17 +111,34 @@ py::object getValueFinfo(const ObjId& oid, const string& fname, const string& rt
111111 return r;
112112}
113113
114- py::object getElementFinfo (const ObjId& objid, const string& fname, const size_t i)
114+ inline ObjId getElementFinfoItem (const ObjId& oid, const size_t & i)
115+ {
116+ return ObjId (oid.path (), oid.dataIndex , i);
117+ }
118+
119+ py::list getElementFinfo (const ObjId& objid, const string& fname)
115120{
116121 auto oid = ObjId (objid.path () + ' /' + fname);
117122 auto len = Field<unsigned int >::get (oid, " numField" );
118- assert (len >= 0 );
119- return py::cast (ObjId (oid.path (), oid.dataIndex , i));
123+ vector<ObjId> res (len);
124+ for (size_t i = 0 ; i < len; i++)
125+ res[i] = ObjId (oid.path (), oid.dataIndex , i);
126+ return py::cast (res);
127+ }
128+
129+ py::object getLookupValueFinfoItem (const ObjId& oid, const string& fname, const string& k)
130+ {
131+ py::object r;
132+ r = py::cast (LookupField<string, bool >::get (oid, fname, k));
133+ return r;
120134}
121135
122- py::object getLookValueFinfo (const ObjId& oid, const string& fname, const string& key )
136+ py::object getLookupValueFinfo (const ObjId& oid, const string& fname)
123137{
124- return py::cast (LookupField<string, bool >::get (oid, fname, key));
138+ std::function<py::object (const string&)> f = [oid, fname](const string& key) {
139+ return getLookupValueFinfoItem (oid, fname, key);
140+ };
141+ return py::cast (f);
125142}
126143
127144py::object getProperty (const ObjId& oid, const string& fname)
@@ -138,18 +155,15 @@ py::object getProperty(const ObjId& oid, const string& fname)
138155 string finfoType = cinfo->getFinfoType (finfo);
139156
140157 if (finfoType == " ValueFinfo" )
158+ // return value.
141159 return getValueFinfo (oid, fname, rttType);
142160 else if (finfoType == " FieldElementFinfo" ) {
143- std::function<py::object (size_t )> f = [oid, fname](const size_t & i) {
144- return getElementFinfo (oid, fname, i);
145- };
146- return py::cast (f);
161+ // Return list.
162+ return getElementFinfo (oid, fname);
147163 }
148164 else if (finfoType == " LookupValueFinfo" ) {
149- std::function<py::object (const string&)> f = [oid, fname](const string& k) {
150- return getLookValueFinfo (oid, fname, k);
151- };
152- return py::cast (f);
165+ // Return function.
166+ return getLookupValueFinfo (oid, fname);
153167 }
154168
155169 cout << " Searching for " << fname << " with rttType "
0 commit comments