[Ns-developers] How to serialize a array

Providence SALUMU MUNGA psalumu at gmail.com
Mon Dec 22 04:22:50 PST 2008


Hi,

Le Mon, 22 Dec 2008 10:58:16 +0000,
Nuno Farias <farias at fe.up.pt> a écrit :

> PREQElement example[50];
> 
> How do I serialize this? I can't just call serialize... How can I do
> it?

Here is how I would serialize that array:

PREQElement example[50];

Buffer myBuffer;
/* Assuming GetSerializedSize() is static */
buffer.AddAtStart (50 * PREQElement::GetSerializedSize ()); 
Buffer::Iterator i = myBuffer.Begin ();

for (uint32_t j = 0, j < 50, j++)
{
  example[i].Serialize (i);
}

Not sure it works with your code, but the whole principle is there
in. Hope it will help.

Please, consider posting to ns-3-users <ns-3-users at googlegroups.com>
next time.

Regards,

-- 
Providence SALUMU M.

Doctorant, Département Logiciels-Réseaux
TELECOM SudParis

"If you can't be strong, be clever, and make peace with someone who is
strong. But it's always better to be strong yourself! Always!" -- B.O.
LowLow.



More information about the Ns-developers mailing list