A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
nix-vector.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2009 The Georgia Institute of Technology
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
* Authors: Josh Pelkey <jpelkey@gatech.edu>
19
*/
20
21
#ifndef NIX_VECTOR_H
22
#define NIX_VECTOR_H
23
24
#include "ns3/ptr.h"
25
#include "ns3/simple-ref-count.h"
26
#include "ns3/buffer.h"
27
28
namespace
ns3 {
29
63
class
NixVector
:
public
SimpleRefCount
<NixVector>
64
{
65
public
:
66
NixVector
();
67
~NixVector
();
71
Ptr<NixVector>
Copy
(
void
)
const
;
76
NixVector
(
const
NixVector
&o);
81
NixVector
&
operator =
(
const
NixVector
&o);
94
void
AddNeighborIndex
(uint32_t newBits, uint32_t numberOfBits);
108
uint32_t
ExtractNeighborIndex
(uint32_t numberOfBits);
113
uint32_t
GetRemainingBits
(
void
);
117
uint32_t
GetSerializedSize
(
void
)
const
;
128
uint32_t
Serialize
(uint32_t* buffer, uint32_t maxSize)
const
;
139
uint32_t
Deserialize
(
const
uint32_t* buffer, uint32_t size);
149
uint32_t
BitCount
(uint32_t numberOfNeighbors)
const
;
150
151
152
private
:
153
typedef
std::vector<uint32_t>
NixBits_t
;
154
155
/* for printing of nix-vector */
156
void
DumpNixVector
(std::ostream &os)
const
;
157
/* for printing of nix-vector */
158
friend
std::ostream &
operator <<
( std::ostream &outs,
const
NixVector
&nix);
159
160
/* the actual nix-vector */
161
NixBits_t
m_nixVector
;
162
163
/* for tracking where we are
164
* in the nix-vector
165
*/
166
uint32_t
m_used
;
167
168
/* for tracking how many bits we
169
* have used in the current vector
170
* entry. need this in order to
171
* expand the vector passed 32bits
172
*/
173
uint32_t
m_currentVectorBitSize
;
174
175
/* a counter of how total bits are in
176
* the nix-vector
177
*/
178
uint32_t
m_totalBitSize
;
179
180
/* internal for pretty printing of nix-vector */
181
void
PrintDec2BinNixFill
(uint32_t, uint32_t, std::ostream &os)
const
;
182
183
/* internal for pretty printing of nix-vector */
184
void
PrintDec2BinNix
(uint32_t, uint32_t, std::ostream &os)
const
;
185
};
186
}
// namespace ns3
187
188
#endif
/* NIX_VECTOR_H */
src
network
model
nix-vector.h
Generated on Tue Oct 9 2012 16:45:43 for ns-3 by
1.8.1.2