|
[yoda-svn] r474 - trunk/pyext/yoda/includeblackhole at projects.hepforge.org blackhole at projects.hepforge.orgMon Jul 2 22:55:03 BST 2012
Author: None Date: Mon Jul 2 22:55:02 2012 New Revision: 474 Log: Added rudimentary annotations support to AnalysisObject's Python wrapper Modified: trunk/pyext/yoda/include/00-imports.pyx trunk/pyext/yoda/include/10-AnalysisObject.pyx Modified: trunk/pyext/yoda/include/00-imports.pyx ============================================================================== --- trunk/pyext/yoda/include/00-imports.pyx Mon Jul 2 16:19:37 2012 (r473) +++ trunk/pyext/yoda/include/00-imports.pyx Mon Jul 2 22:55:02 2012 (r474) @@ -1,4 +1,6 @@ from libcpp.vector cimport vector +from libcpp.map cimport map +from cython.operator cimport dereference as deref, preincrement as inc from string cimport string from libcpp.pair cimport pair from libcpp cimport bool Modified: trunk/pyext/yoda/include/10-AnalysisObject.pyx ============================================================================== --- trunk/pyext/yoda/include/10-AnalysisObject.pyx Mon Jul 2 16:19:37 2012 (r473) +++ trunk/pyext/yoda/include/10-AnalysisObject.pyx Mon Jul 2 22:55:02 2012 (r474) @@ -1,6 +1,7 @@ cdef extern from "YODA/AnalysisObject.h" namespace "YODA": cdef cppclass cAnalysisObject "YODA::AnalysisObject": string type() + map[string, string] annotations ctypedef cAnalysisObject* AOptr @@ -17,6 +18,16 @@ """The type of this analysis object as a string""" return self.thisptr.type().c_str() + def annotations(self): + d = dict() + cdef map[string, string] annotations = self.thisptr.annotations() + + it = annotations.begin() + while it != annotations.end(): + d[deref(it).first.c_str()] = deref(it).second.c_str() + inc(it) + return d + def __dealloc__(self): if self._dealloc: del self.thisptr
More information about the yoda-svn mailing list |