[ndnSIM] Setting a custom policy for Content Store

Alex Afanasyev aa at CS.UCLA.EDU
Tue Nov 15 21:38:42 PST 2016


Hi John,

You have a small issue in your implementation of JPBPolicy.  If you haven't, you need to define the default constructor and in the default constructor use ``Policy::Policy(const std::string&)`` to initialize the base class.  You can see the example in other policies:

    LruPolicy::LruPolicy()
       : Policy(POLICY_NAME)
     {
     }

The reason is that each policy has to have a name, which is enforced by the deleted default constructor of the base class.

--
Alex

> On Nov 16, 2016, at 1:44 PM, John Baugh <jpbaugh at umich.edu> wrote:
> 
> Greetings all,
> 
> See the error(s) I'm getting below from my Google Drive:
> https://drive.google.com/open?id=1Ni2wc7mSecJR-1KseA_1k4oDKoXuJJrGNtwXl6sHnrA <https://drive.google.com/open?id=1Ni2wc7mSecJR-1KseA_1k4oDKoXuJJrGNtwXl6sHnrA>
> 
> Here's the code:
> https://drive.google.com/open?id=0By9ufeKqmJYYOThERVMtOVo2STA <https://drive.google.com/open?id=0By9ufeKqmJYYOThERVMtOVo2STA>
> 
> Thanks,
> 
> John
> 
> On Mon, Nov 14, 2016 at 3:02 AM, Alex Afanasyev <aa at cs.ucla.edu <mailto:aa at cs.ucla.edu>> wrote:
> Hi John,
> 
> Can you post the exact error you're getting (if it is too long, you can use pastebin.com <http://pastebin.com/>).  If you also can share the snippet that reproduces the problem, it would be much faster to debug the issue and suggest the solution.
> 
> --
> Alex
> 
>> On Nov 14, 2016, at 3:53 PM, John Baugh <jpbaugh at umich.edu <mailto:jpbaugh at umich.edu>> wrote:
>> 
>> I am trying code like so:
>> 
>> unique_ptr<nfd::cs::Policy> policy(new JPBPolicy());
>> 
>> myContentStore.setPolicy(policy);
>> 
>> I'm getting tons of errors.  It doesn't like any of the conversions I'm trying to perform...  It may be a misunderstanding of some of the techniques used with managed/smart pointers in terms of polymorphic references, but something's not working.
>> 
>> I want to create a subclass of Policy in order to override functions such as doAfterInsert(iterator i);
>> 
>> In my derived class (subclass), I did provide a body for all the pure virtual methods from the documentation of Policy.
>> 
>> But I think the problem is the conversion.  Is there some way to do this with say, static_cast ?
>> 
>> Thanks,
>> 
>> John
> 

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


More information about the ndnSIM mailing list