[C++-sig] EXTERNAL: Re: pygccxml KeyError

Davidson, Josh josh.davidson at lmco.com
Mon Dec 19 23:05:06 CET 2011


Including everything into a single header does work, so it looks like there is a problem with the joining process.  Well, it builds anyways.  I still get compilation error W1050 telling me that I didn't specify a call policies (I did and they show up in the generated code).

These are the Py++ settings I'm using for this minimal example:

        mb.code_creator.add_include("model_io/storage/SharedMemoryBuilder.hpp")
        mb.code_creator.add_include("boost/interprocess/managed_shared_memory.hpp")
        mb.code_creator.add_include("string")

        mb.class_("SpaceWireStore").member_functions(lambda decl: decl.name.startswith("getUrgent")).call_policies = \
            call_policies.return_value_policy(call_policies.reference_existing_object)
        mb.class_("SpaceWireStore").member_functions(lambda decl: decl.name.startswith("getNormal")).call_policies = \
            call_policies.return_value_policy(call_policies.reference_existing_object)     

Here are the 4 header files that when used together will reproduce the issue: SharedMemoryDeleter.hpp, SharedMemoryBuilder.hpp, DiscreteStore.hpp, & SpaceWireStore.hpp

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ifndef SHAREDMEMORYDELETER_HPP_
#define SHAREDMEMORYDELETER_HPP_

#include <string>
class SharedMemoryDeleter {
public:
    SharedMemoryDeleter(const std::string& name);
    ~SharedMemoryDeleter();
protected:
    std::string mName;
};

#endif /* SHAREDMEMORYDELETER_HPP_ */
---------------------------------------------------------------------------------------------------------------------

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ifndef SHAREDMEMORYBUILDER_HPP_
#define SHAREDMEMORYBUILDER_HPP_

#include <iosfwd>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/shared_ptr.hpp>

#include "SharedMemoryDeleter.hpp"

class SharedMemoryBuilder {
public:
    SharedMemoryBuilder(const std::string& name, size_t num_bytes);
    virtual ~SharedMemoryBuilder();
    boost::shared_ptr<boost::interprocess::managed_shared_memory> getSegment();
protected:
    SharedMemoryDeleter mDeleter;
    boost::shared_ptr<boost::interprocess::managed_shared_memory> mSegment;
};

#endif /* SHAREDMEMORYBUILDER_HPP_ */
---------------------------------------------------------------------------------------------------------------------

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ifndef SHAREDMEMORYBUILDER_HPP_
#define SHAREDMEMORYBUILDER_HPP_

#include <iosfwd>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/shared_ptr.hpp>

#include "SharedMemoryDeleter.hpp"

class SharedMemoryBuilder {
public:
    SharedMemoryBuilder(const std::string& name, size_t num_bytes);
    virtual ~SharedMemoryBuilder();
    boost::shared_ptr<boost::interprocess::managed_shared_memory> getSegment();
protected:
    SharedMemoryDeleter mDeleter;
    boost::shared_ptr<boost::interprocess::managed_shared_memory> mSegment;
};

#endif /* SHAREDMEMORYBUILDER_HPP_ */
---------------------------------------------------------------------------------------------------------------------

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#ifndef DISCRETESTORE_HPP_
#define DISCRETESTORE_HPP_

#include <stdint.h>

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/offset_ptr.hpp>
#include <boost/interprocess/containers/list.hpp>

#include <boost/interprocess/allocators/allocator.hpp>

class DiscreteStore {
public:

    enum {
        NUM_BUFFERS = 4
    };
    DiscreteStore();
    ~DiscreteStore();
    void frameTransition();
    bool getSimicsInput();
    void setSimicsOutput(bool isHigh);
    bool getSimInput();
    void setSimOutput(bool isHigh);

protected:
    bool mIsHigh[NUM_BUFFERS];
    size_t mSimicsInIndex;
    size_t mSimicsOutIndex;
    size_t mSimInIndex;
    size_t mSimOutIndex;
};

#endif /* DISCRETESTORE_HPP_ */
---------------------------------------------------------------------------------------------------------------------
-----Original Message-----
From: cplusplus-sig-bounces+josh.davidson=lmco.com at python.org [mailto:cplusplus-sig-bounces+josh.davidson=lmco.com at python.org] On Behalf Of Roman Yakovenko
Sent: Monday, December 19, 2011 1:35 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] EXTERNAL: Re: pygccxml KeyError

On Mon, Dec 19, 2011 at 10:24 PM, Davidson, Josh <josh.davidson at lmco.com> wrote:
> Actually, it is using a source_reader_t by default.  __parse_declarations invokes __parse_file_by_file, which uses a source_reader_t (line 236) to parse each file.  It then bombs out after parsing all of the files when it calls _join_class_hierarchy.
>
> I continue to have this issue with various combinations of classes.  In other words, I have headers that work fine with parsed in isolation, but when I try to build a module containing both, I get the KeyError.

Can you create a single header file, which includes all others?

HTH
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig


More information about the Cplusplus-sig mailing list