This file is indexed.

/usr/include/ns3.26/ns3/object-base.h is in libns3-dev 3.26+dfsg-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2008 INRIA
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
 */
#ifndef OBJECT_BASE_H
#define OBJECT_BASE_H

#include "type-id.h"
#include "callback.h"
#include <string>
#include <list>

/**
 * \file
 * \ingroup object
 * ns3::ObjectBase class declaration and NS_OBJECT_ENSURE_REGISTERED() definition.
 */

/**
 * \ingroup object
 * \brief Register an Object subclass with the TypeId system.
 *
 * This macro should be invoked once for every class which
 * defines a new GetTypeId method.
 *
 * If the class is in a namespace, then the macro call should also be
 * in the namespace.
 */
#define NS_OBJECT_ENSURE_REGISTERED(type)               \
  static struct Object ## type ## RegistrationClass     \
  {                                                     \
    Object ## type ## RegistrationClass () {            \
      ns3::TypeId tid = type::GetTypeId ();             \
      tid.SetSize (sizeof (type));                      \
      tid.GetParent ();                                 \
    }                                                   \
  } Object ## type ## RegistrationVariable

namespace ns3 {

class AttributeConstructionList;

/**
 * \ingroup object
 *
 * \brief Anchor the ns-3 type and attribute system.
 *
 * Every class which wants to integrate in the ns-3 type and attribute
 * system should derive from this base class. This base class provides:
 * - A way to associate an ns3::TypeId to each object instance.
 * - A way to set and get the attributes registered in the ns3::TypeId.
 */
class ObjectBase
{
public:
  /**
   * Get the type ID.
   */
  static TypeId GetTypeId (void);

  /**
   * Virtual destructor.
   */
  virtual ~ObjectBase ();

  /**
   * Get the most derived TypeId for this Object.
   *
   * This method is typically implemented by ns3::Object::GetInstanceTypeId
   * but some classes which derive from ns3::ObjectBase directly
   * have to implement it themselves.
   *
   * \return The TypeId associated to the most-derived type
   *          of this instance.
   */
  virtual TypeId GetInstanceTypeId (void) const = 0;

  /**
   *
   * Set a single attribute, raising fatal errors if unsuccessful.
   *
   * This will either succeed at setting the attribute
   * or it will raise NS_FATAL_ERROR() on these conditions:
   *
   *   - The attribute doesn't exist in this Object.
   *   - The attribute can't be set (no Setter).
   *   - The attribute couldn't be deserialized from the AttributeValue.
   * 
   * \param [in] name The name of the attribute to set.
   * \param [in] value The name of the attribute to set.
   */
  void SetAttribute (std::string name, const AttributeValue &value);
  /**
   * Set a single attribute without raising errors.
   *
   * If the atttribute could not be set this will return \c false,
   * but not raise any errors.
   *
   * \param [in] name The name of the attribute to set.
   * \param [in] value The value to set it to.
   * \return \c true if the requested attribute exists and could be set, 
   *         \c false otherwise.
   */
  bool SetAttributeFailSafe (std::string name, const AttributeValue &value);
  /**
   * Get the value of an attribute, raising fatal errors if unsuccessful.
   *
   * This will either succeed at setting the attribute
   * or it will raise NS_FATAL_ERROR() on these conditions:
   *
   *   - The attribute doesn't exist in this Object.
   *   - The attribute can't be read (no Getter).
   *   - The attribute doesn't support string formatting.
   *   - The attribute couldn't be serialized into the AttributeValue.
   *
   * \param [in]  name The name of the attribute to read.
   * \param [out] value Where the result should be stored.
   */
  void GetAttribute (std::string name, AttributeValue &value) const;
  /**
   * Get the value of an attribute without raising erros.
   *
   * If the atttribute could not be read this will return \c false,
   * but not raise any errors.
   *
   * \param [in]  name The name of the attribute to read.
   * \param [out] value Where the result value should be stored.
   * \return \c true if the requested attribute was found, \c false otherwise.
   */
  bool GetAttributeFailSafe (std::string name, AttributeValue &value) const;

  /**
   * Connect a TraceSource to a Callback with a context.
   *
   * The target trace source should be registered with TypeId::AddTraceSource.
   *
   * \param [in] name The name of the target trace source.
   * \param [in] context The trace context associated to the callback.
   * \param [in] cb The callback to connect to the trace source.
   * \returns \c true.
   */
  bool TraceConnect (std::string name, std::string context, const CallbackBase &cb);
  /**
   * Connect a TraceSource to a Callback without a context.
   *
   * The target trace source should be registered with TypeId::AddTraceSource.
   *
   * \param [in] name The name of the target trace source.
   * \param [in] cb The callback to connect to the trace source.
   * \returns \c true.
   */
  bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb);
  /**
   * Disconnect from a TraceSource a Callback previously connected
   * with a context.
   *
   * The target trace source should be registered with TypeId::AddTraceSource.
   *
   * \param [in] name The name of the target trace source.
   * \param [in] context The trace context associated to the callback.
   * \param [in] cb The callback to disconnect from the trace source.
   * \returns \c true.
   */
  bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb);
  /**
   * Disconnect from a TraceSource a Callback previously connected
   * without a context.
   *
   * The target trace source should be registered with TypeId::AddTraceSource.
   *
   * \param [in] name The name of the target trace source.
   * \param [in] cb The callback to disconnect from the trace source.
   * \returns \c true.
   */
  bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb);

protected:
  /**
   * Notifier called once the ObjectBase is fully constructed.
   *
   * This method is invoked once all member attributes have been 
   * initialized. Subclasses can override this method to be notified
   * of this event but if they do this, they must chain up to their
   * parent's NotifyConstructionCompleted method.
   */
  virtual void NotifyConstructionCompleted (void);
  /**
   * Complete construction of ObjectBase; invoked by derived classes. 
   *
   * Invoked from subclasses to initialize all of their 
   * attribute members. This method will typically be invoked
   * automatically from ns3::CreateObject if your class derives
   * from ns3::Object. If you derive from ns3::ObjectBase directly,
   * you should make sure that you invoke this method from
   * your most-derived constructor.
   *
   * \param [in] attributes The attribute values used to initialize 
   *        the member variables of this object's instance.
   */
  void ConstructSelf (const AttributeConstructionList &attributes);

private:
  /**
   * Attempt to set the value referenced by the accessor \p spec
   * to a valid value according to the \c checker, based on \p value.
   *
   * \param [in] spec The accessor for the storage location.
   * \param [in] checker The checker to use in validating the value.
   * \param [in] value The value to attempt to store.
   * \returns \c true if the \c value could be validated by the \p checker
   *          and written to the storage location.
   */
  bool DoSet (Ptr<const AttributeAccessor> spec,
              Ptr<const AttributeChecker> checker, 
              const AttributeValue &value);

};

} // namespace ns3

#endif /* OBJECT_BASE_H */