[C++-sig] Pickle an enum from c++

2008-12-02 Thread Matthew Scouten (TT)
I have an enum in my c++ library. In fact I have a crap load of them. 169 to be exact. I need them to be pickle-able. The enum_ object does not have a .def_pickle function, so I cannot use the pickle suite. I tried to just up and pickle it but that does not work either. enum box {cardboa

Re: [C++-sig] boost.python: implicit type conversion

2008-12-02 Thread Stefan Seefeld
Mihail Konstantinov wrote: Roman Yakovenko wrote: It is not a good idea. Python string is immutable. May be you should consider custom converter. http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/faq.html#custom_string I don't see why it is not a good idea. I am nowhere ac

Re: [C++-sig] boost.python: implicit type conversion

2008-12-02 Thread Roman Yakovenko
On Tue, Dec 2, 2008 at 9:20 PM, Mihail Konstantinov <[EMAIL PROTECTED]> wrote: >> Roman Yakovenko wrote: >> It is not a good idea. Python string is immutable. May be you should >> consider custom converter. >> http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/faq.html#custom_string > > I don'

Re: [C++-sig] boost.python: implicit type conversion

2008-12-02 Thread Mihail Konstantinov
> >implicitly_convertible(); > >implicitly_convertible(); > >} > I see that an int can be implicitly converted to X. But how can an X be > converted to an int? I can't believe that boost.python searches all > implemented > functions to find that make_x is capable of converting an int to

Re: [C++-sig] boost.python: implicit type conversion

2008-12-02 Thread Mihail Konstantinov
> Roman Yakovenko wrote: > > It is not a good idea. Python string is immutable. May be you should > consider custom converter. > http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/faq.html#custom_string I don't see why it is not a good idea. I am nowhere accessing any string derived classe

Re: [C++-sig] boost.python: implicit type conversion

2008-12-02 Thread Roman Yakovenko
On Tue, Dec 2, 2008 at 7:04 PM, Mihail Konstantinov <[EMAIL PROTECTED]> wrote: > Dear all, > thanks a lot for your immediate responses that lead to a fast solution for my > previous problem. > > Here comes the next one. > > In the example below both classes A and B are derived from std::string. I

Re: [C++-sig] gccxml

2008-12-02 Thread Gustavo Carneiro
2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> > 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > > > > > > 2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> > >> > >> 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > >> > 2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> > >> >> > >> >> I would make a co

Re: [C++-sig] gccxml

2008-12-02 Thread Mathieu Malaterre
2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > > > 2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> >> >> 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: >> > 2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> >> >> >> >> I would make a contribution to some projects. GCC-XML is not one of >> >> them, >>

Re: [C++-sig] gccxml

2008-12-02 Thread Gustavo Carneiro
2008/12/2 Mathieu Malaterre <[EMAIL PROTECTED]> > 2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > > 2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> > >> > >> I would make a contribution to some projects. GCC-XML is not one of > them, > >> seeing how it's not even worth my effort to try to install and

Re: [C++-sig] gccxml

2008-12-02 Thread Mathieu Malaterre
2008/12/2 Gustavo Carneiro <[EMAIL PROTECTED]>: > 2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> >> >> I would make a contribution to some projects. GCC-XML is not one of them, >> seeing how it's not even worth my effort to try to install and configure >> this stuff. If I were involved with these pack

[C++-sig] boost.python: implicit type conversion

2008-12-02 Thread Mihail Konstantinov
Dear all, thanks a lot for your immediate responses that lead to a fast solution for my previous problem. Here comes the next one. In the example below both classes A and B are derived from std::string. Class B can be implicitly converted to A by means of 'B::operator const A()'. So the functi

Re: [C++-sig] gccxml

2008-12-02 Thread Gustavo Carneiro
2008/12/2 Alan Baljeu <[EMAIL PROTECTED]> > I would make a contribution to some projects. GCC-XML is not one of them, > seeing how it's not even worth my effort to try to install and configure > this stuff. If I were involved with these packages, I would make it easy > for others to get involved

Re: [C++-sig] gccxml

2008-12-02 Thread Alan Baljeu
I would make a contribution to some projects. GCC-XML is not one of them, seeing how it's not even worth my effort to try to install and configure this stuff. If I were involved with these packages, I would make it easy for others to get involved. As it isn't easy I'm going to look elsewhere.

Re: [C++-sig] gccxml

2008-12-02 Thread Roman Yakovenko
On Tue, Dec 2, 2008 at 5:26 PM, Alan Baljeu <[EMAIL PROTECTED]> wrote: > This is getting out of hand :-( > > All I wanted to do was parse some simple C++ function declarations to > generate a corresponding py-callable wrapper. To do this I need to get > pygccxml. Then I need gccxml to use pygcc

Re: [C++-sig] gccxml

2008-12-02 Thread Stefan Seefeld
Alan Baljeu wrote: This is getting out of hand :-( I think I'd rather just do my own thing, except that C++ is so warty it's difficult to come up with anything reasonable that will serve the purpose. How many functions and objects do you want to export, anyway ? I have so far always

Re: [C++-sig] gccxml

2008-12-02 Thread Alan Baljeu
This is getting out of hand :-( All I wanted to do was parse some simple C++ function declarations to generate a corresponding py-callable wrapper. To do this I need to get pygccxml. Then I need gccxml to use pygccxml. To get that I need WinCVS or some equivalent (which version, and learn ho

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Stefan Seefeld
Mihail Konstantinov wrote: One more question about the syntax. You cited http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/class.html#class_-spec which specifies the syntax as "class_" so that I thought I have to include all 4 template arguments. But when I used instead of the above (wor

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Mihail Konstantinov
> try use boost::noncopyable to B or implemente a copy constructor in B > without call A copy contructor. Thank you. This works: BOOST_PYTHON_MODULE(boost_ext) { class_ a("A",init<>()); class_, boost::noncopyable >("B",init<>()); } One more question about the syntax. You cited http://ww

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Stefan Seefeld
Mihail Konstantinov wrote: gcc.compile.c++ bin/gcc-4.1.2/debug/boost.o boost.cpp: In copy constructor ‘B::B(const B&)’: As this error message suggests: as B derives from A, it is (by default) non-copyable, too. That you have to tell python, too, thus: class_ a("A", init<>); class_, nonco

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Roman Yakovenko
On Tue, Dec 2, 2008 at 4:11 PM, Renato Araujo <[EMAIL PROTECTED]> wrote: > try use boost::noncopyable to B or implemente a copy constructor in B > without call A copy contructor. He is right. The following code was generated by Py++: #include "boost/python.hpp" namespace bp = boost::python; BOO

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Marcus Lindblom
Mihail Konstantinov wrote: Stefan Seefeld wrote: In this case you want to tell Python that your object is non-copyable: I followed your suggestion and still get the same error message: [snip] /home/mihail/temporary/boost_1_37_0/boost/python/object/value_holder.hpp: In constructor ‘boost

Re: [C++-sig] [py++] Problem: empty xml file created

2008-12-02 Thread Marcus Lindblom
Marcus Lindblom wrote: (I don't think the gccxml-call happens because of the call to the ModuleBuilder at line 813, although I might be wrong?) Waitaminute. When I'm rerunning it now, the order makes more sense, and the cache-calls come up after the calls to ModuleBuilder. Probably the log-f

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Renato Araujo
try use boost::noncopyable to B or implemente a copy constructor in B without call A copy contructor. BR On Tue, Dec 2, 2008 at 11:03 AM, Mihail Konstantinov <[EMAIL PROTECTED]> wrote: >> Stefan Seefeld wrote: > >> >> In this case you want to tell Python that your object is non-copyable: > > I

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Mihail Konstantinov
> Stefan Seefeld wrote: > > In this case you want to tell Python that your object is non-copyable: I followed your suggestion and still get the same error message: boost.cpp:6: error: ‘A::A(const A&)’ is private (full bjam output is appended to this email) Could you check this modified code? bo

Re: [C++-sig] [py++] Problem: empty xml file created

2008-12-02 Thread Marcus Lindblom
Roman Yakovenko wrote: On Tue, Dec 2, 2008 at 3:15 PM, Marcus Lindblom <[EMAIL PROTECTED]> wrote: Ok. It came right back at me: pyopensg/src> ** the above ** Could not determine compiler setting. Could not determine GCCXML_FLAGS setting. pyopensg/src> So, I changed it to run my compiled gccxml

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Stefan Seefeld
Mihail Konstantinov wrote: Hello, I am still in the early process of learning boost.python. I have reduced my problem to the following code: #include using namespace boost::python; class A{ private: A(const A&){}; //no public copy constructor }; class B: public A{ public: B(){}; }; BOOST_PY

Re: [C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Mihail Konstantinov
Sorry, the public A::A() constructor was missing. The corrected class A, which caused the described problem, is: class A{ private: A(const A&){}; //no public copy constructor public: A(){}; }; ___ Cplusplus-sig mailing list Cplusplus-sig@

Re: [C++-sig] [py++] Problem: empty xml file created

2008-12-02 Thread Roman Yakovenko
On Tue, Dec 2, 2008 at 3:15 PM, Marcus Lindblom <[EMAIL PROTECTED]> wrote: > Ok. It came right back at me: > > pyopensg/src> ** the above ** > Could not determine compiler setting. > Could not determine GCCXML_FLAGS setting. > pyopensg/src> > > So, I changed it to run my compiled gccxml (pretty rec

[C++-sig] boost.python: private copy constructor problem

2008-12-02 Thread Mihail Konstantinov
Hello, I am still in the early process of learning boost.python. I have reduced my problem to the following code: #include using namespace boost::python; class A{ private: A(const A&){}; //no public copy constructor }; class B: public A{ public: B(){}; }; BOOST_PYTHON_MODULE(boost_ext) {

Re: [C++-sig] [py++] Problem: empty xml file created

2008-12-02 Thread Marcus Lindblom
Roman Yakovenko wrote: 2008/12/2 Marcus Lindblom <[EMAIL PROTECTED]>: Hi all, I'm trying to get OpenSG's python-bindings to work on Windows (and contruibuting that back to the project), and trying to track down an exception that get's thrown when running it's gen_bindings.py. (see attached log.

Re: [C++-sig] [py++] Problem: empty xml file created

2008-12-02 Thread Roman Yakovenko
2008/12/2 Marcus Lindblom <[EMAIL PROTECTED]>: > Hi all, > > I'm trying to get OpenSG's python-bindings to work on Windows (and > contruibuting that back to the project), and trying to track down an > exception that get's thrown when running it's gen_bindings.py. (see attached > log.txt for output)

[C++-sig] [py++] Problem: empty xml file created

2008-12-02 Thread Marcus Lindblom
Hi all, I'm trying to get OpenSG's python-bindings to work on Windows (and contruibuting that back to the project), and trying to track down an exception that get's thrown when running it's gen_bindings.py. (see attached log.txt for output) The source for gen_bindings.py is here, for referen