Re: [Gaudi-talk] PyRoot, Reflex, STL iterators and __deref__()

From: <WLavrijsen_at_lbl.gov>
Date: Wed, 10 Dec 2008 13:35:21 -0800


Brett,

> <class pattern="_Rb_tree_*iterator<std::pair<const short,DayaBay::SimHitCollection*> >" />

this one I don't like (the "const" and the two '*' one for the pattern and one for the pointer).

Anyway, this worked for me:

$ cat brett.h

#include <map>

namespace DayaBay {

   class SimHitCollection {
   public:

      int m_i;
   };

};

template class std::map< short, DayaBay::SimHitCollection* >; template class std::pair< short, DayaBay::SimHitCollection* >;

$ cat selection.xml

<lcgdict>

  <class name="std::map< short, DayaBay::SimHitCollection* >" />
  <class name="std::map< short, DayaBay::SimHitCollection* >::iterator" />
  <class name="std::pair< short, DayaBay::SimHitCollection* >" />
</lcgdict>

$ genreflex brett.h -s selection.xml

$ g++ -shared -I$ROOTSYS/include brett_rflx.cpp -o libbrett.so

$ cat brett.py

import PyCintex

PyCintex.loadDict( "libbrett" )
m = PyCintex.gbl.std.map( 'short', 'DayaBay::SimHitCollection*' )() print m.begin().__deref__

I do get a warning about no dictionary being available for class DayaBay::SimHitCollection, but that's a non-issue.

You can probably fill out the selection.xml with const_iterator etc., if so desired ...

Best regards,

           Wim

-- 
WLavrijsen_at_lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net
Received on Wed Dec 10 2008 - 22:35:04 CET

This archive was generated by hypermail 2.2.0 : Thu Dec 11 2008 - 05:50:03 CET