src/common/trailer.h
changeset 150 663120712cd9
parent 131 f4fb87e77034
child 180 3e6bfa625fb7
equal deleted inserted replaced
149:d5b12472c5e2 150:663120712cd9
     1 /* -*- Mode:NS3; -*- */
     1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
     2 /*
     2 /*
     3  * Copyright (c) 2005 INRIA
     3  * Copyright (c) 2005 INRIA
     4  * All rights reserved.
     4  * All rights reserved.
     5  *
     5  *
     6  * This program is free software; you can redistribute it and/or modify
     6  * This program is free software; you can redistribute it and/or modify
    39  *   - ns3::Trailer::GetSerializedSize
    39  *   - ns3::Trailer::GetSerializedSize
    40  *   - ns3::Trailer::PrintTo
    40  *   - ns3::Trailer::PrintTo
    41  */
    41  */
    42 class Trailer {
    42 class Trailer {
    43 public:
    43 public:
    44     Trailer ();
    44   Trailer ();
    45     /**
    45   /**
    46      * Derived classes must provide an explicit virtual destructor
    46    * Derived classes must provide an explicit virtual destructor
    47      */
    47    */
    48     virtual ~Trailer () = 0;
    48   virtual ~Trailer () = 0;
    49 
    49 
    50     void Print (std::ostream &os) const;
    50   void Print (std::ostream &os) const;
    51     uint32_t GetSize (void) const;
    51   uint32_t GetSize (void) const;
    52     void Serialize (Buffer::Iterator start) const;
    52   void Serialize (Buffer::Iterator start) const;
    53     void Deserialize (Buffer::Iterator start);
    53   void Deserialize (Buffer::Iterator start);
    54     bool IsDeserialized (void) const;
    54   bool IsDeserialized (void) const;
    55 private:
    55 private:
    56     bool m_isDeserialized;
    56   bool m_isDeserialized;
    57     /**
    57   /**
    58      * \param os the std output stream in which this 
    58    * \param os the std output stream in which this 
    59      *       protocol trailer must print itself.
    59    *       protocol trailer must print itself.
    60      */
    60    */
    61     virtual void PrintTo (std::ostream &os) const = 0;
    61   virtual void PrintTo (std::ostream &os) const = 0;
    62 
    62 
    63     /**
    63   /**
    64      * \returns the size of the serialized Trailer.
    64    * \returns the size of the serialized Trailer.
    65      */
    65    */
    66     virtual uint32_t GetSerializedSize (void) const = 0;
    66   virtual uint32_t GetSerializedSize (void) const = 0;
    67 
    67 
    68     /**
    68   /**
    69      * \param start the buffer iterator in which the protocol trailer
    69    * \param start the buffer iterator in which the protocol trailer
    70      *    must serialize itself.
    70    *    must serialize itself.
    71      */
    71    */
    72     virtual void SerializeTo (Buffer::Iterator start) const = 0;
    72   virtual void SerializeTo (Buffer::Iterator start) const = 0;
    73     /**
    73   /**
    74      * \param start the buffer iterator from which the protocol trailer must
    74    * \param start the buffer iterator from which the protocol trailer must
    75      *    deserialize itself.
    75    *    deserialize itself.
    76      */
    76    */
    77     virtual void DeserializeFrom (Buffer::Iterator start) = 0;
    77   virtual void DeserializeFrom (Buffer::Iterator start) = 0;
    78 };
    78 };
    79 
    79 
    80 std::ostream& operator<< (std::ostream& os, Trailer const& trailer);
    80 std::ostream& operator<< (std::ostream& os, Trailer const& trailer);
    81 
    81 
    82 }; // namespace ns3
    82 }; // namespace ns3