Forum: GNU Radio how to import a class in python

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C369ebbe1655201988e376af57460f23?d=identicon&s=25 Achilleas Anastasopoulos (Guest)
on 2006-05-03 19:01
(Received via mailing list)
I have developed a simple class "howto_object"
(which does not do anything at this point...)
and now I want to make it part of gnuradio/howto,
so that I can "see" it in python when I am
doing "from gnuradio import howto"
This class is not derived from gr_block and the rest,
so I am not sure what the right wrapping should be...

I attach the code.

Thanks
Achilleas

----------------howto_object.h---------------
#ifndef INCLUDED_HOWTO_OBJECT_H
#define INCLUDED_HOWTO_OBJECT_H

class howto_object {
private:
   int d_I;
public:
   int I () const { return d_I; }
   howto_object(const int I);
   howto_object();
};

#endif
-----------------------------------------------


----------------howto_object.cc---------------
#include "howto_object.h"

howto_object::howto_object(const int I)
{
   d_I=I;
}

howto_object::howto_object()
{
   d_I=0;
}

-----------------------------------------------
745d8202ef5a58c1058d0e5395a78f9c?d=identicon&s=25 Eric Blossom (Guest)
on 2006-05-03 20:03
(Received via mailing list)
On Tue, May 02, 2006 at 03:21:05PM -0400, Achilleas Anastasopoulos
wrote:
> Thanks
>   int I () const { return d_I; }
>   howto_object(const int I);
>   howto_object();
> };
>
> #endif

A .i file with either of these will probably work:

class howto_object {
private:
  int d_I;
public:
  int I () const { return d_I; }
  howto_object(const int I);
  howto_object();
};


or

class howto_object {
public:
  int I () const { return d_I; }
  howto_object(const int I);
  howto_object();
};

FYI, the SWIG docs are pretty good.
See www.swig.org

Eric
This topic is locked and can not be replied to.