[Ns-developers] How to serialize a array

Nuno Farias farias at fe.up.pt
Mon Dec 22 02:58:16 PST 2008


Hi!

I having a problem that probably has a very easy solution but I don't 
know how to solve it.

Basically I have a class (here is resumed):

class PREQElement
{
public:
 PREQElement ();

 uint8_t m_pdflags;
 Mac48Address m_destinationaddress;
 uint64_t m_destinationseqnum;

 uint32_t GetSerializedSize (void) const
 { return 1+6+8;}

 void Serialize (Buffer::Iterator start) const
 {
   i.WriteU8(m_pdflags);
   WriteTo (i, m_destinationaddress);
   i.WriteU64 (m_destinationseqnum);
 }

 Buffer::Iterator Deserialize (Buffer::Iterator start)
 {
   m_pdflags = i.ReadU8 ();
   ReadFrom (i, m_destinationaddress);
   m_destinationaddress = i.ReadU64 ();
 }
};

and in other class called "class PREQElement :: public Header" I have to 
do a

PREQElement example[50];

How do I serialize this? I can't just call serialize... How can I do it?

Sorry if this is very easy.

Thanks,
Nuno.


More information about the Ns-developers mailing list