[ndnSIM] The use of DidAddEntry and WillRemoveEntry

Spyridon (Spyros) Mastorakis mastorakis at cs.ucla.edu
Mon Dec 31 04:21:36 PST 2018


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



More information about the ndnSIM mailing list