<div dir="ltr"><div><div>Thanks Junxiao,<br><br></div>I did not understand how Application object is installed using AddApplication() in the Install() method of AppHelper and yet it can be retrieved by node->GetObject<ConsumerCbr>(). This API is not symmetric but it working! <br><br>->GetObject<ConsumerCbr>(), I think is typically used when the object is added to the node by aggregate() function, isn't it? <br><br></div><div>Since the install uses AddApplication() I think we can use GetApplication() to get reference to installed application. My type casting is failing at compile time. <br><br><div style="margin-left:40px">error: invalid conversion from ‘ns3::Application*’ to ‘ns3::ndn::NlsrApp*’ [-fpermissive]<br><br></div>The corresponding line is. So what kind of type casting required here? </div><div><div style="margin-left:40px"> Ptr<ndn::NlsrApp> nlsrApp = (Ptr<ndn::NlsrApp>) (*i)->GetApplication(0);<br><br></div>AFA setting attributes is concerned, I do not know how it works. I want to set the config object into the application used inside the application's logic. To give an analogy, I am trying to set the configuration object inside the app::RealApp. <br></div><div>I have exact same implementation as given here: <a href="http://ndnsim.net/2.1/guide-to-simulate-real-apps.html">http://ndnsim.net/2.1/guide-to-simulate-real-apps.html</a> (Read from : How to simulate real applications...)<br></div><div><br></div><div>/anil.<br><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 19, 2015 at 3:00 PM, Junxiao Shi <span dir="ltr"><<a href="mailto:shijunxiao@email.arizona.edu" target="_blank">shijunxiao@email.arizona.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>Hi Anil</p>
<p>To get Ptr<ConsumerCbr> from Ptr<Application>, you may use type-casting or ->GetObject<ConsumerCbr>().</p>
<p>The proper way to set a parameter onto an application object is through ns-3 attributes.</p>
<p>See ns-3 Manual <<a href="https://www.nsnam.org/docs/release/3.24/manual/html/index.html" target="_blank">https://www.nsnam.org/docs/release/3.24/manual/html/index.html</a>> "Object Model" and "Configuration and Attributes" section for more information.</p>
<p>Yours, Junxiao</p>
<div class="gmail_quote"><div><div class="h5">On Dec 19, 2015 3:45 PM, "Anil Jangam" <<a href="mailto:anilj.mailing@gmail.com" target="_blank">anilj.mailing@gmail.com</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div><div><div><div><div><div><div>Hi,<br><br></div>In a scenario where an application instance is installed on the nodes, what is the way to retrieve that application instance from the node?<br><br></div><div>In my requirement, I want to set some parameters into my application object, which is not possible at the time it is installed on the node. Perhaps they all do not use the parametrized constructor (I am talking about the classes in ns-3/src/ndnSIM/apps path). <br></div><div><br>In an example below:<br><div style="margin-left:40px"> 80   ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");<br> 83   consumerHelper.Install(consumerNodes);<br></div><br></div>I want to retrieve back the instance of "ns3::ndn::ConsumerCbr" from the consumerNodes object. <br><br></div>I checked the API in bit details, the ndn-app-helper has this code:<br><div style="margin-left:40px">119   Ptr<Application> app = m_factory.Create<Application>();<br>120   node->AddApplication(app);<br></div><br></div>The node interface also provides an API GetApplication, but it returns Application instance:<br><div style="margin-left:40px">160 Ptr<Application><br>161 Node::GetApplication (uint32_t index) const<br></div><br></div>How to convert it from ns3::Application to ns3::ndn::ConsumerCbr? Perhaps this is simple type casting operation, but just want to confirm it. <br><br></div><div>Any other suggestion to achieve the same (i.e. updating the application instance installed on the node) is also fine with me.<br><br></div></div>/anil.<br><br><div><div><div><div><br></div></div></div></div></div>
<br></div></div>_______________________________________________<br>
ndnSIM mailing list<br>
<a href="mailto:ndnSIM@lists.cs.ucla.edu" target="_blank">ndnSIM@lists.cs.ucla.edu</a><br>
<a href="http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim" rel="noreferrer" target="_blank">http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim</a><br>
<br></blockquote></div>
</blockquote></div><br></div>