[C++-sig] Boost Python private members problem
Eduardo Picado
eduardo.picado at gmail.com
Tue Aug 22 15:45:01 CEST 2006
Hi,
I'm facing a problem with the last module I need to compile with Boost Python.
I receive this compilation error:
Compiling...(with vc-8_0)
TASRLogger.cpp
C:\Python24\include\TASRLogger.hpp(353) : error C2248:
'TASRLogger::TASRLogger' : cannot access private member declared in
class 'TASRLogger'
C:\Python24\include\TASRLogger.hpp(37) : see declaration of
'TASRLogger::TASRLogger'
C:\Python24\include\TASRLogger.hpp(33) : see declaration of 'TASRLogger'
This diagnostic occurred in the compiler generated function
'TASRDefaultLogger::TASRDefaultLogger(const TASRDefaultLogger &)'
It's hard find a solution for the problem as I don't have the sources
for the dll. Otherwise I could at least change the member attributes
visibility.
Is there a workaround for it?
I tried to extract the relevant parts from the files.
The TASRLogger.hpp I'm trying to wrap:
class TASRLoggerInternal;
class TASRDefaultLoggerInternal;
struct GrammarsInternal;
/**
* Base virtual class for session loggers.
* The TASRLogger specifies all methods a session logger should implement.
*/
class TASRLogger {
TASRLoggerInternal * _logger;
TASRLogger(TASRLogger const &);
public:
TASRLogger() throw (std::bad_alloc);
virtual ~TASRLogger();
};
/**
* Default implementation for simple session loggers.
*/
class TASRDefaultLogger : public TASRLogger {
TASRDefaultLoggerInternal * data;
TASRDefaultLogger(TASRDefaultLogger const &);
public:
TASRDefaultLogger(size_t diskMinFreeSize = 10000, bool
hierarchical = true, TASRString const & root = "")
throw (std::bad_alloc, TASRDirectoryAccessError);
~TASRDefaultLogger();
};
The TASRLogger.cpp:
// Boost Includes ==============================================================
#include <boost/python.hpp>
#include <boost/cstdint.hpp>
// Includes ====================================================================
#include <TASRLogger.hpp>
// Using =======================================================================
using namespace boost::python;
// Declarations ================================================================
namespace {
struct TASRLogger_Wrapper: TASRLogger
{
TASRLogger_Wrapper(PyObject* py_self_):
TASRLogger(), py_self(py_self_) {}
PyObject* py_self;
};
struct TASRDefaultLogger_Wrapper: TASRDefaultLogger
{
TASRDefaultLogger_Wrapper(PyObject* py_self_, const TASRDefaultLogger& p0):
TASRDefaultLogger(p0), py_self(py_self_) {}
TASRDefaultLogger_Wrapper(PyObject* py_self_):
TASRDefaultLogger(), py_self(py_self_) {}
TASRDefaultLogger_Wrapper(PyObject* py_self_, size_t p0):
TASRDefaultLogger(p0), py_self(py_self_) {}
TASRDefaultLogger_Wrapper(PyObject* py_self_, size_t p0, bool p1):
TASRDefaultLogger(p0, p1), py_self(py_self_) {}
TASRDefaultLogger_Wrapper(PyObject* py_self_, size_t p0, bool p1,
const TASRString& p2):
TASRDefaultLogger(p0, p1, p2), py_self(py_self_) {}
PyObject* py_self;
};
}// namespace
// Module ======================================================================
BOOST_PYTHON_MODULE(TASRLogger)
{
scope* TASRLogger_scope = new scope(
class_< TASRLogger, boost::noncopyable, TASRLogger_Wrapper
>("TASRLogger", init< >())
);
delete TASRLogger_scope;
class_< TASRDefaultLogger, bases< TASRLogger > ,
TASRDefaultLogger_Wrapper >("TASRDefaultLogger", init< const
TASRDefaultLogger& >())
.def(init< optional< size_t, bool, const TASRString& > >())
;
}
Thanks,
Eduardo Picado
--
Eduardo PICADO
MSN eduardo.picado at gmail.com
portable +33 6 32 47 10 10 (NEW)
fix +33 1 45 03 52 54
|̲̅<̲̅Θ̲̅>̲̅|
More information about the Cplusplus-sig
mailing list