[ndnSIM] A Problem About NS-3 Object

Alex Afanasyev alexander.afanasyev at ucla.edu
Sun Oct 27 21:32:05 PDT 2013


Hi!

I'm not sure how your code compiles.  "Ptr<InterestSatisfiedRate> interestSatisfiedRate = factory.Create();"  should fail, since "factory.Create()" creates Ptr<Object> which needs to be dynamically casted to be assigned as InterestSatisfiedRate.

If the code compiles but it fails at some point, my recommendation would be to use gdb to see what exactly is going wrong.

---
Alex

On Oct 26, 2013, at 8:38 PM, 乐舒原 <leshuyuan at 163.com> wrote:

> Hello Everybody:
> 	I'm a newer in learning ndnSIM adn ns-3.I have a problem about ns-3 object when I programming my own forwarding strategy imitating the PerOutFaceLimits class.The problem are as follow:
> 	Firstly,
> 	void MyFwStrategy_InterestRate::AddFace(Ptr<Face> face){ 
> 		NS_LOG_DEBUG("in addface");
>  		ObjectFactory factory;
> 		NS_LOG_DEBUG("in addface"); 
> 		const std::string typeId="ns3::ndn::InterestSat! isfiedRat e"; 
> 		NS_LOG_DEBUG("in addface"); 
> 		factory.setTypeId(typeId); 
> 		NS_LOG_DEBUG("in addface"); 
> 		Ptr<InterestSatisfiedRate> interestSatisfiedRate = factory.Create(); 
> 		NS_LOG_DEBUG("in addface");
> 		 face->AggregateObject( interestSatisfiedRate); 
> 	}
> 	The problem is the fifth Log didn't print.That means the problem happens when Create the InterestSatisfiedRate Object.
> Secondly,
> 	void MyFwStrategy_InterestRate::AddFace(Ptr<Face> face){
> 		NS_LOG_DEBUG("in addface");
> 		Ptr<InterestSatisfiedRate> interestSatisfiedRate =CreateObject<InterestSatisfiedRate>();
> 		NS_LOG_DEBUG("in addface");
> 		face->AggregateObject( interestSatisfiedRate);
> 		NS_LOG_DEBUG("in addface");
> 	}
> The problem is the third Log didn't print.That means the problem happens when the face aggretate  the InterestSatisfiedRate Object.
> 	Can someone help me solve the trouble?
> 	Thanks So Much!
> 	
> 
> 	
>  
> 
> 
> 
> _______________________________________________
> 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/20131027/2a3b872b/attachment.html>


More information about the ndnSIM mailing list