![]() |
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. 5, 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 #ifndef WNS_SERVICE_DLL_ADDRESS_HPP 00029 #define WNS_SERVICE_DLL_ADDRESS_HPP 00030 00031 #include <WNS/osi/PDU.hpp> 00032 00033 #include <stdint.h> 00034 #include <set> 00035 #include <ostream> 00036 00037 namespace wns { namespace service { namespace dll { 00038 00044 class Address 00045 { 00046 public: 00047 virtual 00048 ~Address() 00049 {}; 00050 }; // Address 00051 00057 class UnicastAddress : 00058 virtual public Address 00059 { 00060 public: 00064 static const long int invalid; 00065 00069 UnicastAddress(); 00070 00074 explicit 00075 UnicastAddress(long int _address); 00076 00080 virtual 00081 ~UnicastAddress(); 00082 00086 virtual bool 00087 operator <(const UnicastAddress& other) const; 00088 00092 virtual bool 00093 operator ==(const UnicastAddress& other) const; 00094 00098 virtual bool 00099 operator !=(const UnicastAddress& other) const; 00100 00104 friend std::ostream& 00105 operator<<(std::ostream& str, const UnicastAddress& address) 00106 { 00107 str << address.address; 00108 return str; 00109 } 00110 00114 friend std::istream& 00115 operator>>(std::istream &str, UnicastAddress& address) 00116 { 00117 long int tmp; 00118 str >> tmp; 00119 00120 address.address = tmp; 00121 if(!(address.address > 0)) 00122 { 00123 wns::Exception e; 00124 e << "Address must be greater than 0. Was: " << tmp; 00125 throw e; 00126 } 00127 return str; 00128 } 00129 00133 bool 00134 isValid() const; 00135 00139 long int 00140 getInteger() const; 00141 00142 private: 00146 long int address; 00147 }; // UnicastAddress 00148 00157 class BroadcastAddress : 00158 virtual public Address 00159 { 00160 }; // BroadcastAddress 00161 00162 } // dll 00163 } // service 00164 } // wns 00165 00166 #endif // NOT defined WNS_SERVICE_DLL_ADDRESS_HPP 00167 00168 00169
1.5.5