[ndnSIM] Conversion from ns3::Application to specific application type.

Junxiao Shi shijunxiao at email.arizona.edu
Sat Dec 19 15:00:49 PST 2015


Hi Anil

To get Ptr<ConsumerCbr> from Ptr<Application>, you may use type-casting or
->GetObject<ConsumerCbr>().

The proper way to set a parameter onto an application object is through
ns-3 attributes.

See ns-3 Manual <
https://www.nsnam.org/docs/release/3.24/manual/html/index.html> "Object
Model" and "Configuration and Attributes" section for more information.

Yours, Junxiao
On Dec 19, 2015 3:45 PM, "Anil Jangam" <anilj.mailing at gmail.com> wrote:

> Hi,
>
> In a scenario where an application instance is installed on the nodes,
> what is the way to retrieve that application instance from the node?
>
> 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).
>
> In an example below:
>  80   ndn::AppHelper consumerHelper("ns3::ndn::ConsumerCbr");
>  83   consumerHelper.Install(consumerNodes);
>
> I want to retrieve back the instance of "ns3::ndn::ConsumerCbr" from the
> consumerNodes object.
>
> I checked the API in bit details, the ndn-app-helper has this code:
> 119   Ptr<Application> app = m_factory.Create<Application>();
> 120   node->AddApplication(app);
>
> The node interface also provides an API GetApplication, but it returns
> Application instance:
> 160 Ptr<Application>
> 161 Node::GetApplication (uint32_t index) const
>
> How to convert it from ns3::Application to ns3::ndn::ConsumerCbr? Perhaps
> this is simple type casting operation, but just want to confirm it.
>
> Any other suggestion to achieve the same (i.e. updating the application
> instance installed on the node) is also fine with me.
>
> /anil.
>
>
>
> _______________________________________________
> 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/20151219/78cd76ae/attachment.html>


More information about the ndnSIM mailing list