Quantcast

Nothing known about base class 'std::enable_shared_from_this

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Nothing known about base class 'std::enable_shared_from_this

Burlen Loring-2
Hi, I am trying to wrap some c++ code into python. The warning message is in the subject and full output below.

How do I wrap a class derived from std::enable_shared_from_this??

trying to tell swig about enable_shared_from_this results in parsing and compilation errors, it can't seem to find <memory> header from the stl. Do I have to tell swig about the path to system  headers??

one of my class hierarchy looks like
class teca_variant_array : public std::enable_shared_from_this<teca_variant_array>
{
....
};

template <typename T>
class teca_variant_array_impl : public std::enable_shared_from_this<teca_variant_array>
{
...
};
my swig file looks like this:
%include <std_shared_ptr.i>
%shared_ptr(teca_variant_array)
%shared_ptr(teca_variant_array_impl<char>)
%shared_ptr(teca_variant_array_impl<int>)
%shared_ptr(teca_variant_array_impl<long long>)
%shared_ptr(teca_variant_array_impl<float>)
%shared_ptr(teca_variant_array_impl<double>)                                                                                                                                 
%include "teca_common.h"
%include "teca_shared_object.h"
%include "teca_variant_array_fwd.h"
%ignore teca_variant_array::operator=;
%include "teca_variant_array.h"
%template(teca_variant_array_char) teca_variant_array_impl<char>;
%template(teca_variant_array_int) teca_variant_array_impl<int>;
%template(teca_variant_array_int64) teca_variant_array_impl<long long>;
%template(teca_variant_array_float) teca_variant_array_impl<float>;
%template(teca_variant_array_double) teca_variant_array_impl<double>;
The output from swig is:
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Nothing known about base class 'std::enable_shared_from_this< teca_variant_array >'. Ignored.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Maybe you forgot to instantiate 'std::enable_shared_from_this< teca_variant_array >' using %template.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
I tried to tell it about std::enable_shared_from_this in a template statement as the warning indicates, but this doesn't help, swig then complains that it doesn't know what enable_shared_from_this is, and I tried adding and include <memory> but it can't find the header....

Burlen

------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nothing known about base class'std::enable_shared_from_this

Andrew Haining


You’re not likely to be using the base members across the swig boundary so there’s no need for swig to know about the base class, if you want to though you could write a .i to wrap enable_shared_from_this, it’s quite a simple interface so should be possible but I’d suggest just hashing out the inheritance when swig is running is the easiest option, something along these lines:

 

class teca_variant_array

#ifndef SWIG
: public std::enable_shared_from_this<teca_variant_array>
#endif
{
};

 

From: Burlen Loring [mailto:[hidden email]]
Sent: 27 November 2015 19:01
To: [hidden email]
Subject: [Swig-user] Nothing known about base class 'std::enable_shared_from_this

 

Hi, I am trying to wrap some c++ code into python. The warning message is in the subject and full output below.

How do I wrap a class derived from std::enable_shared_from_this??

trying to tell swig about enable_shared_from_this results in parsing and compilation errors, it can't seem to find <memory> header from the stl. Do I have to tell swig about the path to system  headers??

one of my class hierarchy looks like

class teca_variant_array : public std::enable_shared_from_this<teca_variant_array>
{
....
};

template <typename T>
class teca_variant_array_impl : public std::enable_shared_from_this<teca_variant_array>
{
...
};

my swig file looks like this:

%include <std_shared_ptr.i>
%shared_ptr(teca_variant_array)
%shared_ptr(teca_variant_array_impl<char>)
%shared_ptr(teca_variant_array_impl<int>)
%shared_ptr(teca_variant_array_impl<long long>)
%shared_ptr(teca_variant_array_impl<float>)
%shared_ptr(teca_variant_array_impl<double>)                                                                                                                                 
%include "teca_common.h"
%include "teca_shared_object.h"
%include "teca_variant_array_fwd.h"
%ignore teca_variant_array::operator=;
%include "teca_variant_array.h"
%template(teca_variant_array_char) teca_variant_array_impl<char>;
%template(teca_variant_array_int) teca_variant_array_impl<int>;
%template(teca_variant_array_int64) teca_variant_array_impl<long long>;
%template(teca_variant_array_float) teca_variant_array_impl<float>;
%template(teca_variant_array_double) teca_variant_array_impl<double>;

The output from swig is:

/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Nothing known about base class 'std::enable_shared_from_this< teca_variant_array >'. Ignored.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Maybe you forgot to instantiate 'std::enable_shared_from_this< teca_variant_array >' using %template.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.

I tried to tell it about std::enable_shared_from_this in a template statement as the warning indicates, but this doesn't help, swig then complains that it doesn't know what enable_shared_from_this is, and I tried adding and include <memory> but it can't find the header....

Burlen

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

 

Digital Barriers e-Mail Confidentiality and Disclaimer

                   

This message contains confidential information and is intended only for the individual named. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

 

Digital Barriers plc is a company registered in England and Wales. Registered number: 7149547. Registered office: Cargo Works, 1-2 Hatfields, London SE1 9PG, United Kingdom. For further information about Digital Barriers, please visit www.digitalbarriers.com.

 


______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741551&iu=/4140
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nothing known about base class'std::enable_shared_from_this

Burlen Loring-2
Thanks for the pointers, your suggestions are very helpful!

I end up trying the preprocessor based solution first. removing the problematic code worked. Positively encouraged, I looked into swig's shared_ptr.i and std::enable_shared_from this class sources. it was easy enough to put something in my .i file (shown below) to satisfy swig.
namespace std {
    template <class T> class enable_shared_from_this {
    public:
        ~enable_shared_from_this();
        shared_ptr<T> shared_from_this();
        shared_ptr<const T> shared_from_this() const;
    protected:
        enable_shared_from_this();
        enable_shared_from_this(const enable_shared_from_this &);
    };
}
another (perhaps more important) issue I encountered was swig being confused by using statements like
using p_my_class = std::shared_ptr<my_class>;

template <typename T>
using p_my_class_impl = std::shared_ptr<my_class_impl<T>>;
any where one of these is used swig compiles (with copious warnings) but fails to produce the wrapped api. I found that I had to get rid of those statements and any use of them in the api.

I'm mentioning this because lack of seamless c++11 support should be on the radar. I am using the 3.0.7 version of swig. Hope it helps.

After these two issues, things seem to working well!

Thanks again
Burlen

On 11/30/2015 01:11 AM, Andrew Haining wrote:

You’re not likely to be using the base members across the swig boundary so there’s no need for swig to know about the base class, if you want to though you could write a .i to wrap enable_shared_from_this, it’s quite a simple interface so should be possible but I’d suggest just hashing out the inheritance when swig is running is the easiest option, something along these lines:

 

class teca_variant_array

#ifndef SWIG
: public std::enable_shared_from_this<teca_variant_array>
#endif
{
};

 

From: Burlen Loring [[hidden email]]
Sent: 27 November 2015 19:01
To: [hidden email]
Subject: [Swig-user] Nothing known about base class 'std::enable_shared_from_this

 

Hi, I am trying to wrap some c++ code into python. The warning message is in the subject and full output below.

How do I wrap a class derived from std::enable_shared_from_this??

trying to tell swig about enable_shared_from_this results in parsing and compilation errors, it can't seem to find <memory> header from the stl. Do I have to tell swig about the path to system  headers??

one of my class hierarchy looks like

class teca_variant_array : public std::enable_shared_from_this<teca_variant_array>
{
....
};

template <typename T>
class teca_variant_array_impl : public std::enable_shared_from_this<teca_variant_array>
{
...
};

my swig file looks like this:

%include <std_shared_ptr.i>
%shared_ptr(teca_variant_array)
%shared_ptr(teca_variant_array_impl<char>)
%shared_ptr(teca_variant_array_impl<int>)
%shared_ptr(teca_variant_array_impl<long long>)
%shared_ptr(teca_variant_array_impl<float>)
%shared_ptr(teca_variant_array_impl<double>)                                                                                                                                 
%include "teca_common.h"
%include "teca_shared_object.h"
%include "teca_variant_array_fwd.h"
%ignore teca_variant_array::operator=;
%include "teca_variant_array.h"
%template(teca_variant_array_char) teca_variant_array_impl<char>;
%template(teca_variant_array_int) teca_variant_array_impl<int>;
%template(teca_variant_array_int64) teca_variant_array_impl<long long>;
%template(teca_variant_array_float) teca_variant_array_impl<float>;
%template(teca_variant_array_double) teca_variant_array_impl<double>;

The output from swig is:

/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Nothing known about base class 'std::enable_shared_from_this< teca_variant_array >'. Ignored.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Maybe you forgot to instantiate 'std::enable_shared_from_this< teca_variant_array >' using %template.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.

I tried to tell it about std::enable_shared_from_this in a template statement as the warning indicates, but this doesn't help, swig then complains that it doesn't know what enable_shared_from_this is, and I tried adding and include <memory> but it can't find the header....

Burlen

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

 

Digital Barriers e-Mail Confidentiality and Disclaimer

                   

This message contains confidential information and is intended only for the individual named. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

 

Digital Barriers plc is a company registered in England and Wales. Registered number: 7149547. Registered office: Cargo Works, 1-2 Hatfields, London SE1 9PG, United Kingdom. For further information about Digital Barriers, please visit www.digitalbarriers.com.

 
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
hex
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nothing known about base class'std::enable_shared_from_this

hex
SWIG doesn't support alias declarations, refer http://www.swig.org/Doc3.0/CPlusPlus11.html#CPlusPlus11_alias_templates , please.

Possible solution is to use typedefs where possible. In your case solution may be something like typedef std::shared_ptr<my_classp_my_class;Please note, typedef doesn't support template arguments in identifiers as opposed to using.

2015-12-03 0:29 GMT+02:00 Burlen Loring <[hidden email]>:
Thanks for the pointers, your suggestions are very helpful!

I end up trying the preprocessor based solution first. removing the problematic code worked. Positively encouraged, I looked into swig's shared_ptr.i and std::enable_shared_from this class sources. it was easy enough to put something in my .i file (shown below) to satisfy swig.
namespace std {
    template <class T> class enable_shared_from_this {
    public:
        ~enable_shared_from_this();
        shared_ptr<T> shared_from_this();
        shared_ptr<const T> shared_from_this() const;
    protected:
        enable_shared_from_this();
        enable_shared_from_this(const enable_shared_from_this &);
    };
}
another (perhaps more important) issue I encountered was swig being confused by using statements like
using p_my_class = std::shared_ptr<my_class>;

template <typename T>
using p_my_class_impl = std::shared_ptr<my_class_impl<T>>;
any where one of these is used swig compiles (with copious warnings) but fails to produce the wrapped api. I found that I had to get rid of those statements and any use of them in the api.

I'm mentioning this because lack of seamless c++11 support should be on the radar. I am using the 3.0.7 version of swig. Hope it helps.

After these two issues, things seem to working well!

Thanks again
Burlen


On 11/30/2015 01:11 AM, Andrew Haining wrote:

You’re not likely to be using the base members across the swig boundary so there’s no need for swig to know about the base class, if you want to though you could write a .i to wrap enable_shared_from_this, it’s quite a simple interface so should be possible but I’d suggest just hashing out the inheritance when swig is running is the easiest option, something along these lines:

 

class teca_variant_array

#ifndef SWIG
: public std::enable_shared_from_this<teca_variant_array>
#endif
{
};

 

From: Burlen Loring [[hidden email]]
Sent: 27 November 2015 19:01
To: [hidden email]
Subject: [Swig-user] Nothing known about base class 'std::enable_shared_from_this

 

Hi, I am trying to wrap some c++ code into python. The warning message is in the subject and full output below.

How do I wrap a class derived from std::enable_shared_from_this??

trying to tell swig about enable_shared_from_this results in parsing and compilation errors, it can't seem to find <memory> header from the stl. Do I have to tell swig about the path to system  headers??

one of my class hierarchy looks like

class teca_variant_array : public std::enable_shared_from_this<teca_variant_array>
{
....
};

template <typename T>
class teca_variant_array_impl : public std::enable_shared_from_this<teca_variant_array>
{
...
};

my swig file looks like this:

%include <std_shared_ptr.i>
%shared_ptr(teca_variant_array)
%shared_ptr(teca_variant_array_impl<char>)
%shared_ptr(teca_variant_array_impl<int>)
%shared_ptr(teca_variant_array_impl<long long>)
%shared_ptr(teca_variant_array_impl<float>)
%shared_ptr(teca_variant_array_impl<double>)                                                                                                                                 
%include "teca_common.h"
%include "teca_shared_object.h"
%include "teca_variant_array_fwd.h"
%ignore teca_variant_array::operator=;
%include "teca_variant_array.h"
%template(teca_variant_array_char) teca_variant_array_impl<char>;
%template(teca_variant_array_int) teca_variant_array_impl<int>;
%template(teca_variant_array_int64) teca_variant_array_impl<long long>;
%template(teca_variant_array_float) teca_variant_array_impl<float>;
%template(teca_variant_array_double) teca_variant_array_impl<double>;

The output from swig is:

/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Nothing known about base class 'std::enable_shared_from_this< teca_variant_array >'. Ignored.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Maybe you forgot to instantiate 'std::enable_shared_from_this< teca_variant_array >' using %template.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.

I tried to tell it about std::enable_shared_from_this in a template statement as the warning indicates, but this doesn't help, swig then complains that it doesn't know what enable_shared_from_this is, and I tried adding and include <memory> but it can't find the header....

Burlen

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

 

Digital Barriers e-Mail Confidentiality and Disclaimer

                   

This message contains confidential information and is intended only for the individual named. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

 

Digital Barriers plc is a company registered in England and Wales. Registered number: 7149547. Registered office: Cargo Works, 1-2 Hatfields, London SE1 9PG, United Kingdom. For further information about Digital Barriers, please visit www.digitalbarriers.com.

 
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user



------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nothing known about base class'std::enable_shared_from_this

Burlen Loring-2
Please note, typedef doesn't support template arguments in identifiers as opposed to using.
yep, and that's why I'm mentioning. It requires me to touch a lot of code to make it work with swig.

On 12/03/2015 12:11 AM, Igor wrote:
SWIG doesn't support alias declarations, refer http://www.swig.org/Doc3.0/CPlusPlus11.html#CPlusPlus11_alias_templates , please.

Possible solution is to use typedefs where possible. In your case solution may be something like typedef std::shared_ptr<my_classp_my_class;Please note, typedef doesn't support template arguments in identifiers as opposed to using.

2015-12-03 0:29 GMT+02:00 Burlen Loring <[hidden email]>:
Thanks for the pointers, your suggestions are very helpful!

I end up trying the preprocessor based solution first. removing the problematic code worked. Positively encouraged, I looked into swig's shared_ptr.i and std::enable_shared_from this class sources. it was easy enough to put something in my .i file (shown below) to satisfy swig.
namespace std {
    template <class T> class enable_shared_from_this {
    public:
        ~enable_shared_from_this();
        shared_ptr<T> shared_from_this();
        shared_ptr<const T> shared_from_this() const;
    protected:
        enable_shared_from_this();
        enable_shared_from_this(const enable_shared_from_this &);
    };
}
another (perhaps more important) issue I encountered was swig being confused by using statements like
using p_my_class = std::shared_ptr<my_class>;

template <typename T>
using p_my_class_impl = std::shared_ptr<my_class_impl<T>>;
any where one of these is used swig compiles (with copious warnings) but fails to produce the wrapped api. I found that I had to get rid of those statements and any use of them in the api.

I'm mentioning this because lack of seamless c++11 support should be on the radar. I am using the 3.0.7 version of swig. Hope it helps.

After these two issues, things seem to working well!

Thanks again
Burlen


On 11/30/2015 01:11 AM, Andrew Haining wrote:

You’re not likely to be using the base members across the swig boundary so there’s no need for swig to know about the base class, if you want to though you could write a .i to wrap enable_shared_from_this, it’s quite a simple interface so should be possible but I’d suggest just hashing out the inheritance when swig is running is the easiest option, something along these lines:

 

class teca_variant_array

#ifndef SWIG
: public std::enable_shared_from_this<teca_variant_array>
#endif
{
};

 

From: Burlen Loring [[hidden email]]
Sent: 27 November 2015 19:01
To: [hidden email]
Subject: [Swig-user] Nothing known about base class 'std::enable_shared_from_this

 

Hi, I am trying to wrap some c++ code into python. The warning message is in the subject and full output below.

How do I wrap a class derived from std::enable_shared_from_this??

trying to tell swig about enable_shared_from_this results in parsing and compilation errors, it can't seem to find <memory> header from the stl. Do I have to tell swig about the path to system  headers??

one of my class hierarchy looks like

class teca_variant_array : public std::enable_shared_from_this<teca_variant_array>
{
....
};

template <typename T>
class teca_variant_array_impl : public std::enable_shared_from_this<teca_variant_array>
{
...
};

my swig file looks like this:

%include <std_shared_ptr.i>
%shared_ptr(teca_variant_array)
%shared_ptr(teca_variant_array_impl<char>)
%shared_ptr(teca_variant_array_impl<int>)
%shared_ptr(teca_variant_array_impl<long long>)
%shared_ptr(teca_variant_array_impl<float>)
%shared_ptr(teca_variant_array_impl<double>)                                                                                                                                 
%include "teca_common.h"
%include "teca_shared_object.h"
%include "teca_variant_array_fwd.h"
%ignore teca_variant_array::operator=;
%include "teca_variant_array.h"
%template(teca_variant_array_char) teca_variant_array_impl<char>;
%template(teca_variant_array_int) teca_variant_array_impl<int>;
%template(teca_variant_array_int64) teca_variant_array_impl<long long>;
%template(teca_variant_array_float) teca_variant_array_impl<float>;
%template(teca_variant_array_double) teca_variant_array_impl<double>;

The output from swig is:

/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Nothing known about base class 'std::enable_shared_from_this< teca_variant_array >'. Ignored.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:35: Warning 401: Maybe you forgot to instantiate 'std::enable_shared_from_this< teca_variant_array >' using %template.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array.h:262: Warning 315: Nothing known about 'enable_shared_from_this< teca_variant_array >::shared_from_this'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.
/home/bloring/work/teca/teca_arch/core/teca_variant_array_fwd.h:9: Warning 315: Nothing known about 'std::shared_ptr< teca_variant_array_impl< T > >'.

I tried to tell it about std::enable_shared_from_this in a template statement as the warning indicates, but this doesn't help, swig then complains that it doesn't know what enable_shared_from_this is, and I tried adding and include <memory> but it can't find the header....

Burlen

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

 

Digital Barriers e-Mail Confidentiality and Disclaimer

                   

This message contains confidential information and is intended only for the individual named. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

 

Digital Barriers plc is a company registered in England and Wales. Registered number: 7149547. Registered office: Cargo Works, 1-2 Hatfields, London SE1 9PG, United Kingdom. For further information about Digital Barriers, please visit www.digitalbarriers.com.

 
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user




------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nothing known about base class'std::enable_shared_from_this

schullq
Re-uping this post.

When I try Burlen Loring-2s solution, but when I write:

namespace std {
    template <class T> class enable_shared_from_this {
    public:
        ~enable_shared_from_this();
        shared_ptr<T> shared_from_this();
        shared_ptr<const T> shared_from_this() const;
    protected:
        enable_shared_from_this();
        enable_shared_from_this(const enable_shared_from_this &);
    };
}

in my .i file, it works but instead of some warning saying that all my enable_shared will be ignored, I have a lot of errors saying std::enable_shared_from_this<MyClass>::~enable_shared_from_this' : cannot access protected member declared in class 'std::enable_shared_from_this<logicalaccess::MyClass>.

I know that the real implementation of enable_shared_from_this provides a protected destructor, but I don't get why SWIG does'nt take the one I wrote in the interface, since he knows nothing about the real one...

Any clue ?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nothing known about base class'std::enable_shared_from_this

William S Fulton


On 10 May 2017 at 13:22, schullq <[hidden email]> wrote:
Re-uping this post.

When I try Burlen Loring-2s solution, but when I write:

namespace std {
    template <class T> class enable_shared_from_this {
    public:
        ~enable_shared_from_this();
        shared_ptr<T> shared_from_this();
        shared_ptr<const T> shared_from_this() const;
    protected:
        enable_shared_from_this();
        enable_shared_from_this(const enable_shared_from_this &);
    };
}

in my .i file, it works but instead of some warning saying that all my
enable_shared will be ignored, I have a lot of errors saying
std::enable_shared_from_this<MyClass>::~enable_shared_from_this' : cannot
access protected member declared in class
'std::enable_shared_from_this<logicalaccess::MyClass>.

I know that the real implementation of enable_shared_from_this provides a
protected destructor, but I don't get why SWIG does'nt take the one I wrote
in the interface, since he knows nothing about the real one...

You need to elaborate on exactly what code you are feeding SWIG. I suspect you have some sort of ordering problem resulting in missing type information.

I would just ignore the base instead. Here is a cutdown example:

%include <std_shared_ptr.i>

%warnfilter(SWIGWARN_TYPE_UNDEFINED_CLASS) SharedFromThis;
%shared_ptr(SharedFromThis)

%inline %{
#include <memory>

struct SharedFromThis: std::enable_shared_from_this<SharedFromThis> {
  int val;
  SharedFromThis(int val = 0) : val(val) {}
  std::shared_ptr<SharedFromThis> GetPointer() {
    return shared_from_this();
  }
};
 
%}

William

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Loading...