This file is indexed.

/usr/include/ns3.17/ns3/attribute.h is in libns3-dev 3.17+dfsg-1build1.

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
/* -*- 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 ATTRIBUTE_H
#define ATTRIBUTE_H

#include <string>
#include <stdint.h>
#include "ptr.h"
#include "simple-ref-count.h"

namespace ns3 {

class AttributeAccessor;
class AttributeChecker;
class Attribute;
class ObjectBase;

/**
 *
 * \ingroup core
 * \defgroup attribute Attribute
 */

/**
 *
 * \ingroup attribute
 *
 * \brief Hold a value for an Attribute.
 *
 * Instances of this class should always be wrapped into an Attribute object.
 * Most subclasses of this base class are implemented by the 
 * ATTRIBUTE_HELPER_* macros.
 */
class AttributeValue : public SimpleRefCount<AttributeValue>
{
public:
  AttributeValue ();
  virtual ~AttributeValue ();

  /**
   * \returns a deep copy of this class, wrapped into an Attribute object.
   */
  virtual Ptr<AttributeValue> Copy (void) const = 0;
  /**
   * \param checker the checker associated to the attribute
   * \returns a string representation of this value.
   *
   * In most cases, this method will not make any use of the checker argument.
   * However, in a very limited set of cases, the checker argument is needed to
   * perform proper serialization. A nice example of code which needs it is
   * the EnumValue::SerializeToString code.
   */
  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const = 0;
  /**
   * \param value a string representation of the value
   * \param checker a pointer to the checker associated to the attribute.
   * \returns true if the input string was correctly-formatted and could be
   *          successfully deserialized, false otherwise.
   *
   * Upon return of this function, this AttributeValue instance contains
   * the deserialized value.
   * In most cases, this method will not make any use of the checker argument.
   * However, in a very limited set of cases, the checker argument is needed to
   * perform proper serialization. A nice example of code which needs it is
   * the EnumValue::SerializeToString code.
   */
  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker) = 0;
};

/**
 * \brief allow setting and getting the value of an attribute.
 *
 * \ingroup attribute
 *
 * The goal of this class is to hide from the user how an attribute
 * is actually set or get to or from a class instance. Implementations
 * of this base class are usually provided through the MakeAccessorHelper
 * template functions, hidden behind an ATTRIBUTE_HELPER_* macro.
 */
class AttributeAccessor : public SimpleRefCount<AttributeAccessor>
{
public:
  AttributeAccessor ();
  virtual ~AttributeAccessor ();

  /**
   * \param object the object instance to set the value in
   * \param value the value to set
   * \returns true if the value could be set successfully, false otherwise.
   *
   * This method expects that the caller has checked that the input value is
   * valid with AttributeChecker::Check.
   */
  virtual bool Set (ObjectBase * object, const AttributeValue &value) const = 0;
  /**
   * \param object the object instance to get the value from
   * \param attribute a pointer to where the value should be set.
   * \returns true if the value could be read successfully, and
   *          stored in the input value, false otherwise.
   *
   * This method expects that the caller has checked that the input value is
   * valid with AttributeChecker::Check.
   */
  virtual bool Get (const ObjectBase * object, AttributeValue &attribute) const = 0;

  /**
   * \return true if this accessor supports the Get operation, false
   *         otherwise.
   */
  virtual bool HasGetter (void) const = 0;
  /**
   * \return true if this accessor supports the Set operation, false
   *         otherwise.
   */
  virtual bool HasSetter (void) const = 0;
};

/**
 * \brief Represent the type of an attribute
 *
 * \ingroup attribute
 *
 * Each type of attribute has an associated unique AttributeChecker
 * subclass. The type of the subclass can be safely used by users
 * to infer the type of the associated attribute. i.e., we expect
 * binding authors to use the checker associated to an attribute
 * to detect the type of the associated attribute.
 *
 * Most subclasses of this base class are implemented by the 
 * ATTRIBUTE_HELPER_HEADER and ATTRIBUTE_HELPER_CPP macros.
 */
class AttributeChecker : public SimpleRefCount<AttributeChecker>
{
public:
  AttributeChecker ();
  virtual ~AttributeChecker ();

  Ptr<AttributeValue> CreateValidValue (const AttributeValue &value) const;
  /**
   * \param value a pointer to the value to check
   * \returns true if the input value is both of the right type
   *          and if its value is within the requested range. Returns
   *          false otherwise.
   */
  virtual bool Check (const AttributeValue &value) const = 0;
  /**
   * \returns the c++ fully-qualified typename of the subclass
   *          of the ns3::AttributeValue base class which is associated
   *          to this checker.
   *
   * A typical return value here is FooValue where Foo is the name of the
   * type being wrapped.
   */
  virtual std::string GetValueTypeName (void) const = 0;
  /**
   * \returns true if this checker has information about the underlying
   *          C++ type, false otherwise.
   *
   * If this method returns false, the return value of the GetUnderlyingTypeInformation
   * method cannot be relied upon.
   */
  virtual bool HasUnderlyingTypeInformation (void) const = 0;
  /**
   * \returns a human-readable representation of information about
   *          the underlying C++ type.
   */
  virtual std::string GetUnderlyingTypeInformation (void) const = 0;
  /**
   * \returns a new instance of an AttributeValue (wrapper in an Attribute 
   *          instance) which matches the type of the underlying attribute.
   *
   * This method is typically used to create a temporary variable prior
   * to calling Attribute::DeserializeFromString.
   */
  virtual Ptr<AttributeValue> Create (void) const = 0;

  virtual bool Copy (const AttributeValue &source, AttributeValue &destination) const = 0;

  
};

/**
 * \brief A class for an empty attribute value
 *
 * \ingroup attribute
 */
class EmptyAttributeValue : public AttributeValue
{
public:
  EmptyAttributeValue ();
private:
  virtual Ptr<AttributeValue> Copy (void) const;
  virtual std::string SerializeToString (Ptr<const AttributeChecker> checker) const;
  virtual bool DeserializeFromString (std::string value, Ptr<const AttributeChecker> checker);
};

} // namespace ns3

#endif /* ATTRIBUTE_H */