src/core/object.h
author Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
Sat, 04 Jul 2009 08:15:48 +0200
changeset 4654 2eaebe77d66b
parent 4554 b1940a738981
permissions -rw-r--r--
Added tag ns-3.5 for changeset c975274c9707
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA, Gustavo Carneiro
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Authors: Gustavo Carneiro <gjcarneiro@gmail.com>,
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 *          Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
 */
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
    21
#ifndef OBJECT_H
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
    22
#define OBJECT_H
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <stdint.h>
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include <string>
2542
a9b88fdc09d6 kill TraceResolver et al.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2531
diff changeset
    26
#include <vector>
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
#include "ptr.h"
2438
e2ac9f9aeeb9 value.h -> attribute.h
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2437
diff changeset
    28
#include "attribute.h"
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
    29
#include "object-base.h"
2633
a0639de8cd8b split code from object.h/object.cc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2631
diff changeset
    30
#include "attribute-list.h"
2246
3645f5e344a4 add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2244
diff changeset
    31
3645f5e344a4 add NS_OBJECT_ENSURE_REGISTERED
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2244
diff changeset
    32
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
namespace ns3 {
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
2237
7745a8c76396 add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2235
diff changeset
    35
class Object;
2436
23415bac7eaf Accessor -> AttributeAccessor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2435
diff changeset
    36
class AttributeAccessor;
2437
44e34ffee8e3 Value -> AttributeValue
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2436
diff changeset
    37
class AttributeValue;
2459
91662d921a83 Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2458
diff changeset
    38
class AttributeList;
2463
c77e43117673 actually allow connection and disconnection to trace sources registered in TypeIds
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2460
diff changeset
    39
class TraceSourceAccessor;
1336
de5a133ece8a add Object::TraceConnect, TraceDisconnect, and GetTraceResolver methods
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1330
diff changeset
    40
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
    41
/**
3182
61fe7fe81ebd Doxygen organization
Tom Henderson <tomh@tomh.org>
parents: 2973
diff changeset
    42
 * \ingroup core
61fe7fe81ebd Doxygen organization
Tom Henderson <tomh@tomh.org>
parents: 2973
diff changeset
    43
 * \defgroup object Object
61fe7fe81ebd Doxygen organization
Tom Henderson <tomh@tomh.org>
parents: 2973
diff changeset
    44
 */
61fe7fe81ebd Doxygen organization
Tom Henderson <tomh@tomh.org>
parents: 2973
diff changeset
    45
/**
61fe7fe81ebd Doxygen organization
Tom Henderson <tomh@tomh.org>
parents: 2973
diff changeset
    46
 * \ingroup object
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
    47
 * \brief a base class which provides memory management and object aggregation
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
    48
 *
3190
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    49
 * The memory management scheme is based on reference-counting with dispose-like
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    50
 * functionality to break the reference cycles. The reference count is increamented
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    51
 * and decremented with the methods Object::Ref and Object::Unref. If a reference cycle is
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    52
 * present, the user is responsible for breaking it by calling Object::Dispose in
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    53
 * a single location. This will eventually trigger the invocation of Object::DoDispose 
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    54
 * on itself and all its aggregates. The Object::DoDispose method is always automatically
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    55
 * invoked from the Object::Unref method before destroying the object, even if the user 
51fe9001a679 add some doxygen, remove a couple of XXX
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3182
diff changeset
    56
 * did not call Object::Dispose directly.
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
    57
 */
2370
5f7ad186b798 introduce ObjectBase
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
    58
class Object : public ObjectBase
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
{
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
public:
2251
04963d8cca51 iid (void) -> GetTypeId (void)
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2250
diff changeset
    61
  static TypeId GetTypeId (void);
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
2938
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    63
  /**
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    64
   * \brief Iterate over the objects aggregated to an ns3::Object.
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    65
   *
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    66
   * This iterator does not allow you to iterate over the initial
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    67
   * object used to call Object::GetAggregateIterator. 
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    68
   *
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    69
   * Note: this is a java-style iterator.
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    70
   */
2937
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    71
  class AggregateIterator
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    72
  {
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    73
  public:
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    74
    AggregateIterator ();
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    75
2938
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    76
    /**
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    77
     * \returns true if HasNext can be called and return a non-null
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    78
     *          pointer, false otherwise.
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    79
     */
2937
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    80
    bool HasNext (void) const;
2938
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    81
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    82
    /**
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    83
     * \returns the next aggregated object.
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
    84
     */
2937
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    85
    Ptr<const Object> Next (void);
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    86
  private:
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    87
    friend class Object;
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    88
    AggregateIterator (Ptr<const Object> first);
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    89
    Ptr<const Object> m_first;
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    90
    Ptr<const Object> m_current;
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    91
  };
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
    92
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
    93
  Object ();
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
    94
  virtual ~Object ();
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
    95
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
    96
  /*
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
    97
   * Implement the GetInstanceTypeId method defined in ObjectBase.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
    98
   */
2634
44a92f1d3728 introduce ObjectBase::GetInstanceTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
    99
  virtual TypeId GetInstanceTypeId (void) const;
44a92f1d3728 introduce ObjectBase::GetInstanceTypeId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2633
diff changeset
   100
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   101
  /**
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   102
   * Increment the reference count. This method should not be called
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   103
   * by user code. Object instances are expected to be used in conjunction
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   104
   * of the Ptr template which would make calling Ref unecessary and 
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   105
   * dangerous.
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   106
   */
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   107
  inline void Ref (void) const;
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   108
  /**
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   109
   * Decrement the reference count. This method should not be called
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   110
   * by user code. Object instances are expected to be used in conjunction
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   111
   * of the Ptr template which would make calling Ref unecessary and 
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   112
   * dangerous.
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   113
   */
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   114
  inline void Unref (void) const;
3394
1680d5004ee8 add Object::GetReferenceCount
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3190
diff changeset
   115
1680d5004ee8 add Object::GetReferenceCount
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3190
diff changeset
   116
  /**
1680d5004ee8 add Object::GetReferenceCount
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3190
diff changeset
   117
   * Get the reference count of the object.  Normally not needed; for language bindings.
1680d5004ee8 add Object::GetReferenceCount
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3190
diff changeset
   118
   */
1680d5004ee8 add Object::GetReferenceCount
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3190
diff changeset
   119
  uint32_t GetReferenceCount (void) const;
1680d5004ee8 add Object::GetReferenceCount
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3190
diff changeset
   120
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   121
  /**
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   122
   * \returns a pointer to the requested interface or zero if it could not be found.
2231
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   123
   */
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   124
  template <typename T>
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   125
  Ptr<T> GetObject (void) const;
2231
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   126
  /**
2252
80595448707a iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   127
   * \param tid the interface id of the requested interface
2231
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   128
   * \returns a pointer to the requested interface or zero if it could not be found.
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   129
   */
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
  template <typename T>
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   131
  Ptr<T> GetObject (TypeId tid) const;
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   132
  /**
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   133
   * Run the DoDispose methods of this object and all the
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   134
   * objects aggregated to it.
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   135
   * After calling this method, the object is expected to be
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   136
   * totally unusable except for the Ref and Unref methods.
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   137
   * It is an error to call Dispose twice on the same object 
2715
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   138
   * instance.
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   139
   *
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   140
   * This method is typically used to break reference cycles.
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   141
   */
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   142
  void Dispose (void);
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   143
  /**
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   144
   * \param other another object pointer
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   145
   *
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   146
   * This method aggregates the two objects together: after this
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   147
   * method returns, it becomes possible to call GetObject
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   148
   * on one to get the other, and vice-versa. 
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   149
   */
2258
666099a753e0 AddInterface -> AggregateObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2257
diff changeset
   150
  void AggregateObject (Ptr<Object> other);
1330
d67fce6d56f8 add refcounting to TraceResolver
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 718
diff changeset
   151
2938
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   152
  /**
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   153
   * \returns an iterator to the first object aggregated to this
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   154
   *          object.
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   155
   *
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   156
   * If no objects are aggregated to this object, then, the returned
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   157
   * iterator will be empty and AggregateIterator::HasNext will
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   158
   * always return false.
621b23d5be5b iterate over the _aggregated_ objects: this does not include the initial pointer.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2937
diff changeset
   159
   */
2937
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   160
  AggregateIterator GetAggregateIterator (void) const;
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   161
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
protected:
4472
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   163
 /**
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   164
  * This function is called by the AggregateObject on all the objects connected in the listed chain.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   165
  * This way the new object aggregated will be used if needed by the NotifyNewAggregate corresponding
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   166
  * to each object connected in the listed chain. It should be implemented by objects needing an
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   167
  * additional/special behavior when aggregated to another object.
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   168
  */
e20a31541404 src/ and utils/ changes for IPv4 routing rework
Tom Henderson <tomh@tomh.org>
parents: 4210
diff changeset
   169
  virtual void NotifyNewAggregate ();
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   170
  /**
2715
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   171
   * This method is called by Object::Dispose or by the object's 
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   172
   * destructor, whichever comes first.
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   173
   *
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   174
   * Subclasses are expected to implement their real destruction
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   175
   * code in an overriden version of this method and chain
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   176
   * up to their parent's implementation once they are done.
2715
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   177
   * i.e., for simplicity, the destructor of every subclass should
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   178
   * be empty and its content should be moved to the associated
cc2eb4718176 doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2690
diff changeset
   179
   * DoDispose method.
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   180
   */
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   181
  virtual void DoDispose (void);
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   182
  /**
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   183
   * \param o the object to copy.
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   184
   *
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   185
   * Allow subclasses to implement a copy constructor.
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   186
   * While it is technically possible to implement a copy
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   187
   * constructor in a subclass, we strongly discourage you
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   188
   * to do so. If you really want to do it anyway, you have
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   189
   * to understand that this copy constructor will _not_
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   190
   * copy aggregated objects. i.e., if your object instance
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   191
   * is already aggregated to another object and if you invoke
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   192
   * this copy constructor, the new object instance will be
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   193
   * a pristine standlone object instance not aggregated to
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   194
   * any other object. It is thus _your_ responsability
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   195
   * as a caller of this method to do what needs to be done
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   196
   * (if it is needed) to ensure that the object stays in a
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   197
   * valid state.
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   198
   */
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   199
  Object (const Object &o);
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   200
private:
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   201
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   202
  template <typename T>
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   203
  friend Ptr<T> CreateObjectWithAttributes (const AttributeList &attributes);
2607
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   204
  template <typename T>
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   205
  friend Ptr<T> CopyObject (Ptr<T> object);
2924
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   206
  template <typename T>
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   207
  friend Ptr<T> CopyObject (Ptr<const T> object);
3396
0d83aa14b65d add PythonCompleteConstruct friend for python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3394
diff changeset
   208
  // The following friend method declaration is used only
0d83aa14b65d add PythonCompleteConstruct friend for python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3394
diff changeset
   209
  // by our python bindings to call the protected ObjectBase::Construct
0d83aa14b65d add PythonCompleteConstruct friend for python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3394
diff changeset
   210
  // method.
0d83aa14b65d add PythonCompleteConstruct friend for python bindings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3394
diff changeset
   211
  friend void PythonCompleteConstruct (Ptr<Object> object, TypeId typeId, const AttributeList &attributes);
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   212
  template <typename T>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   213
  friend Ptr<T> CompleteConstruct (T *object);
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   214
2631
365595f1f9a8 replace TypeId::CreateObject with TypeId::GetConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2607
diff changeset
   215
  friend class ObjectFactory;
2937
fc048c358357 iterate over aggregated objects dynamically.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   216
  friend class AggregateIterator;
2631
365595f1f9a8 replace TypeId::CreateObject with TypeId::GetConstructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2607
diff changeset
   217
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   218
  Ptr<Object> DoGetObject (TypeId tid) const;
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   219
  bool Check (void) const;
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   220
  bool CheckLoose (void) const;
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   221
  /**
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   222
   * Attempt to delete this object. This method iterates
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   223
   * over all aggregated objects to check if they all 
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   224
   * have a zero refcount. If yes, the object and all
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   225
   * its aggregates are deleted. If not, nothing is done.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   226
   */
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   227
  void MaybeDelete (void) const;
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   228
  /**
2252
80595448707a iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   229
   * \param tid an TypeId
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   230
   *
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   231
   * Invoked from ns3::CreateObject only.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   232
   * Initialize the m_tid member variable to
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   233
   * keep track of the type of this object instance.
718
b32ae2809deb add dox
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 713
diff changeset
   234
   */
2252
80595448707a iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   235
  void SetTypeId (TypeId tid);
2637
ac94e4889027 move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2635
diff changeset
   236
   /**
2458
e8f7c4960576 AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
   237
   * \param attributes the attribute values used to initialize 
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   238
   *        the member variables of this object's instance.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   239
   *
2637
ac94e4889027 move attribute code to ObjectBase.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2635
diff changeset
   240
   * Invoked from ns3::ObjectFactory::Create and ns3::CreateObject only.
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   241
   * Initialize all the member variables which were
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   242
   * registered with the associated TypeId.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   243
   */
2459
91662d921a83 Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2458
diff changeset
   244
  void Construct (const AttributeList &attributes);
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   245
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   246
  /**
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   247
   * The reference count for this object. Each aggregate
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   248
   * has an individual reference count. When the global
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   249
   * reference count (the sum of all reference counts) 
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   250
   * reaches zero, the object and all its aggregates is 
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   251
   * deleted.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   252
   */
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   253
  mutable uint32_t m_count;
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   254
  /**
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   255
   * Identifies the type of this object instance.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   256
   */
2252
80595448707a iid -> tid
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2251
diff changeset
   257
  TypeId m_tid;
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   258
  /**
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   259
   * Set to true when the DoDispose method of the object
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   260
   * has run, false otherwise.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   261
   */
713
c3c745a80610 add a m_disposed field and check it
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 712
diff changeset
   262
  bool m_disposed;
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   263
  /**
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   264
   * A pointer to the next aggregate object. This is a circular
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   265
   * linked list of aggregated objects: the last one points
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   266
   * back to the first one. If an object is not aggregated to
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   267
   * any other object, the value of this field is equal to the
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   268
   * value of the 'this' pointer.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   269
   */
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   270
  Object *m_next;
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   271
};
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   273
/**
2688
cf03845fc7ca fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
   274
 * \param object a pointer to the object to copy.
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   275
 * \returns a copy of the input object.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   276
 *
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   277
 * This method invoke the copy constructor of the input object
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   278
 * and returns the new instance.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   279
 */
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   280
template <typename T>
2924
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   281
Ptr<T> CopyObject (Ptr<const T> object);
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   282
template <typename T>
2688
cf03845fc7ca fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
   283
Ptr<T> CopyObject (Ptr<T> object);
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   284
2924
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   285
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   286
/**
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   287
 * \param attributes a list of attributes to set on the 
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   288
 *        object during construction.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   289
 * \returns a pointer to a newly allocated object.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   290
 *
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   291
 * This allocates an object on the heap and initializes
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   292
 * it with a set of attributes.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   293
 */
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   294
template <typename T>
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   295
Ptr<T> CreateObjectWithAttributes (const AttributeList &attributes);
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   296
2670
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   297
/**
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   298
 * \param n1 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   299
 * \param v1 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   300
 * \param n2 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   301
 * \param v2 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   302
 * \param n3 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   303
 * \param v3 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   304
 * \param n4 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   305
 * \param v4 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   306
 * \param n5 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   307
 * \param v5 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   308
 * \param n6 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   309
 * \param v6 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   310
 * \param n7 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   311
 * \param v7 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   312
 * \param n8 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   313
 * \param v8 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   314
 * \param n9 name of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   315
 * \param v9 value of attribute
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   316
 * \returns a pointer to a newly allocated object.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   317
 *
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   318
 * This allocates an object on the heap and initializes
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   319
 * it with a set of attributes.
6e5ee56bed72 some doxygen work.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2667
diff changeset
   320
 */
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   321
template <typename T>
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   322
Ptr<T> 
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   323
CreateObjectWithAttributes (std::string n1 = "", const AttributeValue & v1 = EmptyAttributeValue (),
2965
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   324
              std::string n2 = "", const AttributeValue & v2 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   325
              std::string n3 = "", const AttributeValue & v3 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   326
              std::string n4 = "", const AttributeValue & v4 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   327
              std::string n5 = "", const AttributeValue & v5 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   328
              std::string n6 = "", const AttributeValue & v6 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   329
              std::string n7 = "", const AttributeValue & v7 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   330
              std::string n8 = "", const AttributeValue & v8 = EmptyAttributeValue (),
4b28e9740e3b get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2938
diff changeset
   331
              std::string n9 = "", const AttributeValue & v9 = EmptyAttributeValue ());
2667
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   332
  
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   333
2324032b8f90 Add an explicit copy constructor. Bug reported by Raj.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2638
diff changeset
   334
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   335
} // namespace ns3
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   336
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   337
namespace ns3 {
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   338
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   339
/*************************************************************************
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   340
 *   The Object implementation which depends on templates
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   341
 *************************************************************************/
2237
7745a8c76396 add 'factory' support to InterfaceId
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2235
diff changeset
   342
701
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   343
void
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   344
Object::Ref (void) const
701
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   345
{
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   346
  m_count++;
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   347
}
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   348
void
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   349
Object::Unref (void) const
701
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   350
{
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   351
  NS_ASSERT (Check ());
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   352
  m_count--;
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   353
  if (m_count == 0)
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   354
    {
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   355
      MaybeDelete ();
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   356
    }
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   357
}
aa179c876b22 optimization suggested by gustavo
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 699
diff changeset
   358
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   359
template <typename T>
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   360
Ptr<T> 
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   361
Object::GetObject () const
2231
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   362
{
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   363
  Ptr<Object> found = DoGetObject (T::GetTypeId ());
2231
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   364
  if (found != 0)
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   365
    {
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   366
      return Ptr<T> (dynamic_cast<T *> (PeekPointer (found)));
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   367
    }
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   368
  return 0;
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   369
}
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   370
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   371
template <typename T>
a5b898c1ee2c fix bug 122: get rid of duplicate argument to QueryInterface
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2230
diff changeset
   372
Ptr<T> 
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   373
Object::GetObject (TypeId tid) const
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   374
{
2257
71a58e70c671 QueryInterface -> GetObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2252
diff changeset
   375
  Ptr<Object> found = DoGetObject (tid);
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   376
  if (found != 0)
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   377
    {
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   378
      return Ptr<T> (dynamic_cast<T *> (PeekPointer (found)));
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   379
    }
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   380
  return 0;
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   381
}
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   382
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   383
/*************************************************************************
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   384
 *   The helper functions which need templates.
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   385
 *************************************************************************/
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   386
2607
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   387
template <typename T>
2688
cf03845fc7ca fix dox warnings
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2670
diff changeset
   388
Ptr<T> CopyObject (Ptr<T> object)
2607
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   389
{
2690
ce92d0b2f602 fix the build, again.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2688
diff changeset
   390
  Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
3397
cad55f67f3fc avoid direct access to Object::m_tid. Use ObjectBase::GetInstanceTypeId instead.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3396
diff changeset
   391
  NS_ASSERT (p->GetInstanceTypeId () == object->GetInstanceTypeId ());
2607
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   392
  return p;
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   393
}
8dd96726ef24 add CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2602
diff changeset
   394
2924
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   395
template <typename T>
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   396
Ptr<T> CopyObject (Ptr<const T> object)
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   397
{
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   398
  Ptr<T> p = Ptr<T> (new T (*PeekPointer (object)), false);
3397
cad55f67f3fc avoid direct access to Object::m_tid. Use ObjectBase::GetInstanceTypeId instead.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3396
diff changeset
   399
  NS_ASSERT (p->GetInstanceTypeId () == object->GetInstanceTypeId ());
2924
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   400
  return p;
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   401
}
70a02c24d5eb add const version of CopyObject
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2715
diff changeset
   402
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   403
template <typename T>
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   404
Ptr<T> CompleteConstruct (T *p)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   405
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   406
  p->SetTypeId (T::GetTypeId ());
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   407
  p->Object::Construct (AttributeList());
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   408
  return Ptr<T> (p, false);
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   409
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   410
template <typename T>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   411
Ptr<T> CreateObjectWithAttributes (const AttributeList &attributes)
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   412
{
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   413
  Ptr<T> p = Ptr<T> (new T (), false);
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   414
  p->SetTypeId (T::GetTypeId ());
2458
e8f7c4960576 AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
   415
  p->Object::Construct (attributes);
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   416
  return p;  
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   417
}
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   418
2230
9f13ac3291e0 add CreateObject<> to instanciate subclasses of the Object base class. Replaces Create<>.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1534
diff changeset
   419
template <typename T>
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   420
Ptr<T> 
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   421
CreateObjectWithAttributes (std::string n1 , const AttributeValue & v1,
4210
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   422
              std::string n2 , const AttributeValue & v2,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   423
              std::string n3 , const AttributeValue & v3,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   424
              std::string n4 , const AttributeValue & v4,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   425
              std::string n5 , const AttributeValue & v5,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   426
              std::string n6 , const AttributeValue & v6,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   427
              std::string n7 , const AttributeValue & v7,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   428
              std::string n8 , const AttributeValue & v8,
da9be6abb1b2 bug 486: patches for icc compilation.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3397
diff changeset
   429
              std::string n9 , const AttributeValue & v9)
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   430
{
2459
91662d921a83 Attributes -> AttributeList
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2458
diff changeset
   431
  AttributeList attributes;
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   432
  if (n1 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   433
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   434
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   435
    }
2458
e8f7c4960576 AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
   436
  attributes.SetWithTid (T::GetTypeId (), n1, v1);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   437
  if (n2 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   438
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   439
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   440
    }
2458
e8f7c4960576 AddParameter -> AddAttribute
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2438
diff changeset
   441
  attributes.SetWithTid (T::GetTypeId (), n2, v2);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   442
  if (n3 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   443
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   444
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   445
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   446
  attributes.SetWithTid (T::GetTypeId (), n3, v3);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   447
  if (n4 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   448
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   449
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   450
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   451
  attributes.SetWithTid (T::GetTypeId (), n4, v4);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   452
  if (n5 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   453
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   454
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   455
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   456
  attributes.SetWithTid (T::GetTypeId (), n5, v5);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   457
  if (n6 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   458
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   459
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   460
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   461
  attributes.SetWithTid (T::GetTypeId (), n6, v6);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   462
  if (n7 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   463
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   464
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   465
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   466
  attributes.SetWithTid (T::GetTypeId (), n7, v7);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   467
  if (n8 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   468
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   469
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   470
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   471
  attributes.SetWithTid (T::GetTypeId (), n8, v8);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   472
  if (n9 == "")
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   473
    {
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   474
      goto end;
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   475
    }
2489
c3341ba4cbf8 do not use the private constructor to avoid overload resolution confusions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2471
diff changeset
   476
  attributes.SetWithTid (T::GetTypeId (), n9, v9);
2591
83a605082fb6 do not set attributes if they have their default value.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2589
diff changeset
   477
 end:
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   478
  return CreateObjectWithAttributes<T> (attributes);
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   479
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   480
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   481
template <typename T>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   482
Ptr<T> CreateObject (void)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   483
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   484
  return CompleteConstruct (new T ());
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   485
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   486
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   487
template <typename T, typename T1>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   488
Ptr<T> CreateObject (T1 a1)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   489
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   490
  return CompleteConstruct (new T (a1));
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   491
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   492
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   493
template <typename T, typename T1, typename T2>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   494
Ptr<T> CreateObject (T1 a1, T2 a2)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   495
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   496
  return CompleteConstruct (new T (a1,a2));
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   497
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   498
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   499
template <typename T, typename T1, typename T2, typename T3>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   500
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   501
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   502
  return CompleteConstruct (new T (a1,a2,a3));
2372
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   503
}
bf4efb9359c6 attempt to perform correctly automatic conversions.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2370
diff changeset
   504
4554
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   505
template <typename T, typename T1, typename T2, typename T3, typename T4>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   506
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   507
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   508
  return CompleteConstruct (new T (a1,a2,a3,a4));
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   509
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   510
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   511
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   512
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   513
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   514
  return CompleteConstruct (new T (a1,a2,a3,a4,a5));
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   515
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   516
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   517
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   518
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   519
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   520
  return CompleteConstruct (new T (a1,a2,a3,a4,a5,a6));
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   521
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   522
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   523
template <typename T, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   524
Ptr<T> CreateObject (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6, T7 a7)
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   525
{
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   526
  return CompleteConstruct (new T (a1,a2,a3,a4,a5,a6,a7));
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   527
}
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   528
b1940a738981 make CreateObject<> behave like Create<>: use positional constructor arguments rather than attribute lists.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4472
diff changeset
   529
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   530
} // namespace ns3
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   531
706
8b0bf4623c9d rename InterfaceObject to Object
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 703
diff changeset
   532
#endif /* OBJECT_H */
699
956a76f5fd56 a replacement for the Interface base class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   533