[ndnSIM] The use of DidAddEntry and WillRemoveEntry

Boubakr Nour n.boubakr at outlook.com
Mon Dec 31 18:32:03 PST 2018


Thank you for your help.


From: Spyridon (Spyros) Mastorakis<mailto:mastorakis at cs.ucla.edu>
Sent: Monday, December 31, 2018 20:21
To: Boubakr Nour<mailto:n.boubakr at outlook.com>
Cc: Ndnsim<mailto:ndnsim at lists.cs.ucla.edu>
Subject: Re: [ndnSIM] The use of DidAddEntry and WillRemoveEntry

Hi,

these 2 callbacks are different. The error message tells you the reason: the signature of your callback does not match the expected signature.

“DidAddEntry” does not require the third argument (i.e., Time lifetime).

Thanks,

Spyridon (Spyros) Mastorakis
Personal Website: http://cs.ucla.edu/~mastorakis/
Internet Research Laboratory
Computer Science Department
UCLA

> On Dec 28, 2018, at 10:46 AM, Boubakr Nour <n.boubakr at outlook.com> wrote:
>
> Hello,
>
> I am trying to use "DidAddEntry" and "WillRemoveEntry". I defined my functions and config statements as follows:
>
> void CacheEntryAdded(std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime) {
> std::cout << lifetime.ToDouble(Time::S) << "\tAdd\t" << entry->GetName() << std::endl;
> }
>
> void CacheEntryRemoved(std::string context, Ptr<const ndn::cs::Entry> entry, Time lifetime) {
> std::cout << lifetime.ToDouble(Time::S) << "\tRemove\t" << entry->GetName() << std::endl;
> }
>
> ...
>
> ndnHelper.SetOldContentStore("ns3::ndn::cs::Stats", "MaxSize", "10");
> ndnHelper.InstallAll();
>
> Config::Connect("/NodeList/*/$ns3::ndn::cs::Stats::Lru/WillRemoveEntry", MakeCallback(CacheEntryRemoved));
> Config::Connect("/NodeList/*/$ns3::ndn::cs::Lru::LifetimeStats/DidAddEntry", MakeCallback(CacheEntryAdded));
>
>
> But I am getting this error:
>
> msg="Incompatible types. (feed to "c++filt -t" if needed)
> got=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::ndn::cs::Entry const>,ns3::Time>
> expected=CallbackImpl<void,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >,ns3::Ptr<ns3::ndn::cs::Entry const>>", file=./ns3/callback.h, line=1449
> msg="when connecting to /NodeList/0/$ns3::ndn::cs::Lru::LifetimeStats/DidAddEntry", file=./ns3/traced-callback.h, line=280
> terminate called without an active exception
>
> However, when I use only "WillRemoveEntry", I can get the output successfully.
>
> Regards,
> Boubakr
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20190101/748b2fb7/attachment.html>


More information about the ndnSIM mailing list