[Ndn-interest] ndn-cxx examples update error

Junior DONGO junior.dongo at lacl.fr
Tue Dec 5 03:49:34 PST 2017


Hi,

Seems to be working using

/m_scheduler.scheduleEvent(time::seconds(10),/

/                                            [this,&name] 
{this->delayedInterest(name);});/

Regards,
Junior

On 12/04/2017 10:54 PM, Junior DONGO wrote:
>
> 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
>
>
>
> _______________________________________________
> Ndn-interest mailing list
> Ndn-interest at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest

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


More information about the Ndn-interest mailing list