User Manual, Developers Guide and API Documentation

ConnectionManager.hpp

Go to the documentation of this file.
00001 /*******************************************************************************
00002  * This file is part of openWNS (open Wireless Network Simulator)
00003  * _____________________________________________________________________________
00004  *
00005  * Copyright (C) 2004-2009
00006  * Chair of Communication Networks (ComNets)
00007  * Kopernikusstr. 5, D-52074 Aachen, Germany
00008  * email: info@openwns.org
00009  * www: http://www.openwns.org
00010  * _____________________________________________________________________________
00011  *
00012  * openWNS is free software; you can redistribute it and/or modify it under the
00013  * terms of the GNU Lesser General Public License version 2 as published by the
00014  * Free Software Foundation;
00015  *
00016  * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY
00017  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00018  * A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
00019  * details.
00020  *
00021  * You should have received a copy of the GNU Lesser General Public License
00022  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023  *
00024  ******************************************************************************/
00025 
00031 #ifndef WIMAC_SERVICES_CONNECTIONMANAGER_HPP
00032 #define WIMAC_SERVICES_CONNECTIONMANAGER_HPP
00033 
00034 #include <WNS/ldk/ldk.hpp>
00035 #include <list>
00036 #include <WNS/Cloneable.hpp>
00037 #include <WNS/SmartPtr.hpp>
00038 #include <WNS/ldk/ManagementServiceInterface.hpp>
00039 #include <WNS/Subject.hpp>
00040 
00041 #include <WIMAC/Component.hpp>
00042 #include <WIMAC/ConnectionIdentifier.hpp>
00043 #include <WIMAC/ConnectionRule.hpp>
00044 #include <WIMAC/Logger.hpp>
00045 
00046 namespace wns {
00047     namespace ldk {
00048         class ManagementServiceRegistry;
00049     }
00050 }
00051 
00052 namespace wimac {
00053 
00054 
00055     namespace service {
00056 
00057         class CIDNotFound :
00058             public wns::Exception
00059         {
00060         public:
00061             CIDNotFound(int line, const char* file) :
00062                 wns::Exception()
00063             {
00064                 *this << "Connection Identifier not found in "
00065                       << file << ":" << line;
00066             }
00067         private:
00068             CIDNotFound();
00069         };
00070 
00078         class ConnectionManagerInterface
00079         {
00080         public:
00081 
00082             ConnectionIdentifierPtr
00083             virtual getBasicConnectionFor( const ConnectionIdentifier::CID cid ) = 0;
00084             virtual ~ConnectionManagerInterface() {}
00085 
00086         };
00087 
00088         class ConnectionDeletedNotification {
00089         public:
00090             virtual void notifyAboutConnectionDeleted( const ConnectionIdentifier ) = 0;
00091             virtual ~ConnectionDeletedNotification(){}
00092         };
00093 
00106         class ConnectionManager :
00107             public ConnectionManagerInterface,
00108             public wns::ldk::ManagementService,
00109             public wns::Subject<ConnectionDeletedNotification>
00110         {
00111 
00112             typedef wns::Subject<ConnectionDeletedNotification> Subject;
00113         public:
00114 
00115             ConnectionManager( wns::ldk::ManagementServiceRegistry* msr,
00116                                const wns::pyconfig::View& config);
00117 
00118             explicit ConnectionManager( const wns::pyconfig::View& config);
00119 
00120             ConnectionManager( const ConnectionManager& other );
00121 
00122 
00127             ConnectionIdentifier
00128             appendConnection( const ConnectionIdentifier& connection );
00129 
00133             void
00134             deleteAllConnections();
00135 
00140             void
00141             deleteConnectionsForBS( ConnectionIdentifier::StationID baseStation );
00142 
00147             void
00148             deleteConnectionsForSS( ConnectionIdentifier::StationID subscriberStation );
00149 
00153             void
00154             deleteCI( ConnectionIdentifier::CID cid );
00155 
00160             void
00161             changeConnection( const ConnectionIdentifier& connection );
00162 
00167             void
00168             changeConnections( ConnectionIdentifiers& connections );
00169 
00170 
00183             ConnectionIdentifierPtr
00184             findConnection( const wns::ldk::CompoundPtr& compound ) const;
00185 
00186 
00191             ConnectionIdentifierPtr
00192             getConnection( const wns::ldk::CompoundPtr& compound ) const;
00193 
00194 
00199             ConnectionIdentifiers
00200             getAllConnections();
00201 
00206             ConnectionIdentifiers
00207             getAllCIForSS( ConnectionIdentifier::StationID subscriberStation ) const;
00208 
00213             ConnectionIdentifiers
00214             getAllCIForBS( ConnectionIdentifier::StationID baseStation );
00215 
00220             ConnectionIdentifiers
00221             getIncomingConnections ( ConnectionIdentifier::StationID from );
00222 
00223 
00228             ConnectionIdentifiers
00229             getIncomingDataConnections(ConnectionIdentifier::StationID from, 
00230                                        ConnectionIdentifier::QoSCategory);
00231 
00236             ConnectionIdentifiers
00237             getOutgoingConnections( ConnectionIdentifier::StationID to);
00238 
00243             ConnectionIdentifiers
00244             getOutgoingDataConnections(ConnectionIdentifier::StationID to, 
00245                                        ConnectionIdentifier::QoSCategory);
00246 
00252             ConnectionIdentifiers
00253             getAllDataConnections(int direction, 
00254                                   ConnectionIdentifier::QoSCategory);
00255 
00256             ConnectionIdentifiers
00257             getAllDataConnections(int direction);
00258 
00259 
00268             ConnectionIdentifierPtr getSpecialConnection(
00269                 ConnectionIdentifier::ConnectionType connectionType,
00270                 ConnectionIdentifier::StationID baseStation,
00271                 ConnectionIdentifier::StationID subscriber );
00272 
00273 
00282             ConnectionIdentifierPtr
00283             getBasicConnectionFor( const ConnectionIdentifier::CID cid );
00284 
00285 
00292             ConnectionIdentifierPtr
00293             getBasicConnectionFor( const StationID subscriberStation ) const;
00294 
00299             ConnectionIdentifierPtr
00300             getPrimaryConnectionFor( ConnectionIdentifier::StationID stationID ) const;
00301 
00305             ConnectionIdentifierPtr
00306             getConnectionWithID( ConnectionIdentifier::CID cid ) const;
00307 
00311             ConnectionIdentifiers getAllBasicConnections() const;
00312 
00313 
00317             void
00318             decreaseCINotListening();
00319 
00320             void onMSRCreated();
00321 
00322             ConnectionIdentifier::CID getAndIncreaseHighestCellCID();
00323 
00324         private:
00329             void singularityDelete(const ConnectionIdentifierPtr ci);
00330 
00335             void doubleBasicCIDeleteAllOtherCI(const ConnectionIdentifierPtr ci);
00336 
00337             ConnectionIdentifiers connectionIdentifiers_;
00338 
00339             ConnectionIdentifier::CID highestCID_;
00340 
00344             Component* layer_;
00345 
00349             wns::pyconfig::View config_;
00350         };
00351     }
00352 }
00353 #endif
00354 

Generated on Tue May 22 03:32:10 2012 for openWNS by  doxygen 1.5.5