src/uan/model/uan-tx-mode.cc
author Vedran Miletić <rivanvx@gmail.com>
Tue, 02 Aug 2011 17:42:33 -0400
changeset 7385 10beb0e53130
parent 6852 8f1a53d3f6ca
child 9796 502941b3a95f
permissions -rw-r--r--
standardize emacs c++ mode comments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 6852
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6478
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     2
/*
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     3
 * Copyright (c) 2009 University of Washington
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     4
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     8
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    12
 * GNU General Public License for more details.
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    13
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    17
 *
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    18
 * Author: Leonard Tracy <lentracy@gmail.com>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    19
 */
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    20
#include "uan-tx-mode.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    21
#include "ns3/log.h"
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    22
#include <map>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    23
#include <utility>
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    24
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    25
NS_LOG_COMPONENT_DEFINE ("UanTxMode");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    26
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    27
namespace ns3 {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    28
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    29
UanTxMode::UanTxMode ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    30
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    31
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    32
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    33
UanTxMode::~UanTxMode ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    34
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    35
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    36
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    37
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    38
UanTxMode::ModulationType
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    39
UanTxMode::GetModType (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    40
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    41
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_type;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    42
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    43
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    44
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    45
UanTxMode::GetDataRateBps (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    46
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    47
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_dataRateBps;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    48
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    49
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    50
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    51
UanTxMode::GetPhyRateSps (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    52
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    53
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_phyRateSps;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    54
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    55
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    56
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    57
UanTxMode::GetCenterFreqHz (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    58
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    59
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_cfHz;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    60
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    61
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    62
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    63
UanTxMode::GetBandwidthHz (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    64
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    65
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_bwHz;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    66
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    67
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    68
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    69
UanTxMode::GetConstellationSize (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    70
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    71
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_constSize;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    72
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    73
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    74
std::string
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    75
UanTxMode::GetName (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    76
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    77
  return UanTxModeFactory::GetFactory ().GetModeItem (m_uid).m_name;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    78
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    79
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    80
uint32_t 
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    81
UanTxMode::GetUid (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    82
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    83
  return m_uid;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    84
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    85
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    86
std::ostream &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    87
operator<< (std::ostream & os, const UanTxMode &mode)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    88
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    89
  os << mode.m_uid;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    90
  return os;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    91
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    92
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    93
std::istream &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    94
operator>> (std::istream & is, UanTxMode &mode)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    95
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    96
  std::string name;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    97
  uint32_t duh;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    98
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
    99
  is >> duh;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   100
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   101
  mode.m_uid = duh;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   102
  return is;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   103
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   104
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   105
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   106
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   107
UanTxModeFactory::UanTxModeFactory ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   108
  : m_nextUid (0)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   109
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   110
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   111
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   112
UanTxModeFactory::~UanTxModeFactory ()
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   113
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   114
  m_modes.clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   115
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   116
bool
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   117
UanTxModeFactory::NameUsed (std::string name)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   118
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   119
  std::map<uint32_t, UanTxModeItem>::iterator it = m_modes.begin ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   120
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   121
  for (; it != m_modes.end (); it++)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   122
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   123
      if ((*it).second.m_name == name)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   124
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   125
          return true;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   126
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   127
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   128
  return false;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   129
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   130
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   131
UanTxMode
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   132
UanTxModeFactory::CreateMode (UanTxMode::ModulationType type,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   133
                              uint32_t dataRateBps,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   134
                              uint32_t phyRateSps,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   135
                              uint32_t cfHz,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   136
                              uint32_t bwHz,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   137
                              uint32_t constSize,
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   138
                              std::string name)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   139
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   140
  UanTxModeFactory &factory = UanTxModeFactory::GetFactory ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   141
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   142
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   143
  UanTxModeItem *item;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   144
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   145
  if (factory.NameUsed (name))
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   146
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   147
      NS_LOG_WARN ("Redefining UanTxMode with name \"" << name << "\"");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   148
      item = &factory.GetModeItem (name);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   149
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   150
  else
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   151
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   152
      item = &factory.m_modes[factory.m_nextUid];
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   153
      item->m_uid = factory.m_nextUid++;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   154
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   155
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   156
  item->m_type = type;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   157
  item->m_dataRateBps = dataRateBps;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   158
  item->m_phyRateSps = phyRateSps;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   159
  item->m_cfHz = cfHz;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   160
  item->m_bwHz = bwHz;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   161
  item->m_constSize = constSize;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   162
  item->m_name = name;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   163
  return factory.MakeModeFromItem (*item);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   164
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   165
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   166
UanTxModeFactory::UanTxModeItem &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   167
UanTxModeFactory::GetModeItem (uint32_t uid)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   168
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   169
  if (uid >= m_nextUid)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   170
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   171
      NS_FATAL_ERROR ("Attempting to retrieve UanTxMode with uid, "
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   172
                      << uid << ", >= m_nextUid");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   173
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   174
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   175
  return m_modes[uid];
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   176
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   177
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   178
UanTxModeFactory::UanTxModeItem &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   179
UanTxModeFactory::GetModeItem (std::string name)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   180
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   181
  std::map<uint32_t, UanTxModeItem>::iterator it = m_modes.begin ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   182
  for (; it != m_modes.end (); it++)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   183
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   184
      if ((*it).second.m_name == name)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   185
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   186
          return (*it).second;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   187
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   188
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   189
  NS_FATAL_ERROR ("Unknown mode, \"" << name << "\", requested from mode factory");
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   190
  return (*it).second;  // dummy to get rid of warning
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   191
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   192
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   193
UanTxMode
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   194
UanTxModeFactory::GetMode (std::string name)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   195
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   196
  UanTxModeFactory &factory = UanTxModeFactory::GetFactory ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   197
  return factory.MakeModeFromItem (factory.GetModeItem (name));
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   198
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   199
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   200
UanTxMode
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   201
UanTxModeFactory::GetMode (uint32_t uid)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   202
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   203
  UanTxModeFactory &factory = UanTxModeFactory::GetFactory ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   204
  return factory.MakeModeFromItem (factory.GetModeItem (uid));
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   205
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   206
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   207
UanTxMode
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   208
UanTxModeFactory::MakeModeFromItem (const UanTxModeItem &item)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   209
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   210
  UanTxMode mode;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   211
  mode.m_uid = item.m_uid;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   212
  return mode;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   213
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   214
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   215
UanTxModeFactory &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   216
UanTxModeFactory::GetFactory (void)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   217
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   218
  static UanTxModeFactory factory;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   219
  return factory;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   220
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   221
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   222
UanModesList::UanModesList (void)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   223
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   224
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   225
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   226
UanModesList::~UanModesList (void)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   227
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   228
  m_modes.clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   229
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   230
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   231
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   232
UanModesList::AppendMode (UanTxMode newMode)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   233
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   234
  m_modes.push_back (newMode);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   235
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   236
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   237
void
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   238
UanModesList::DeleteMode (uint32_t modeNum)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   239
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   240
  NS_ASSERT (modeNum < m_modes.size ());
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   241
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   242
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   243
  std::vector<UanTxMode>::iterator it = m_modes.begin ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   244
  for (uint32_t i = 0; i < modeNum; i++)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   245
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   246
      it++;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   247
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   248
  it = m_modes.erase (it);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   249
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   250
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   251
UanTxMode
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   252
UanModesList::operator[] (uint32_t i) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   253
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   254
  NS_ASSERT (i < m_modes.size ());
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   255
  return m_modes[i];
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   256
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   257
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   258
uint32_t
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   259
UanModesList::GetNModes (void) const
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   260
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   261
  return m_modes.size ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   262
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   263
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   264
std::ostream &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   265
operator << (std::ostream &os, const UanModesList &ml)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   266
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   267
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   268
  os << ml.GetNModes () << "|";
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   269
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   270
  for (uint32_t i = 0; i < ml.m_modes.size (); i++)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   271
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   272
      os << ml[i] << "|";
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   273
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   274
  return os;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   275
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   276
std::istream &
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   277
operator >> (std::istream &is, UanModesList &ml)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   278
{
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   279
  char c;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   280
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   281
  int numModes;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   282
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   283
  is >> numModes >> c;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   284
  if (c != '|')
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   285
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   286
      is.setstate (std::ios_base::failbit);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   287
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   288
  ml.m_modes.clear ();
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   289
  ml.m_modes.resize (numModes);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   290
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   291
  for (int i = 0; i < numModes; i++)
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   292
    {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   293
      is >> ml.m_modes[i] >> c;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   294
      if (c != '|')
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   295
        {
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   296
          is.setstate (std::ios_base::failbit);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   297
        }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   298
    }
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   299
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   300
  return is;
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   301
}
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   302
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   303
ATTRIBUTE_HELPER_CPP (UanModesList);
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   304
b401db8531f5 Bug 970 - move UAN over to new directory structure
Josh Pelkey <jpelkey@gatech.edu>
parents:
diff changeset
   305
} // namespace ns3