src/spectrum/model/spectrum-type.h
changeset 7841 2fe2efe0b4bc
parent 7840 2a669a0c452e
child 7842 b3edf14c5fcd
equal deleted inserted replaced
7840:2a669a0c452e 7841:2fe2efe0b4bc
     1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2009 CTTC
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License version 2 as
       
     7  * published by the Free Software Foundation;
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17  *
       
    18  * Author: Nicola Baldo <nbaldo@cttc.es>
       
    19  */
       
    20 
       
    21 #ifndef SPECTRUM_TYPE_H
       
    22 #define SPECTRUM_TYPE_H
       
    23 
       
    24 #include <iostream>
       
    25 #include <vector>
       
    26 #include <string>
       
    27 #include <stdint.h>
       
    28 
       
    29 namespace ns3 {
       
    30 
       
    31 
       
    32 /**
       
    33  * \ingroup spectrum
       
    34  *
       
    35  * This class represent a type of signal that can be transmitted by
       
    36  * SpectrumPhy instances over a SpectrumChannel. By means of this
       
    37  * class a SpectrumPhy is able to recognize which type of signals it
       
    38  * is able to decode (i.e., receive) and which are to be considered
       
    39  * only as a source of interference. Note that this distinction of
       
    40  * signal types is an abstraction which is introduced only for
       
    41  * simulation purposes: in the real world a device needs to infer
       
    42  * whether a signal is of a known type by examining at properties of the
       
    43  * signal, such as preamble, CRC fields, etc.
       
    44  *
       
    45  */
       
    46 class SpectrumType
       
    47 {
       
    48   friend class SpectrumTypeFactory;
       
    49 
       
    50 public:
       
    51   uint32_t GetUid () const;
       
    52   std::string GetName () const;
       
    53 
       
    54 private:
       
    55   SpectrumType (uint32_t m_uid);
       
    56   uint32_t m_uid;
       
    57 };
       
    58 
       
    59 
       
    60 bool operator== (const SpectrumType& lhs, const SpectrumType& rhs);
       
    61 bool operator!= (const SpectrumType& lhs, const SpectrumType& rhs);
       
    62 std::ostream& operator<< (std::ostream& os, const SpectrumType& rhs);
       
    63 
       
    64 
       
    65 
       
    66 /**
       
    67  * \ingroup spectrum
       
    68  *
       
    69  */
       
    70 class SpectrumTypeFactory
       
    71 {
       
    72 
       
    73 public:
       
    74   static SpectrumType Create (std::string name);
       
    75   static std::string GetNameByUid (uint32_t uid);
       
    76 
       
    77 private:
       
    78   static std::vector<std::string> m_names;
       
    79 };
       
    80 
       
    81 
       
    82 } // namespace ns3
       
    83 
       
    84 
       
    85 #endif /*  SPECTRUM_TYPE_H */