src/core/type-id.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Thu, 17 Apr 2008 15:30:18 -0700
changeset 2969 9d05d2a95dfa
parent 2965 4b28e9740e3b
child 3070 45d8e899c535
permissions -rw-r--r--
improve the auto-generated doxygen output.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2671
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     2
/*
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     3
 * Copyright (c) 2008 INRIA
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     4
 *
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     7
 * published by the Free Software Foundation;
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     8
 *
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    12
 * GNU General Public License for more details.
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    13
 *
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    14
 * You should have received a copy of the GNU General Public License
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    15
 * along with this program; if not, write to the Free Software
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    17
 *
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7fa114622a4d add missing license headers.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
    19
 */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#ifndef TYPE_ID_H
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#define TYPE_ID_H
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include "attribute.h"
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "attribute-accessor-helper.h"
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include "attribute-helper.h"
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
#include "callback.h"
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
#include <string>
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
#include <stdint.h>
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
namespace ns3 {
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
class ObjectBase;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
class TraceSourceAccessor;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
/**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
 * \brief a unique identifier for an interface.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
 *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
 * This class records a lot of meta-information about a 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
 * subclass of the Object base class:
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
 *  - the base class of the subclass
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
 *  - the set of accessible constructors in the subclass
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
 *  - the set of 'attributes' accessible in the subclass
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
 */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
class TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
{
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
public:
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
  enum {
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
    /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
     * The attribute can be read
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
     */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
    ATTR_GET = 1<<0,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
    /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
     * The attribute can be written
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
     */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
    ATTR_SET = 1<<1,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
    /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
     * The attribute can be written at construction-time.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
     */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
    ATTR_CONSTRUCT = 1<<2,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
    /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
     * The attribute can be read, and written at any time.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
     */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
    ATTR_SGC = ATTR_GET | ATTR_SET | ATTR_CONSTRUCT,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
  };
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
   * \param name the name of the requested TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
   * \returns the unique id associated with the requested
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
   *          name. 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
   * This method cannot fail: it will crash if the input 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
   * name is not a valid TypeId name.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
  static TypeId LookupByName (std::string name);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
   * \param name the name of the requested TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
   * \param tid a pointer to the TypeId instance where the 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
   *        result of this function should be stored.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
   * \returns true if the requested name was found, false otherwise.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
  static bool LookupByNameFailSafe (std::string name, TypeId *tid);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
   * \returns the number of TypeId instances registered.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
  static uint32_t GetRegisteredN (void);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
   * \param i index
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    89
   * \returns the TypeId instance whose index is i.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    90
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
  static TypeId GetRegistered (uint32_t i);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
   * \param name the name of the interface to construct.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
   * No two instances can share the same name. The name is expected to be
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
   * the full c++ typename of associated c++ object.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
  TypeId (const char * name);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
   * \returns the parent of this TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
   * This method cannot fail. It will return itself
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
   * if this TypeId has no parent. i.e., it is at the top
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
   * of the TypeId hierarchy. Currently, this is the
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
   * case for the TypeId associated to the Object class 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
   * only.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
  TypeId GetParent (void) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   112
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   113
   * \param other a parent TypeId
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   114
   * \returns true if the input TypeId is really a parent
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   115
   *          of this TypeId, false otherwise.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   116
   *
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   117
   * Calling this method is roughly similar to calling dynamic_cast
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   118
   * except that you do not need object instances: you can do the check
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   119
   * with TypeId instances instead.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   120
   */
2641
0bc8caf4f355 add TypeId::IsChildOf
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   121
  bool IsChildOf (TypeId other) const;
0bc8caf4f355 add TypeId::IsChildOf
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   122
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
   * \returns the name of the group associated to this TypeId.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
  std::string GetGroupName (void) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
   * \returns the name of this interface.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
  std::string GetName (void) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
   * \returns true if this TypeId has a constructor
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
  bool HasConstructor (void) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
   * \returns the number of attributes associated to this TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   140
   */
2693
56e28e34e109 TypeId::GetAttributeListN -> TypeId::GetAttributeN
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2671
diff changeset
   141
  uint32_t GetAttributeN (void) const;
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   143
   * \param i index into attribute array
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
   * \returns the name associated to the attribute whose
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
   *          index is i.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   147
  std::string GetAttributeName (uint32_t i) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   148
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   149
   * \param i index into attribute array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   150
   * \returns the help text associated to the attribute whose
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   151
   *          index is i.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   152
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
  std::string GetAttributeHelp (uint32_t i) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
   * \param i index into attribute array
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
   * \returns the full name associated to the attribute whose
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
   *          index is i.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
  std::string GetAttributeFullName (uint32_t i) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   161
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   162
   * \param i index into attribute array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   163
   * \returns the value with which the associated attribute 
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   164
   *          is initialized.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   165
   */
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2939
diff changeset
   166
  Ptr<const AttributeValue> GetAttributeInitialValue (uint32_t i) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   167
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   168
   * \param i index into attribute array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   169
   * \returns the flags associated to the requested attribute.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   170
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
  uint32_t GetAttributeFlags (uint32_t i) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   172
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   173
   * \param i index into attribute array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   174
   * \returns the checker associated to the requested attribute.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   175
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   176
  Ptr<const AttributeChecker> GetAttributeChecker (uint32_t i) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   177
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   178
   * \param i index into attribute array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   179
   * \returns the accessor associated to the requested attribute.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   180
   */
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   181
  Ptr<const AttributeAccessor> GetAttributeAccessor (uint32_t i) const;
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   182
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   183
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   184
   * \returns a callback which can be used to instanciate an object
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   185
   *          of this type.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   186
   */
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   187
  Callback<ObjectBase *> GetConstructor (void) const;
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   188
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   189
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   190
   * \returns true if this TypeId should be hidden from the user, 
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   191
   *          false otherwise.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   192
   */
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   193
  bool MustHideFromDocumentation (void) const;
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   194
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   195
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   196
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   197
   * \returns the number of trace sources defined in this TypeId.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   198
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   199
  uint32_t GetTraceSourceN (void) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   200
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   201
   * \param i index into trace source array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   202
   * \returns the name of the requested trace source.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   203
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   204
  std::string GetTraceSourceName (uint32_t i) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   205
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   206
   * \param i index into trace source array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   207
   * \returns the help text of the requested trace source.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   208
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   209
  std::string GetTraceSourceHelp (uint32_t i) const;
2648
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   210
  /**
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   211
   * \param i index into trace source array.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   212
   * \returns the accessor used to get access to the requested
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   213
   *          trace source.
736213ce179d improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2644
diff changeset
   214
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   215
  Ptr<const TraceSourceAccessor> GetTraceSourceAccessor (uint32_t i) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   216
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   217
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   218
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   219
   * \param tid the TypeId of the base class.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
   * \return this TypeId instance.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
   * Record in this TypeId which TypeId is the TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
   * of the base class of the subclass.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   224
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
  TypeId SetParent (TypeId tid);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
   * \return this TypeId instance.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
   * Record in this TypeId which TypeId is the TypeId
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
   * of the base class of the subclass.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  template <typename T>
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
  TypeId SetParent (void);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
   * \param groupName the name of the group this TypeId belongs to.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
   * \returns this TypeId instance.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   238
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
   * The group name is purely an advisory information used to 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
   * group together types according to a user-specific grouping
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   241
   * scheme.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   242
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   243
  TypeId SetGroupName (std::string groupName);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   244
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   245
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
   * \returns this TypeId instance
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   247
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   248
   * Record in this TypeId the fact that the default constructor
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   249
   * is accessible.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   250
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   251
  template <typename T>
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
  TypeId AddConstructor (void);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   253
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   254
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   255
   * \param name the name of the new attribute
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   256
   * \param help some help text which describes the purpose of this
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   257
   *        attribute.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
   * \param initialValue the initial value for this attribute.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   259
   * \param accessor an instance of the associated AttributeAccessor subclass.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   260
   * \param checker an instance of the associated AttributeChecker subclass.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   261
   * \returns this TypeId instance
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   263
   * Record in this TypeId the fact that a new attribute exists.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   264
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   265
  TypeId AddAttribute (std::string name,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   266
                       std::string help, 
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2939
diff changeset
   267
                       const AttributeValue &initialValue,
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   268
                       Ptr<const AttributeAccessor> accessor,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   269
                       Ptr<const AttributeChecker> checker);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   270
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   271
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
   * \param name the name of the new attribute
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   273
   * \param help some help text which describes the purpose of this
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   274
   *        attribute
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   275
   * \param flags flags which describe how this attribute can be read and/or written.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   276
   * \param initialValue the initial value for this attribute.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   277
   * \param accessor an instance of the associated AttributeAccessor subclass.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   278
   * \param checker an instance of the associated AttributeChecker subclass.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   279
   * \returns this TypeId instance
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   280
   *
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   281
   * Record in this TypeId the fact that a new attribute exists.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   282
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   283
  TypeId AddAttribute (std::string name,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   284
                       std::string help, 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   285
                       uint32_t flags,
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2939
diff changeset
   286
                       const AttributeValue &initialValue,
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   287
                       Ptr<const AttributeAccessor> accessor,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   288
                       Ptr<const AttributeChecker> checker);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   289
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   290
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   291
   * \param name the name of the new trace source
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   292
   * \param help some help text which describes the purpose of this
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   293
   *        trace source.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   294
   * \param accessor a pointer to a TraceSourceAccessor which can be
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   295
   *        used to connect/disconnect sinks to this trace source.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   296
   * \returns this TypeId instance.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   297
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   298
  TypeId AddTraceSource (std::string name,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   299
                         std::string help,
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   300
                         Ptr<const TraceSourceAccessor> accessor);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   301
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   302
  TypeId HideFromDocumentation (void);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   303
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   304
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   305
   * \brief store together a set of attribute properties.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   306
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   307
  struct AttributeInfo {
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   308
    // The accessor associated to the attribute.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   309
    Ptr<const AttributeAccessor> accessor;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   310
    // The initial value associated to the attribute.
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2939
diff changeset
   311
    Ptr<const AttributeValue> initialValue;
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   312
    // The set of access control flags associated to the attribute.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   313
    uint32_t flags;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   314
    // The checker associated to the attribute.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   315
    Ptr<const AttributeChecker> checker;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   316
  };
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   317
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   318
   * \param name the name of the requested attribute
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   319
   * \param info a pointer to the TypeId::AttributeInfo data structure
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   320
   *        where the result value of this method will be stored.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   321
   * \returns true if the requested attribute could be found, false otherwise.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   322
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   323
  bool LookupAttributeByName (std::string name, struct AttributeInfo *info) const;
2719
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   324
  /**
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   325
   * \param name the name of the requested trace source
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   326
   * \returns the trace source accessor which can be used to connect and disconnect
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   327
   *          trace sinks with the requested trace source on an object instance.
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   328
   *
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   329
   * If no matching trace source is found, this method returns zero.
6688934b493a improve doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2693
diff changeset
   330
   */
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   331
  Ptr<const TraceSourceAccessor> LookupTraceSourceByName (std::string name) const;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   332
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   333
  /**
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   334
   * \returns the internal integer which uniquely identifies this
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   335
   *          TypeId.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   336
   *
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   337
   * This is really an internal method which users are not expected
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   338
   * to use.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   339
   */
2644
b50c3f20ab88 add TypeId::SetUid/GetUid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2641
diff changeset
   340
  uint16_t GetUid (void) const;
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   341
  /**
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   342
   * \param tid the internal integer which uniquely identifies 
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   343
   *        this TypeId.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   344
   *
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   345
   * This method is even more internal than TypeId::GetUid. Use
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   346
   * at your own risk and don't be surprised that it eats raw 
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   347
   * babies on full-moon nights.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2648
diff changeset
   348
   */
2644
b50c3f20ab88 add TypeId::SetUid/GetUid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2641
diff changeset
   349
  void SetUid (uint16_t tid);
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   350
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   351
  // construct an invalid TypeId.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   352
  TypeId ();
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   353
  ~TypeId ();
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   354
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   355
  ATTRIBUTE_HELPER_HEADER_1 (TypeId);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   356
private:
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   357
  friend class AttributeList;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   358
  friend bool operator == (TypeId a, TypeId b);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   359
  friend bool operator != (TypeId a, TypeId b);
2939
3cff8627a284 make IsChildOf not return true for test against self. Add operator < for TypeId.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   360
  friend bool operator <  (TypeId a, TypeId b);
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   361
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   362
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   363
  /**
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   364
   * \param fullName the full name of the requested attribute
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   365
   * \param info a pointer to the TypeId::AttributeInfo data structure
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   366
   *        where the result value of this method will be stored.
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   367
   * \returns the Accessor associated to the requested attribute
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   368
   */
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   369
  static bool LookupAttributeByFullName (std::string fullName, struct AttributeInfo *info);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   370
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   371
  explicit TypeId (uint16_t tid);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   372
  void DoAddConstructor (Callback<ObjectBase *> callback);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   373
  
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   374
  uint16_t m_tid;
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   375
};
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   376
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   377
std::ostream & operator << (std::ostream &os, TypeId tid);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   378
std::istream & operator >> (std::istream &is, TypeId &tid);
2939
3cff8627a284 make IsChildOf not return true for test against self. Add operator < for TypeId.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   379
bool operator == (TypeId a, TypeId b);
3cff8627a284 make IsChildOf not return true for test against self. Add operator < for TypeId.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   380
bool operator != (TypeId a, TypeId b);
3cff8627a284 make IsChildOf not return true for test against self. Add operator < for TypeId.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   381
bool operator <  (TypeId a, TypeId b);
3cff8627a284 make IsChildOf not return true for test against self. Add operator < for TypeId.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2834
diff changeset
   382
2969
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   383
/**
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   384
 * \class ns3::TypeIdValue
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   385
 * \brief hold objects of type ns3::TypeId
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   386
 */
9d05d2a95dfa improve the auto-generated doxygen output.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2965
diff changeset
   387
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   388
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   389
ATTRIBUTE_HELPER_HEADER_2 (TypeId);
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   390
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   391
} // namespace ns3 
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   392
2638
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   393
namespace ns3 {
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   394
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   395
/*************************************************************************
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   396
 *   The TypeId implementation which depends on templates
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   397
 *************************************************************************/
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   398
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   399
template <typename T>
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   400
TypeId 
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   401
TypeId::SetParent (void)
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   402
{
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   403
  return SetParent (T::GetTypeId ());
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   404
}
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   405
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   406
template <typename T>
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   407
TypeId 
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   408
TypeId::AddConstructor (void)
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   409
{
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   410
  struct Maker {
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   411
    static ObjectBase * Create () {
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   412
      ObjectBase * base = new T ();
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   413
      return base;
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   414
    }
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   415
  };
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   416
  Callback<ObjectBase *> cb = MakeCallback (&Maker::Create);
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   417
  DoAddConstructor (cb);
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   418
  return *this;
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   419
}
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   420
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   421
} // namespace ns3
00bd5081ee68 move more code around
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   422
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   423
#endif /* TYPE_ID_H */