src/common/tag.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri, 10 Aug 2007 13:17:57 +0200
changeset 1260 b24477e66df7
parent 1253 a2d362dd86b5
child 2834 1aab57845b07
permissions -rw-r--r--
avoid output of spurious whitespaces during testing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1233
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2006 INRIA
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 * All rights reserved.
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 *
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License version 2 as
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 * published by the Free Software Foundation;
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 *
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 * GNU General Public License for more details.
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 *
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 *
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
 */
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#ifndef TAG_H
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
#define TAG_H
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
1242
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    24
#include <stdint.h>
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    25
#include <string>
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    26
1236
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    27
/**
1253
a2d362dd86b5 use full reference for \relates tag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1242
diff changeset
    28
 * \relates ns3::Tag
1236
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    29
 * \brief this macro should be instantiated exactly once for each
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    30
 *        new type of Tag
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    31
 *
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    32
 * This macro will ensure that your new Tag type is registered
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    33
 * within the tag registry. In most cases, this macro
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    34
 * is not really needed but, for safety, please, use it all the
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    35
 * time.
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    36
 *
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    37
 * Note: This macro is _absolutely_ needed if you try to run a
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    38
 * distributed simulation.
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    39
 */
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    40
#define NS_TAG_ENSURE_REGISTERED(x)	       \
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    41
static class thisisaveryverylongclassname ##x  \
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    42
{					       \
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    43
 public:				       \
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    44
  thisisaveryverylongclassname ##x ()          \
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    45
    { uint32_t uid; uid = x::GetUid ();}       \
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    46
} g_thisisanotherveryveryverylongname ## x;
cfa5e0b39281 rework the NS_XX_ENSURE_REGISTERED macros and make sure we typecheck the input to TraceContext::Add and TraceContext::Get methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1233
diff changeset
    47
1233
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
namespace ns3 {
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
1242
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    50
/**
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    51
 * \brief a tag can be stored in a packet.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    52
 *
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    53
 * A tag is a blob of 16 bytes of data which can be stored in
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    54
 * a packet: a packet can contain an arbitrary number of tags
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    55
 * and these tags are considered as "on-the-side" per-packet
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    56
 * data structures which are not taken into account when calculating
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    57
 * the size of the payload of a packet. They exist solely as 
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    58
 * simulation-specific objects.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    59
 *
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    60
 * Tags are typically used to:
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    61
 *   - implement per-packet cross-layer communication
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    62
 *   - implement packet coloring: you could store a "color" tag
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    63
 *     in a packet to mark various types of packet for
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    64
 *     simulation analysis
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    65
 *
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    66
 * To create a new type of tag, you must create a subclass
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    67
 * of the Tag base class which defines:
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    68
 *  - a public default constructor: needed for implementation
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    69
 *    purposes of the Packet code.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    70
 *  - a public copy constructor: needed to copy a tag into
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    71
 *    a packet tag buffer when the user invokes Packet::AddTag
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    72
 *  - a public destructor: needed to destroy the copy of a tag
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    73
 *    stored in a packet buffer when the user invokes Packet::RemoveTag
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    74
 *    or when the packet is destroyed and the last reference to 
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    75
 *    a tag instance disapears.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    76
 *  - a public static method named GetUid: needed to uniquely
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    77
 *    the type of each tag instance.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    78
 *  - a public method named Print: needed to print the content
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    79
 *    of a tag when the user calls Packet::PrintTags
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    80
 *  - a public method named GetSerializedSize: needed to serialize
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    81
 *    the content of a tag to a byte buffer when a packet must
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    82
 *    be sent from one computing node to another in a parallel 
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    83
 *    simulation. If this method returns 0, it means that the
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    84
 *    tag does not need to be transfered from computing node to 
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    85
 *     computing node
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    86
 *  - a public method named Serialize: perform the serialization
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    87
 *    to a byte buffer upon transfer to a new computing node in a 
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    88
 *    parallel simulation.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    89
 *  - a public method named Deserialize: invert the serialization
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    90
 *    from a byte buffer after being transfered to a new computing
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    91
 *    node in a parallel simulation.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    92
 *
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    93
 * A detailed example of what these methods should look like
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    94
 * and how they should be implemented is described in samples/main-packet-tag.cc
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    95
 */
1233
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
class Tag
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
{
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
protected:
1242
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
    99
  /**
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
   100
   * \param name the unique name of the new type of tag
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
   101
   * \returns a newly-allocated uid
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
   102
   *
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
   103
   * This method should be used by subclasses to implement
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
   104
   * their static public GetUid method.
ec55d8913759 Tag doxygen documentation
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1236
diff changeset
   105
   */
1233
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
  template <typename T>
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
  static uint32_t AllocateUid (std::string name);
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
};
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
} // namespace ns3
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
// implementation below.
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
#include "tag-registry.h"
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
namespace ns3 {
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
template <typename T>
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
uint32_t
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
Tag::AllocateUid (std::string name)
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
{
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
  return TagRegistry::Register<T> (name);
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
}
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
} // namespace ns3
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
dade465d569d introduce Tag base class similar to Header and Trailer
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
#endif /* TAG_H */