Re: [C++-sig] Conversion of python files to C++ ostreams

2010-04-03 Thread Christopher Bruns
On Thu, Apr 1, 2010 at 7:11 PM, Ralf W. Grosse-Kunstleve wrote: >> Is it necessary to explicitly invoke the streambuf object from python? > > Yes. I could be different and in fact was different in the initial > implementation (if you look back in the svn history). But there were > a few subtle pro

Re: [C++-sig] Conversion of python files to C++ ostreams

2010-04-03 Thread Christopher Bruns
On Thu, Apr 1, 2010 at 1:32 PM, Michele De Stefano wrote: > So, as shown into the doxygen example, you have to program a wrapper > like this one: > > foo_wrap(boost::python::object pyfile) { > >     mds_utils::python::oFileObj      fobj(py_file); > >     foo(fobj); > } That's clever. I wonder ho

[C++-sig] Boost.Python to_python_indirect and intrusive_ptr.

2010-04-03 Thread Nicolas Colombe
Hi everyone. I'm trying to use Boost.Python to expose some of my C++ classes and I encountered an odd behaviour of the to_python_indirect result converter for intrusive_ptr with specific classes. Here is the deal: I'm using a component-based design for my classes, meaning an aggregation of object

Re: [C++-sig] Conversion of python files to C++ ostreams

2010-04-03 Thread troy d. straszheim
Michele De Stefano wrote: there is a much easier way to treat a FILE* as a C++ stream. The easy way is to use my open source library (mds-utils, http://code.google.com/p/mds-utils/). Elegant use of boost::iostreams if I may say so. I've been looking for some usecases for some boost.python mo

Re: [C++-sig] Conversion of python files to C++ ostreams

2010-04-03 Thread troy d. straszheim
Christopher Bruns wrote: On Thu, Apr 1, 2010 at 1:32 PM, Michele De Stefano wrote: So, as shown into the doxygen example, you have to program a wrapper like this one: foo_wrap(boost::python::object pyfile) { mds_utils::python::oFileObj fobj(py_file); foo(fobj); } That's clever

Re: [C++-sig] Conversion of python files to C++ ostreams

2010-04-03 Thread troy d. straszheim
troy d. straszheim wrote: as(&fn) where T(U) means "convert the python object to C++ type U, then create a temporary object T and use it to create result_of::type, correction, add here "then pass that thing to fn" > then convert that type to R and return to python". -t __

Re: [C++-sig] Conversion of python files to C++ ostreams

2010-04-03 Thread Ralf W. Grosse-Kunstleve
> Now I am faced with wrapping a constructor that takes a > "std::ostream&" as an argument. I don't know how to write a wrapper > for a constructor in boost.python. I'm open to suggestions on this. > For example: > > // C++ API > struct Foo { > Foo(ostream& os); > }; > > # desired python u