src/wifi/model/wifi-mode.cc
author Daniel Lertpratchya <nikkipui@gmail.com>
Tue, 10 Dec 2013 10:48:51 -0500
changeset 10483 e3a02ed14587
parent 10139 17a71cd49da3
child 11450 9f4ae69f12b7
permissions -rw-r--r--
[doxygen] wifi module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7252
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2034
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     2
/*
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     3
 * Copyright (c) 2005,2006,2007 INRIA
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     4
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
2034
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     7
 * published by the Free Software Foundation;
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     8
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    12
 * GNU General Public License for more details.
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    13
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    14
 * You should have received a copy of the GNU General Public License
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    15
 * along with this program; if not, write to the Free Software
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    17
 *
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
8664ab76ff85 add missing headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1984
diff changeset
    19
 */
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#include "wifi-mode.h"
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
    21
#include "ns3/simulator.h"
1887
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
    22
#include "ns3/assert.h"
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
    23
#include "ns3/log.h"
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
namespace ns3 {
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    27
/**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    28
 * Check if the two WifiModes are identical.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    29
 *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    30
 * \param a WifiMode
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    31
 * \param b WifiMode
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    32
 * \return true if the two WifiModes are identical,
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    33
 *         false otherwise
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    34
 */
1910
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
    35
bool operator == (const WifiMode &a, const WifiMode &b)
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
    36
{
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
    37
  return a.GetUid () == b.GetUid ();
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
    38
}
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    39
/**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    40
 * Serialize WifiMode to ostream (human-readable).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    41
 *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    42
 * \param os std::ostream
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    43
 * \param mode
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    44
 * \return std::ostream
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    45
 */
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    46
std::ostream & operator << (std::ostream & os, const WifiMode &mode)
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    47
{
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    48
  os << mode.GetUniqueName ();
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    49
  return os;
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    50
}
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    51
/**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    52
 * Serialize WifiMode from istream (human-readable).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    53
 *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    54
 * \param is std::istream
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    55
 * \param mode
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    56
 * \return std::istream
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    57
 */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    58
std::istream & operator >> (std::istream &is, WifiMode &mode)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    59
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    60
  std::string str;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    61
  is >> str;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
    62
  mode = WifiModeFactory::GetFactory ()->Search (str);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    63
  return is;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
    64
}
1910
1c1dd3c8c228 add operator == for WifiMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1909
diff changeset
    65
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
    66
uint32_t
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
WifiMode::GetBandwidth (void) const
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
  return item->bandwidth;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
}
7526
f4e9610a07a3 Issue 5032043: preparation for 802.11ad support
Daniel Halperin <daniel@halper.in>
parents: 7385
diff changeset
    72
uint64_t
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
WifiMode::GetPhyRate (void) const
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
  return item->phyRate;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
}
7526
f4e9610a07a3 Issue 5032043: preparation for 802.11ad support
Daniel Halperin <daniel@halper.in>
parents: 7385
diff changeset
    78
uint64_t
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
WifiMode::GetDataRate (void) const
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
  return item->dataRate;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
    84
enum WifiCodeRate
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
    85
WifiMode::GetCodeRate (void) const
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
    88
  return item->codingRate;
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
    89
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
    90
uint8_t
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
WifiMode::GetConstellationSize (void) const
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    93
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
  return item->constellationSize;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
    96
std::string
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    97
WifiMode::GetUniqueName (void) const
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
    98
{
4331
771b9f0005d6 make ./waf check pass again.
Timo Bingmann <timo.bingmann@student.kit.edu>
parents: 3879
diff changeset
    99
  // needed for ostream printing of the invalid mode
1981
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
   100
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
   101
  return item->uniqueUid;
d2fda7b87289 implement operator << and an assert
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1966
diff changeset
   102
}
1909
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
   103
bool
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
   104
WifiMode::IsMandatory (void) const
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
   105
{
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
   106
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
   107
  return item->isMandatory;
4d1214bb8bc0 add WifiMode mandatory flag
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1887
diff changeset
   108
}
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   109
uint32_t
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
WifiMode::GetUid (void) const
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
  return m_uid;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
}
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   114
enum WifiModulationClass
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   115
WifiMode::GetModulationClass () const
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   116
{
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   117
  struct WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   118
  return item->modClass;
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4470
diff changeset
   119
}
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
WifiMode::WifiMode ()
1920
1d4864775cf8 replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1910
diff changeset
   121
  : m_uid (0)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   122
{
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   123
}
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
WifiMode::WifiMode (uint32_t uid)
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
  : m_uid (uid)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   126
{
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   127
}
3879
3a887a06b795 add a string-based constructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2675
diff changeset
   128
WifiMode::WifiMode (std::string name)
3a887a06b795 add a string-based constructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2675
diff changeset
   129
{
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   130
  *this = WifiModeFactory::GetFactory ()->Search (name);
3879
3a887a06b795 add a string-based constructor
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2675
diff changeset
   131
}
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
2582
3e28107b870f rename old VALUE leftovers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   133
ATTRIBUTE_HELPER_CPP (WifiMode);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   134
1887
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   135
WifiModeFactory::WifiModeFactory ()
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   136
{
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   137
}
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
5901
a24cd8dce646 bug 767: Incorrect modulation for 802.11a modes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4713
diff changeset
   139
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   140
WifiMode
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   141
WifiModeFactory::CreateWifiMode (std::string uniqueName,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   142
                                 enum WifiModulationClass modClass,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   143
                                 bool isMandatory,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   144
                                 uint32_t bandwidth,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   145
                                 uint32_t dataRate,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   146
                                 enum WifiCodeRate codingRate,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   147
                                 uint8_t constellationSize)
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
{
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
  WifiModeFactory *factory = GetFactory ();
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
  uint32_t uid = factory->AllocateUid (uniqueName);
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
  WifiModeItem *item = factory->Get (uid);
1984
c00b259986bd initialize uniqueUid field
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1981
diff changeset
   152
  item->uniqueUid = uniqueName;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   153
  item->modClass = modClass;
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   154
  // The modulation class for this WifiMode must be valid.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   155
  NS_ASSERT (modClass != WIFI_MOD_CLASS_UNKNOWN);
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   156
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4331
diff changeset
   157
  item->bandwidth = bandwidth;
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4331
diff changeset
   158
  item->dataRate = dataRate;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   159
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   160
  item->codingRate = codingRate;
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   161
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   162
  switch (codingRate)
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   163
    {
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7526
diff changeset
   164
    case WIFI_CODE_RATE_5_6:
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7526
diff changeset
   165
      item->phyRate = dataRate * 6 / 5;
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7526
diff changeset
   166
      break;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   167
    case WIFI_CODE_RATE_3_4:
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   168
      item->phyRate = dataRate * 4 / 3;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   169
      break;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   170
    case WIFI_CODE_RATE_2_3:
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   171
      item->phyRate = dataRate * 3 / 2;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   172
      break;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   173
    case WIFI_CODE_RATE_1_2:
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   174
      item->phyRate = dataRate * 2 / 1;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   175
      break;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   176
    case WIFI_CODE_RATE_UNDEFINED:
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   177
    default:
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   178
      item->phyRate = dataRate;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   179
      break;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   180
    }
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   181
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   182
  // Check for compatibility between modulation class and coding
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   183
  // rate. If modulation class is DSSS then coding rate must be
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   184
  // undefined, and vice versa. I could have done this with an
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   185
  // assertion, but it seems better to always give the error (i.e.,
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   186
  // not only in non-optimised builds) and the cycles that extra test
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   187
  // here costs are only suffered at simulation setup.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   188
  if ((codingRate == WIFI_CODE_RATE_UNDEFINED) != (modClass == WIFI_MOD_CLASS_DSSS))
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   189
    {
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   190
      NS_FATAL_ERROR ("Error in creation of WifiMode named " << uniqueName << std::endl
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   191
                                                             << "Code rate must be WIFI_CODE_RATE_UNDEFINED iff Modulation Class is WIFI_MOD_CLASS_DSSS");
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   192
    }
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   193
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   194
  item->constellationSize = constellationSize;
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4331
diff changeset
   195
  item->isMandatory = isMandatory;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   196
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4331
diff changeset
   197
  return WifiMode (uid);
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4331
diff changeset
   198
}
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   199
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   200
WifiMode
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   201
WifiModeFactory::Search (std::string name)
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4331
diff changeset
   202
{
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   203
  WifiModeItemList::const_iterator i;
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   204
  uint32_t j = 0;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   205
  for (i = m_itemList.begin (); i != m_itemList.end (); i++)
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   206
    {
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   207
      if (i->uniqueUid == name)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   208
        {
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   209
          return WifiMode (j);
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   210
        }
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   211
      j++;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   212
    }
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   213
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   214
  // If we get here then a matching WifiMode was not found above. This
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   215
  // is a fatal problem, but we try to be helpful by displaying the
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   216
  // list of WifiModes that are supported.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   217
  NS_LOG_UNCOND ("Could not find match for WifiMode named \""
7252
c8200621e252 rerun check-style.py with uncrustify-0.58
Tom Henderson <tomh@tomh.org>
parents: 7141
diff changeset
   218
                 << name << "\". Valid options are:");
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   219
  for (i = m_itemList.begin (); i != m_itemList.end (); i++)
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   220
    {
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   221
      NS_LOG_UNCOND ("  " << i->uniqueUid);
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   222
    }
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   223
  // Empty fatal error to die. We've already unconditionally logged
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   224
  // the helpful information.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   225
  NS_FATAL_ERROR ("");
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   226
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   227
  // This next line is unreachable because of the fatal error
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   228
  // immediately above, and that is fortunate, because we have no idea
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   229
  // what is in WifiMode (0), but we do know it is not what our caller
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   230
  // has requested by name. It's here only because it's the safest
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   231
  // thing that'll give valid code.
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   232
  return WifiMode (0);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   233
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   234
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
uint32_t
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
WifiModeFactory::AllocateUid (std::string uniqueUid)
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
{
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   238
  uint32_t j = 0;
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
  for (WifiModeItemList::const_iterator i = m_itemList.begin ();
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
       i != m_itemList.end (); i++)
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   241
    {
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   242
      if (i->uniqueUid == uniqueUid)
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   243
        {
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   244
          return j;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
   245
        }
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
      j++;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   247
    }
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   248
  uint32_t uid = m_itemList.size ();
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   249
  m_itemList.push_back (WifiModeItem ());
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   250
  return uid;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   251
}
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
1887
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   253
struct WifiModeFactory::WifiModeItem *
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   254
WifiModeFactory::Get (uint32_t uid)
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   255
{
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   256
  NS_ASSERT (uid < m_itemList.size ());
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   257
  return &m_itemList[uid];
1887
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   258
}
14b4e0b7870a add missing implementations
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1885
diff changeset
   259
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   260
WifiModeFactory *
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   261
WifiModeFactory::GetFactory (void)
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   263
  static bool isFirstTime = true;
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   264
  static WifiModeFactory factory;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   265
  if (isFirstTime)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   266
    {
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   267
      uint32_t uid = factory.AllocateUid ("Invalid-WifiMode");
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   268
      WifiModeItem *item = factory.Get (uid);
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   269
      item->uniqueUid = "Invalid-WifiMode";
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   270
      item->bandwidth = 0;
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   271
      item->dataRate = 0;
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   272
      item->phyRate = 0;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   273
      item->modClass = WIFI_MOD_CLASS_UNKNOWN;
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   274
      item->constellationSize = 0;
6360
d8975477ff6a Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents: 5901
diff changeset
   275
      item->codingRate = WIFI_CODE_RATE_UNDEFINED;
4713
3fdb8f60a863 bug 654: avoid segfault with ConfigStore loading
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4681
diff changeset
   276
      item->isMandatory = false;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   277
      isFirstTime = false;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2034
diff changeset
   278
    }
1885
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   279
  return &factory;
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   280
}
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   281
9ccfbfb25477 get a few more files to compile
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   282
} // namespace ns3