A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
random-variable-stream-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012 University of Washington
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 */
18#ifndef RANDOM_VARIABLE_STREAM_HELPER_H
19#define RANDOM_VARIABLE_STREAM_HELPER_H
20
21#include <cstdint>
22#include <string>
23
24/**
25 * \file
26 * \ingroup core-helpers
27 * \ingroup randomvariable
28 * ns3::RandomVariableStreamHelper declaration.
29 */
30
31namespace ns3
32{
33
34/**
35 * \brief Helper class for static methods involving RandomVariableStream
36 */
38{
39 public:
40 /**
41 * This helper method can be used to configure the stream number for
42 * one or more RNG streams. The path passed in should correspond to
43 * an attribute path in the configuration system. It may contain wildcards
44 * and may ultimately match zero, one, or more than one object.
45 *
46 * The objects to match are of type PointerValue where the underlying
47 * type is of type Ptr<RandomVariableStream>.
48 *
49 * \code
50 * .AddAttribute ("Speed",
51 * "A random variable used to pick the speed of a random waypoint model.",
52 * StringValue("ns3::UniformRandomVariable[Min=0.3|Max=0.7]"),
53 * MakePointerAccessor (&RandomWaypointMobilityModel::m_speed),
54 * MakePointerChecker<RandomVariableStream> ())
55 *
56 * \endcode
57 *
58 * Usage would look (for node 3) like this:
59 * \code
60 * std::string path
61 * ("/$ns3::NodeListPriv/NodeList/3/$ns3::Node/$ns3::RandomWaypointMobilityModel/Speed/$ns3::UniformRandomVariable");
62 * int64_t retVal = RandomVariableStreamHelper::AssignStreams (path, 0);
63 * \endcode
64 *
65 * \return The number of streams set
66 * \param path (possibly wildcarded) path to a RandomVariableStream PointerValue
67 * \param stream stream number to set; must be non-negative
68 */
69 static int64_t AssignStreams(std::string path, int64_t stream);
70};
71
72} // namespace ns3
73
74#endif /* RANDOM_VARIABLE_STREAM_HELPER_H */
Helper class for static methods involving RandomVariableStream.
static int64_t AssignStreams(std::string path, int64_t stream)
This helper method can be used to configure the stream number for one or more RNG streams.
Every class exported by the ns3 library is enclosed in the ns3 namespace.