Monday, December 18, 2017

[Discuss-gnuradio] Instantiating a C++ object derived from `boost::enable_shared_from_this' from Python

Hi all,
I am trying to instantiate a C++ object from Python as follows.

This is my .H file:

/***********************/

#ifndef INCLUDED_COMMON_MODULES_COVERT_CONSTELLATION_H
#define INCLUDED_COMMON_MODULES_COVERT_CONSTELLATION_H

#include <common_modules/api.h>
#include <gnuradio/gr_complex.h>
#include <vector>
#include <boost/enable_shared_from_this.hpp>
#include <gnuradio/math.h>

namespace gr {
    namespace common_modules {

        /*!
        * \brief Covert constellation
        *
        */
        class covert_constellation;
        typedef boost::shared_ptr<covert_constellation> constellation_sptr;

        class COMMON_MODULES_API covert_constellation : public
boost::enable_shared_from_this<covert_constellation> {

        protected:
            std::vector<gr_complex> d_points;

        public:

            covert_constellation(
                std::vector<gr_complex> points
            );
            covert_constellation();

            virtual ~covert_constellation();

            gr_complex get_point_from_value(unsigned int value);
            virtual unsigned int decision_maker(const gr_complex
*sample) = 0;
            constellation_sptr base() { return shared_from_this(); }

        };

        class COMMON_MODULES_API constellation_cbpsk : public
covert_constellation {

        public:

            typedef boost::shared_ptr<constellation_cbpsk> sptr;

            // public constructor
            static sptr make();

            ~constellation_cbpsk();

            unsigned int decision_maker(const gr_complex *sample);

        protected:

            constellation_cbpsk();
    };


        class COMMON_MODULES_API constellation_cqpsk : public
covert_constellation {

        public:
            typedef boost::shared_ptr<constellation_cqpsk> sptr;

            // public constructor
            static sptr make();

            ~constellation_cqpsk();

            unsigned int decision_maker(const gr_complex *sample);

        protected:

            constellation_cqpsk();
        };

  } // namespace common_modules
} // namespace gr

No comments:

Post a Comment