Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #64916

boost-python: exposing constructor with an array of other class as argument

Path csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ester.lopezberga@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.042
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'argument': 0.05; 'constructor': 0.09; 'namespace': 0.09; 'template': 0.14; 'subject:array': 0.16; 'subject:class': 0.16; 'typedef': 0.16; 'x1,': 0.16; 'subject:python': 0.16; "i've": 0.25; 'second': 0.26; 'tried': 0.27; 'idea': 0.28; 'array': 0.29; 'message- id:@mail.gmail.com': 0.30; 'subject:other': 0.31; 'class': 0.32; 'figure': 0.32; 'there,': 0.34; 'subject:with': 0.35; "can't": 0.35; 'classes': 0.35; 'definition': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'thanks': 0.36; 'should': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'conversion': 0.61; 'first': 0.61; 'different': 0.65; 'results': 0.69; 'expose': 0.84; 'init())': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=kM2B8Sy+zfsa56ezRaP+irwyuZpLsvUFWdSCH8eMrYM=; b=GMce5z4WqJXUXnn1Oq8Y3klcGgUf6SZB/cOzRsWX5vbg/2PA4Wugytx9XC7NucFJVN ndLYo+X4x0AmSOZ5Iy+mDhrMmxEp2wNZnkbwaTCfGzXoUhVmekoJa7WFuk5/X98VjFnA VxkOreNUWTL9dHNFUO1ZLCgiAx1re1RrmTqy1tGdiCMsImGhMxtvMeeQ8A40oDpYd4jK txl99/MHFDl3RugHn2jOTDCf5Q5zLG/chg7JyEMkj5g6pxsaOW+GAIXmi98Kxtt/YaVT Nm3kPxCPkfXSE7u3tidjaADA0t48G4x8PhNIos2kezuLPVEz6vNF4I3D4vL8/cbCM8el 2piA==
MIME-Version 1.0
X-Received by 10.204.109.139 with SMTP id j11mr1458bkp.171.1390930331199; Tue, 28 Jan 2014 09:32:11 -0800 (PST)
Date Tue, 28 Jan 2014 18:32:11 +0100
Subject boost-python: exposing constructor with an array of other class as argument
From Ester Lopez <ester.lopezberga@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-Mailman-Approved-At Tue, 28 Jan 2014 19:41:41 +0100
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.6078.1390934503.18130.python-list@python.org> (permalink)
Lines 44
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1390934503 news.xs4all.nl 2866 [2001:888:2000:d::a6]:41185
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:64916

Show key headers only | View raw


Hello there,

I have two different classes that I want to expose using boost-python,
but the constructor of the second class takes and array of the first
one as argument and I can't figure out how to do it.

This is the definition of the classes:

    class INT96{
    public:
        uint64_t value[3];
        INT96(){};
        INT96(uint64_t x0, uint64_t x1, uint64_t x2);
        ...
    };
    template <unsigned k>
    class Xi_CW{
        protected:
            INT96 A[k];
        public:
            Xi_CW(INT96 (&A)[k]);
            ...
    };

And my attempt to expose them using boost-python:

    using namespace boost::python;
    typedef Xi_CW<4> Xi_CW4;
    BOOST_PYTHON_MODULE(xis)
    {
        class_<INT96>("INT96", init<double,double,double>())
            [...]
        ;
        class_<Xi_CW4>("Xi_CW4", init<INT96[4]>())
            [...]
        ;
    }

Which results in a "no known conversion error". I've tried several
other possibilities but so far no luck...

Any idea how should I do it? Thanks

Ester

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

boost-python: exposing constructor with an array of other class as argument Ester Lopez <ester.lopezberga@gmail.com> - 2014-01-28 18:32 +0100

csiph-web