<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hi,</p>
<p>Seems to be working using <br>
</p>
<p><i>m_scheduler.scheduleEvent(time::seconds(10),</i></p>
<p><i> [this,&name]
{this->delayedInterest(name);});</i><br>
</p>
Regards,<br>
Junior<br>
<br>
<div class="moz-cite-prefix">On 12/04/2017 10:54 PM, Junior DONGO
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:dbac14b4-51fd-b12d-a0d5-447cac555cde@lacl.fr">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<p>Hi, <br>
</p>
<p>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)</p>
<p>When trying to schedule a new event using this code:</p>
<p> m_scheduler.scheduleEvent(time::seconds(10),<br>
bind(&ConsumerWithTimer::delayedInterest, ref(name)));<br>
</p>
<p>I get this compilation error: <br>
</p>
<p><i>../examples/consumer-with-timer.cpp: In member function
‘void ndn::examples::ConsumerWithTimer::run()’:</i><i><br>
</i><i>../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)’</i><i><br>
</i><i>
bind(&ConsumerWithTimer::delayedInterest, this));</i><i><br>
</i><i>
^</i><i><br>
</i><i>../examples/consumer-with-timer.cpp:62:78: note:
candidate is:</i><i><br>
</i><i>In file included from
../examples/consumer-with-timer.cpp:28:0:</i><i><br>
</i><i>/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&)</i><i><br>
</i><i> scheduleEvent(time::nanoseconds after, const
EventCallback& callback);</i><i><br>
</i><i> ^</i><i><br>
</i><i>/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()>&}’</i><i><br>
</i><i>../examples/consumer-with-timer.cpp: In member function
‘void ndn::examples::ConsumerWithTimer::delayedInterest(const
ndn::Name&)’:</i><i><br>
</i><i>../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)’</i><i><br>
</i><i>
bind(&ConsumerWithTimer::delayedInterest, ref(name)));</i><i><br>
</i><i>
^</i><i><br>
</i><i>../examples/consumer-with-timer.cpp:111:83: note:
candidate is:</i><i><br>
</i><i>In file included from
../examples/consumer-with-timer.cpp:28:0:</i><i><br>
</i><i>/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&)</i><i><br>
</i><i> scheduleEvent(time::nanoseconds after, const
EventCallback& callback);</i><i><br>
</i><i> ^</i><i><br>
</i><i>/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()>&}’</i><br>
</p>
<p>Any idea? <br>
</p>
<p>How can I schedule an event using methods with parameters? <br>
</p>
<p>Thanks</p>
<p>Junior<br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Ndn-interest mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Ndn-interest@lists.cs.ucla.edu">Ndn-interest@lists.cs.ucla.edu</a>
<a class="moz-txt-link-freetext" href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest">http://www.lists.cs.ucla.edu/mailman/listinfo/ndn-interest</a>
</pre>
</blockquote>
<br>
</body>
</html>