![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #include <WNS/osi/PCI.hpp> 00029 00030 #include <sstream> 00031 00032 using namespace wns::osi; 00033 00035 00036 PCI::PCI(pduType aPDUType, const unsigned long int aPDULength) : 00037 p_pdu(aPDUType), 00038 p_pduLength(aPDULength), 00039 p_sduPtr(PDUPtr()) 00040 { 00041 p_pduId = p_pduIdCounter++; 00042 } 00043 00044 PCI::PCI(const PCI& that) : 00045 //wns::RefCountable(), 00046 wns::IOutputStreamable(), 00047 p_pdu(that.p_pdu), 00048 p_pduId(that.p_pduId), 00049 p_pduLength(that.p_pduLength), 00050 p_sduPtr(that.getSDU()) 00051 { 00052 } 00053 00055 PCI::~PCI() 00056 { 00057 } 00058 00060 void PCI::print(std::ostream& aStreamRef) const 00061 { 00062 aStreamRef << "pdu = " << p_pdu << std::endl 00063 << "pduId = " << p_pduId << std::endl 00064 << "pduIdCounter = " << p_pduIdCounter << std::endl; 00065 aStreamRef << "p_pduLength = " << p_pduLength << std::endl; 00066 } 00067 00068 std::string 00069 PCI::doToString() const 00070 { 00071 std::stringstream ss; 00072 ss << "pdu = " << p_pdu << std::endl 00073 << "pduId = " << p_pduId << std::endl 00074 << "pduIdCounter = " << p_pduIdCounter << std::endl; 00075 ss << "p_pduLength = " << p_pduLength << std::endl; 00076 return ss.str(); 00077 } 00078 00080 void PCI::setPDUType(pduType aPDUType) 00081 { 00082 p_pdu = aPDUType; 00083 } 00084 00086 pduType PCI::getPDUType() const 00087 { 00088 return p_pdu; 00089 } 00090 00092 unsigned long int PCI::getPDUId() const 00093 { 00094 return p_pduId; 00095 } 00096 00097 // Set length of PDU 00098 void PCI::setPDULength(Bit aPDULength) 00099 { 00100 p_pduLength = aPDULength; 00101 } 00102 00103 // Get length of PDU 00104 Bit PCI::getPDULength() const 00105 { 00106 return getSize() + getSDUSize(); 00107 } 00108 00109 Bit 00110 PCI::getSize() const 00111 { 00112 return 0; 00113 } // getSize 00114 00115 Bit 00116 PCI::getSDUSize() const 00117 { 00118 return p_pduLength; 00119 } // getSDUSize 00120 00121 void 00122 PCI::setSDU(PDUPtr& sdu) 00123 { 00124 p_sduPtr = sdu; 00125 } // setSDU 00126 00127 PDUPtr 00128 PCI::getSDU() const 00129 { 00130 return p_sduPtr; 00131 } // getSDU 00132 00135 unsigned long int PCI::p_pduIdCounter = 1; 00136 00137 /* 00138 Local Variables: 00139 mode: c++ 00140 folded-file: t 00141 End: 00142 */ 00143 00144
1.5.5