@@ -27,8 +27,6 @@ namespace py = pybind11;
2727__Finfo__::__Finfo__ (const ObjId& oid, const Finfo* f, const string& finfoType)
2828 : oid_(oid), f_(f), finfoType_(finfoType)
2929{
30- // cout << " __Finfo__ type " << finfoType << endl;
31-
3230 if (finfoType == " DestFinfo" )
3331 func_ = [oid, f](const py::object& key) {
3432 return getLookupValueFinfoItem (oid, f, key);
@@ -103,6 +101,14 @@ py::object __Finfo__::getLookupValueFinfoItem(const ObjId& oid, const Finfo* f,
103101 } else if (srcType == " unsigned int" ) {
104102 auto k = py::cast<unsigned int >(key);
105103 r = getLookupValueFinfoItemInner<unsigned int >(oid, f, k, tgtType);
104+ } else if (srcType == " ObjId" ) {
105+ auto k = py::cast<ObjId>(key);
106+ r = getLookupValueFinfoItemInner<ObjId>(oid, f, k, tgtType);
107+ } else if (srcType == " Id" ) {
108+ auto k = py::cast<Id>(key);
109+ r = getLookupValueFinfoItemInner<Id>(oid, f, k, tgtType);
110+ } else {
111+ r = py::none ();
106112 }
107113
108114 if (r.is (py::none ())) {
@@ -116,12 +122,13 @@ py::object __Finfo__::getLookupValueFinfoItem(const ObjId& oid, const Finfo* f,
116122
117123py::object __Finfo__::getItem (const py::object& key)
118124{
119- // py::print("Fetching value for", key, finfoType_);
125+ py::print (" Fetching value for" , key, finfoType_);
120126 return func_ (key);
121127}
122128
123129py::object __Finfo__::operator ()(const py::object& key)
124130{
131+ py::print (" Calling function with key" , key);
125132 return func_ (key);
126133}
127134
@@ -166,7 +173,6 @@ py::cpp_function __Finfo__::getDestFinfoSetterFunc2(const ObjId& oid,
166173 oid.path ());
167174}
168175
169-
170176// Get DestFinfo1.
171177py::cpp_function __Finfo__::getDestFinfoSetterFunc1 (const ObjId& oid,
172178 const Finfo* finfo,
@@ -180,17 +186,13 @@ py::cpp_function __Finfo__::getDestFinfoSetterFunc1(const ObjId& oid,
180186 return func;
181187 }
182188
183- if (ftype == " double" )
184- return getSetGetFunc1<double >(oid, fname);
185- if (ftype == " ObjId" )
186- return getSetGetFunc1<ObjId>(oid, fname);
187- if (ftype == " Id" )
188- return getSetGetFunc1<Id>(oid, fname);
189- if (ftype == " vector<Id>" )
190- return getSetGetFunc1<vector<Id>>(oid, fname);
191- if (ftype == " vector<ObjId>" )
189+ if (ftype == " double" ) return getSetGetFunc1<double >(oid, fname);
190+ if (ftype == " ObjId" ) return getSetGetFunc1<ObjId>(oid, fname);
191+ if (ftype == " Id" ) return getSetGetFunc1<Id>(oid, fname);
192+ if (ftype == " vector<Id>" ) return getSetGetFunc1<vector<Id>>(oid, fname);
193+ if (ftype == " vector<ObjId>" )
192194 return getSetGetFunc1<vector<ObjId>>(oid, fname);
193- if (ftype == " vector<double>" )
195+ if (ftype == " vector<double>" )
194196 return getSetGetFunc1<vector<double >>(oid, fname);
195197
196198 throw runtime_error (" getFieldPropertyDestFinfo1::NotImplemented " + fname +
@@ -257,7 +259,6 @@ py::list __Finfo__::getElementFinfo(const ObjId& objid, const Finfo* f)
257259py::object __Finfo__::getElementFinfoItem (const ObjId& oid, const Finfo* f,
258260 unsigned int index)
259261{
260- // cout << "Fetching at index " << index << " " << getNumField() << endl ;
261262 if (index >= getNumFieldStatic (oid, f)) {
262263 throw py::index_error (" Index " + to_string (index) + " out of range." );
263264 }
@@ -270,11 +271,6 @@ string __Finfo__::type() const
270271 return finfoType_;
271272}
272273
273- // py::object __Finfo__::getAttr(const string& key)
274- // {
275- // std::cout << "Accessing " << key << std::endl;
276- // }
277-
278274unsigned int __Finfo__::getNumField ()
279275{
280276 return __Finfo__::getNumFieldStatic (oid_, f_);
0 commit comments