[Ndn-interest] ndn-cxx examples update error

Junior DONGO junior.dongo at lacl.fr
Mon Dec 4 13:54:31 PST 2017


Hi,

I am trying to modify the example "consumer-with-timer" in ndn-cxx to be 
able to set a parameter name on the delayInterest method so it will look 
like delayedInterest(const Name& name)

When trying to schedule a new event using this code:

m_scheduler.scheduleEvent(time::seconds(10),
bind(&ConsumerWithTimer::delayedInterest, ref(name)));

I get this compilation error:

/../examples/consumer-with-timer.cpp: In member function ‘void 
ndn::examples::ConsumerWithTimer::run()’://
//../examples/consumer-with-timer.cpp:62:78: error: no matching function 
for call to 
‘ndn::util::scheduler::Scheduler::scheduleEvent(boost::chrono::seconds, 
std::_Bind_helper<false, void 
(ndn::examples::ConsumerWithTimer::*)(const ndn::Name&), 
ndn::examples::ConsumerWithTimer* const>::type)’//
//bind(&ConsumerWithTimer::delayedInterest, this));//
//^//
//../examples/consumer-with-timer.cpp:62:78: note: candidate is://
//In file included from ../examples/consumer-with-timer.cpp:28:0://
///home/ubuntu/ndn-cxx/src/util/scheduler.hpp:135:3: note: 
ndn::util::scheduler::EventId 
ndn::util::scheduler::Scheduler::scheduleEvent(boost::chrono::nanoseconds, 
const EventCallback&)//
//   scheduleEvent(time::nanoseconds after, const EventCallback& 
callback);//
//   ^//
///home/ubuntu/ndn-cxx/src/util/scheduler.hpp:135:3: note: no known 
conversion for argument 2 from ‘std::_Bind_helper<false, void 
(ndn::examples::ConsumerWithTimer::*)(const ndn::Name&), 
ndn::examples::ConsumerWithTimer* const>::type {aka 
std::_Bind<std::_Mem_fn<void (ndn::examples::ConsumerWithTimer::*)(const 
ndn::Name&)>(ndn::examples::ConsumerWithTimer*)>}’ to ‘const 
EventCallback& {aka const std::function<void()>&}’//
//../examples/consumer-with-timer.cpp: In member function ‘void 
ndn::examples::ConsumerWithTimer::delayedInterest(const ndn::Name&)’://
//../examples/consumer-with-timer.cpp:111:83: error: no matching 
function for call to 
‘ndn::util::scheduler::Scheduler::scheduleEvent(boost::chrono::seconds, 
std::_Bind_helper<false, void 
(ndn::examples::ConsumerWithTimer::*)(const ndn::Name&), 
std::reference_wrapper<const ndn::Name> >::type)’//
//bind(&ConsumerWithTimer::delayedInterest, ref(name)));//
//^//
//../examples/consumer-with-timer.cpp:111:83: note: candidate is://
//In file included from ../examples/consumer-with-timer.cpp:28:0://
///home/ubuntu/ndn-cxx/src/util/scheduler.hpp:135:3: note: 
ndn::util::scheduler::EventId 
ndn::util::scheduler::Scheduler::scheduleEvent(boost::chrono::nanoseconds, 
const EventCallback&)//
//   scheduleEvent(time::nanoseconds after, const EventCallback& 
callback);//
//   ^//
///home/ubuntu/ndn-cxx/src/util/scheduler.hpp:135:3: note: no known 
conversion for argument 2 from ‘std::_Bind_helper<false, void 
(ndn::examples::ConsumerWithTimer::*)(const ndn::Name&), 
std::reference_wrapper<const ndn::Name> >::type {aka 
std::_Bind<std::_Mem_fn<void (ndn::examples::ConsumerWithTimer::*)(const 
ndn::Name&)>(std::reference_wrapper<const ndn::Name>)>}’ to ‘const 
EventCallback& {aka const std::function<void()>&}’/

Any idea?

How can I schedule an event using methods with parameters?

Thanks

Junior

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndn-interest/attachments/20171204/7f4d1a80/attachment.html>


More information about the Ndn-interest mailing list