/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2008 INRIA
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
 */
#include "tag.h"
#include "ns3/uinteger.h"
namespace ns3 {

NS_OBJECT_ENSURE_REGISTERED (Tag)
  ;

TypeId 
Tag::GetTypeId (void)
{
  static TypeId tid = TypeId ("ns3::Tag")
    .SetParent<ObjectBase> ()
  ;
  return tid;
}


TypeId 
MyFlowTag1::GetTypeId (void)
{
  static TypeId tid = TypeId ("ns3::MyFlowTag1")
    .SetParent<Tag> ()
    .AddConstructor<MyFlowTag1> ()
    .AddAttribute ("SimpleValue",
                   "A simple value",
                   EmptyAttributeValue (),
                   MakeUintegerAccessor (&MyFlowTag1::GetSimpleValue),
                   MakeUintegerChecker<uint8_t> ())
  ;
  return tid;
}
TypeId 
MyFlowTag1::GetInstanceTypeId (void) const
{
  return GetTypeId ();
}
uint32_t 
MyFlowTag1::GetSerializedSize (void) const
{
  return 1;
}
void 
MyFlowTag1::Serialize (TagBuffer i) const
{
  i.WriteU8 (m_simpleValue);
}
void 
MyFlowTag1::Deserialize (TagBuffer i)
{
  m_simpleValue = i.ReadU8 ();
}
void 
MyFlowTag1::Print (std::ostream &os) const
{
  os << "v=" << (uint32_t)m_simpleValue;
}
void 
MyFlowTag1::SetSimpleValue (uint8_t value)
{
  m_simpleValue = value;
}
uint8_t 
MyFlowTag1::GetSimpleValue (void) const
{
  return m_simpleValue;
}

} // namespace ns3
