A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
capability-information.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2006 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 #include "capability-information.h"
21 
22 namespace ns3 {
23 
25  : m_capability (0)
26 {
27 }
28 
29 void
31 {
32  Set (0);
33  Clear (1);
34 }
35 void
37 {
38  Clear (0);
39  Set (1);
40 }
41 
42 bool
44 {
45  return Is (0);
46 }
47 bool
49 {
50  return Is (1);
51 }
52 
53 void
55 {
56  uint32_t mask = 1 << n;
57  m_capability |= mask;
58 }
59 
60 void
62 {
63  uint32_t mask = 1 << n;
64  m_capability &= ~mask;
65 }
66 
67 bool
68 CapabilityInformation::Is (uint8_t n) const
69 {
70  uint32_t mask = 1 << n;
71  return (m_capability & mask) == mask;
72 }
73 
74 
75 uint32_t
77 {
78  return 2;
79 }
82 {
84  return start;
85 }
88 {
89  m_capability = start.ReadLsbtohU16 ();
90  return start;
91 }
92 
93 
94 } // namespace ns3