Make sure the result of the lookup is valid!
Best regards,
Marcus
Hi Sean,
it's been a while since I did that, but I think that "smart_ptr<A> cannot be casted to smart_ptr<B>" can be remedied using Boost's pointer_cast[1].
Hope that gives you a start.
Best regards,
Marcus
[1] http://www.boost.org/doc/libs/1_60_0/libs/smart_ptr/pointer_cast.html
On 01/28/2016 08:34 PM, Nowlan, Sean wrote:
I have a USRP with a GPSDO. I am working on a block that will poll a USRP for PPS changes in an attempt to adjust for clock offset between host and USRP. Assume I have explicitly set the USRP time-of-day correctly to UTC using PPS and a set_time_next_pps_call, and GPS is locked.
I would like to pass a USRP sink (or source) shared pointer to this block. It will have its own internal thread that will loop waiting for PPS edge transitions, polling with get_time_now, and then measuring offset between PC/system clock and USRP clock.
Following guidance from a mailing list thread [1], I attempted to pass a usrp_sink shared pointer as a basic_block_sptr and then dynamic_cast it in the block xtor. Here's the error I get:
clock_manager_impl.cc: In constructor 'gr::mymodule::clock_manager_impl::clock_manager_impl(gr::basic_block_sptr, double, const string&)':
clock_manager_impl.cc:50:59: error: cannot dynamic_cast 'usrp' (of type 'gr::basic_block_sptr {aka class boost::shared_ptr<gr::basic_block>}') to type 'gr::uhd::usrp_sink::sptr {aka class boost::shared_ptr<gr::uhd::usrp_sink>}' (target is not pointer or reference)
d_usrp(dynamic_cast<gr::uhd::usrp_sink::sptr>(usrp)),
Any advice on the best way to do this? Is my approach sane?
Thanks,
Sean
_______________________________________________ Discuss-gnuradio mailing list Discuss-gnuradio@gnu.org https://lists.gnu.org/mailman/listinfo/discuss-gnuradio
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
No comments:
Post a Comment