Skip to content

Commit 73d3dcf

Browse files
authored
fixed gcc-13 overloaded-virtual warning (#45)
1 parent bb9b043 commit 73d3dcf

File tree

2 files changed

+156
-137
lines changed

2 files changed

+156
-137
lines changed

model/definitions/woss-random-generator.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ WossRandomGenerator::create ( int s )
8585
return new WossRandomGenerator (s);
8686
}
8787

88+
WossRandomGenerator*
89+
WossRandomGenerator::create ( double s )
90+
{
91+
return create ((int)s);
92+
}
93+
8894
WossRandomGenerator*
8995
WossRandomGenerator::clone () const
9096
{
Lines changed: 150 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,150 @@
1-
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2-
/*
3-
* Copyright (c) 2015 Federico Guerra
4-
*
5-
* This program is free software; you can redistribute it and/or modify
6-
* it under the terms of the GNU General Public License version 2 as
7-
* published by the Free Software Foundation;
8-
*
9-
* This program is distributed in the hope that it will be useful,
10-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12-
* GNU General Public License for more details.
13-
*
14-
* You should have received a copy of the GNU General Public License
15-
* along with this program; if not, write to the Free Software
16-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17-
*
18-
* Author: Federico Guerra <federico@guerra-tlc.com>
19-
*/
20-
21-
#ifdef NS3_WOSS_SUPPORT
22-
23-
#ifndef WOSS_RANDOM_GENERATOR_H
24-
#define WOSS_RANDOM_GENERATOR_H
25-
26-
27-
#include <random-generator-definitions.h>
28-
#include <ns3/random-variable-stream.h>
29-
30-
namespace ns3 {
31-
32-
/**
33-
* \class WossRandomGenerator
34-
*
35-
* \brief Wrapper class for woss::RandomGenerator.
36-
*
37-
* woss::RandomGenerator wraps a ns3::UniformRandomVariable into the WOSS framework.
38-
*
39-
*/
40-
class WossRandomGenerator : public woss::RandomGenerator
41-
{
42-
43-
44-
public:
45-
/**
46-
* Default constructor used within the WOSS framework.
47-
* The seed parameter allows the WOSS framework to abstract
48-
* from the wrapped random generator model,
49-
* however in the NS3 integration framework it is
50-
* not used. The RandomVar is created with default random
51-
* generator seed, while the stream can be assigned via AssignStreams
52-
*
53-
* \param seed assigned stream
54-
*/
55-
WossRandomGenerator ( int seed = 0 );
56-
57-
/**
58-
* Copy constructor.
59-
* The returned object reflects the internal status of the source underlying
60-
* random var object.
61-
* initialize () should be called if it wasn't previously called on the source object
62-
*/
63-
WossRandomGenerator ( const WossRandomGenerator& copy );
64-
65-
/**
66-
* Assignment operator.
67-
* The returned reference reflects the internal status of the source underlying
68-
* random var object.
69-
* initialize () should be called if it wasn't previously called on the source object
70-
*/
71-
WossRandomGenerator& operator= ( const WossRandomGenerator& copy );
72-
73-
virtual ~WossRandomGenerator ();
74-
75-
/**
76-
* Mandatory virtual factory method that creates a new object.
77-
* It is inherited and it is used within the WOSS framework.
78-
* It creates an new object; the seed parameter allows the WOSS framework to abstract
79-
* from the wrapped random generator model,
80-
* however in the NS3 integration framework it is
81-
* not used. The RandomVar is created with default random
82-
* generator seed, while the stream can be assigned via AssignStreams
83-
* on the private m_RandVar
84-
* \param seed assigned stream
85-
*/
86-
virtual WossRandomGenerator* create ( int seed );
87-
88-
/**
89-
* Mandatory virtual factory method that clones the current object.
90-
* It is inherited from the WOSS framework.
91-
* The returned object will draw from the same sub-stream of the source object.
92-
*/
93-
virtual WossRandomGenerator* clone () const;
94-
95-
/**
96-
* returns a random double numer
97-
* \returns a random double number
98-
*/
99-
virtual double getRand () const;
100-
101-
/**
102-
* returns a random integer numer in range [0, INT_MAX]
103-
* \returns a random integer number
104-
*/
105-
virtual int getRandInt () const;
106-
107-
/**
108-
* Mandatory initialization method inherited from the WOSS framework.
109-
* Usually a woss::RandomGenerator is created and then initialized
110-
* with this function.
111-
* The initialization is performed only once.
112-
* \see AssignStreams
113-
*/
114-
virtual void initialize ();
115-
116-
117-
/**
118-
* In the NS3 wrapper it should be used to change the current stream used.
119-
* It calls SetStream () on the underlying m_RandVar.
120-
*/
121-
virtual int64_t AssignStreams (int64_t stream);
122-
123-
124-
protected:
125-
/**
126-
* The wrapped NS3 UniformRandomVariable random generator
127-
*/
128-
Ptr<UniformRandomVariable> m_RandVar;
129-
130-
};
131-
132-
}
133-
134-
#endif /* WOSS_RANDOM_GENERATOR_H */
135-
136-
#endif /* NS3_WOSS_SUPPORT */
137-
1+
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2+
/*
3+
* Copyright (c) 2015 Federico Guerra
4+
*
5+
* This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License version 2 as
7+
* published by the Free Software Foundation;
8+
*
9+
* This program is distributed in the hope that it will be useful,
10+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
* GNU General Public License for more details.
13+
*
14+
* You should have received a copy of the GNU General Public License
15+
* along with this program; if not, write to the Free Software
16+
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17+
*
18+
* Author: Federico Guerra <federico@guerra-tlc.com>
19+
*/
20+
21+
#ifdef NS3_WOSS_SUPPORT
22+
23+
#ifndef WOSS_RANDOM_GENERATOR_H
24+
#define WOSS_RANDOM_GENERATOR_H
25+
26+
27+
#include <random-generator-definitions.h>
28+
#include <ns3/random-variable-stream.h>
29+
30+
namespace ns3 {
31+
32+
/**
33+
* \class WossRandomGenerator
34+
*
35+
* \brief Wrapper class for woss::RandomGenerator.
36+
*
37+
* woss::RandomGenerator wraps a ns3::UniformRandomVariable into the WOSS framework.
38+
*
39+
*/
40+
class WossRandomGenerator : public woss::RandomGenerator
41+
{
42+
43+
44+
public:
45+
/**
46+
* Default constructor used within the WOSS framework.
47+
* The seed parameter allows the WOSS framework to abstract
48+
* from the wrapped random generator model,
49+
* however in the NS3 integration framework it is
50+
* not used. The RandomVar is created with default random
51+
* generator seed, while the stream can be assigned via AssignStreams
52+
*
53+
* \param seed assigned stream
54+
*/
55+
WossRandomGenerator ( int seed = 0 );
56+
57+
/**
58+
* Copy constructor.
59+
* The returned object reflects the internal status of the source underlying
60+
* random var object.
61+
* initialize () should be called if it wasn't previously called on the source object
62+
*/
63+
WossRandomGenerator ( const WossRandomGenerator& copy );
64+
65+
/**
66+
* Assignment operator.
67+
* The returned reference reflects the internal status of the source underlying
68+
* random var object.
69+
* initialize () should be called if it wasn't previously called on the source object
70+
*/
71+
WossRandomGenerator& operator= ( const WossRandomGenerator& copy );
72+
73+
virtual ~WossRandomGenerator ();
74+
75+
/**
76+
* Mandatory virtual factory method that creates a new object.
77+
* It is inherited and it is used within the WOSS framework.
78+
* It creates an new object; the seed parameter allows the WOSS framework to abstract
79+
* from the wrapped random generator model,
80+
* however in the NS3 integration framework it is
81+
* not used. The RandomVar is created with default random
82+
* generator seed, while the stream can be assigned via AssignStreams
83+
* on the private m_RandVar
84+
* \param seed assigned stream
85+
*/
86+
virtual WossRandomGenerator* create ( int seed );
87+
88+
/**
89+
* Virtual factory method that creates a new object.
90+
* It is inherited and it is used within the WOSS framework.
91+
* It creates an new object; the seed parameter allows the WOSS framework to abstract
92+
* from the wrapped random generator model,
93+
* however in the NS3 integration framework it is
94+
* not used. The RandomVar is created with default random
95+
* generator seed, while the stream can be assigned via AssignStreams
96+
* on the private m_RandVar
97+
* \param seed assigned seed in double format
98+
*/
99+
virtual WossRandomGenerator* create ( double seed );
100+
101+
/**
102+
* Mandatory virtual factory method that clones the current object.
103+
* It is inherited from the WOSS framework.
104+
* The returned object will draw from the same sub-stream of the source object.
105+
*/
106+
virtual WossRandomGenerator* clone () const;
107+
108+
/**
109+
* returns a random double numer
110+
* \returns a random double number
111+
*/
112+
virtual double getRand () const;
113+
114+
/**
115+
* returns a random integer numer in range [0, INT_MAX]
116+
* \returns a random integer number
117+
*/
118+
virtual int getRandInt () const;
119+
120+
/**
121+
* Mandatory initialization method inherited from the WOSS framework.
122+
* Usually a woss::RandomGenerator is created and then initialized
123+
* with this function.
124+
* The initialization is performed only once.
125+
* \see AssignStreams
126+
*/
127+
virtual void initialize ();
128+
129+
130+
/**
131+
* In the NS3 wrapper it should be used to change the current stream used.
132+
* It calls SetStream () on the underlying m_RandVar.
133+
*/
134+
virtual int64_t AssignStreams (int64_t stream);
135+
136+
137+
protected:
138+
/**
139+
* The wrapped NS3 UniformRandomVariable random generator
140+
*/
141+
Ptr<UniformRandomVariable> m_RandVar;
142+
143+
};
144+
145+
}
146+
147+
#endif /* WOSS_RANDOM_GENERATOR_H */
148+
149+
#endif /* NS3_WOSS_SUPPORT */
150+

0 commit comments

Comments
 (0)