[ndnSIM] Modifying pit structure

Alex Afanasyev aa at cs.fiu.edu
Mon May 4 10:40:27 PDT 2020


Do you really want to modify PIT entry? If you simply need to store additional information alongside each/specific PIT entries that your strategy uses, NFD has a mechanism for that.   You just need to implement a class derived from StrategyInfo and add it/look it up from the entry when needed.  Example of this is in the AccessStrategy (https://github.com/named-data/NFD/blob/master/daemon/fw/access-strategy.hpp#L73 <https://github.com/named-data/NFD/blob/master/daemon/fw/access-strategy.hpp#L73>), so you can do similar stuff.

As for the error, you have used a wrong member class selector. With "." you are trying to access members of "shared_ptr" class.  If you replace with "->", you will be access the right thing.

-
Alex

> On May 4, 2020, at 1:31 PM, nabil khemache via ndnSIM <ndnsim at lists.cs.ucla.edu> wrote:
> 
> Hello to all
> I'm trying to modify the pit-entry structure, and i've started with something very simple, just one private integer and two member function (set and get).
> 
> In the pit-entry. hpp i've done this:
> public:
>   public:
>   void
>   setinteger(int value)
>   {
>     m_integer=value;
>   }
> 
>   int
>   getinteger() const
>   {
>     return m_integer;
>   }
> and this
> private:
>   shared_ptr<const Interest> m_interest;
>   InRecordCollection m_inRecords;
>   OutRecordCollection m_outRecords;
>   name_tree::Entry* m_nameTreeEntry;
>   int m_integer;
> also i've modified the constructor to initialize the value, so in the pit-entry.cpp i did this:
> namespace nfd {
> namespace pit {
> 
> Entry::Entry(const Interest& interest)
>   : isSatisfied(false)
>   , dataFreshnessPeriod(0_ms)
>   , m_interest(interest.shared_from_this())
>   , m_nameTreeEntry(nullptr)
>   , m_integer(0)
> {
> 
> }
> like you see, it's a very basic modification, but when i try to call one of those member functions, like, in the MulticastStrategy functions: 
> void
> MulticastStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
>                                         const shared_ptr<pit::Entry>& pitEntry)
> {
>    
>             pitEntry.m_integer=100;
> 
> 
> I get this error message : 
> [2365/3208] Compiling src/ndnSIM/NFD/daemon/fw/multicast-strategy.cpp
> ../src/ndnSIM/NFD/daemon/fw/multicast-strategy.cpp: In member function ‘virtual void nfd::fw::MulticastStrategy::afterReceiveInterest(const nfd::face::Face&, const ndn::Interest&, const std::shared_ptr<nfd::pit::Entry>&)’:
> ../src/ndnSIM/NFD/daemon/fw/multicast-strategy.cpp:122:22: error: ‘const class std::shared_ptr<nfd::pit::Entry>’ has no member named ‘setinteger’
>              pitEntry.setinteger(100);
>                       ^
> 
> If anyone can help, i would be very grateful.
> thanks in advance
> 
> 
> 
> 
> 
> 
> 
> 
> 
> _______________________________________________
> 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/20200504/821ba4e1/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1683 bytes
Desc: not available
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20200504/821ba4e1/attachment-0001.p7s>


More information about the ndnSIM mailing list