User Manual, Developers Guide and API Documentation

Classifier.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 
00030 #ifndef WIMAC_CLASSIFIER_HPP
00031 #define WIMAC_CLASSIFIER_HPP
00032 
00033 #include <WNS/ldk/ldk.hpp>
00034 #include <WNS/ldk/CommandTypeSpecifier.hpp>
00035 #include <WNS/ldk/HasReceptor.hpp>
00036 #include <WNS/ldk/HasConnector.hpp>
00037 #include <WNS/ldk/HasDeliverer.hpp>
00038 #include <WNS/ldk/Processor.hpp>
00039 #include <WNS/Cloneable.hpp>
00040 
00041 #include <WNS/ldk/Classifier.hpp>
00042 
00043 
00044 namespace wns {
00045     namespace ldk {
00046 
00047         class CommandPool;
00048     }
00049 }
00050 
00051 namespace wimac {
00052     class UpperConvergence;
00053 
00054     namespace service {
00055         class ConnectionManager;
00056     }
00057 
00058     class Component;
00059 
00074     class ConnectionClassifier :
00075         public virtual wns::ldk::FunctionalUnit,
00076         public wns::ldk::CommandTypeSpecifier< wns::ldk::ClassifierCommand >,
00077         public wns::ldk::HasReceptor<>,
00078         public wns::ldk::HasConnector<>,
00079         public wns::ldk::HasDeliverer<>,
00080         public wns::Cloneable< ConnectionClassifier >
00081     {
00082     public:
00083         ConnectionClassifier( wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config );
00084         virtual void doOnData( const wns::ldk::CompoundPtr& compound);
00085         virtual void doSendData( const wns::ldk::CompoundPtr& compound);
00086 
00087         virtual
00088         wns::ldk::ClassificationID
00089         classifyIncoming( const wns::ldk::CompoundPtr& compound );
00090 
00091         virtual
00092         wns::ldk::ClassificationID
00093         classifyOutgoing( const wns::ldk::CompoundPtr& compound );
00094 
00095         virtual
00096         wns::ldk::CommandPool*
00097         createReply(const wns::ldk::CommandPool* original) const;
00098 
00099     private:
00100         virtual
00101         void
00102         doWakeup(){ getReceptor()->wakeup(); }
00103 
00104         virtual 
00105         bool
00106         doIsAccepting(const wns::ldk::CompoundPtr& compound) const;
00107 
00108         void
00109         onFUNCreated();
00110 
00111         struct {
00112             UpperConvergence* upperConvergence;
00113             service::ConnectionManager* connectionManager;
00114             Component* component;
00115         } friends_;
00116 
00117     };
00118 
00122     class ClassifierMock :
00123         public ConnectionClassifier,
00124         public wns::Cloneable< ClassifierMock >
00125     {
00126     public:
00127         ClassifierMock( wns::ldk::fun::FUN* fun, const wns::pyconfig::View& config) :
00128             ConnectionClassifier(fun, config)
00129         {}
00130 
00131         virtual void
00132         doOnData( const wns::ldk::CompoundPtr&)
00133         {
00134             assure(0, "This is only a mock");
00135         }
00136 
00137         virtual void
00138         doSendData( const wns::ldk::CompoundPtr&)
00139         {
00140             assure(0, "This is only a mock");
00141         }
00142 
00143         virtual
00144         wns::ldk::ClassificationID
00145         classifyIncoming( const wns::ldk::CompoundPtr& )
00146         {
00147             assure(0, "This is only a mock");
00148             return wns::ldk::ClassificationID();
00149         }
00150 
00151         virtual
00152         wns::ldk::ClassificationID
00153         classifyOutgoing( const wns::ldk::CompoundPtr& )
00154         {
00155             assure(0, "This is only a mock");
00156             return wns::ldk::ClassificationID();
00157         }
00158 
00159         virtual
00160         wns::ldk::CommandPool*
00161         createReply(const wns::ldk::CommandPool*) const
00162         {
00163             assure(0, "This is only a mock");
00164             return NULL;
00165         }
00166 
00167         virtual
00168         wns::CloneableInterface*
00169         clone() const
00170         {
00171             return wns::Cloneable<ClassifierMock>::clone();
00172         }
00173 
00174     private:
00175         virtual 
00176         void
00177         doWakeup()
00178         {
00179             assure(0, "This is only a mock");
00180         }
00181 
00182         virtual
00183         bool
00184         doIsAccepting(const wns::ldk::CompoundPtr&) const
00185         {
00186             assure(0, "This is only a mock");
00187             return false;
00188         }
00189 
00190         void
00191         onFUNCreated(){}
00192 
00193         struct {
00194             UpperConvergence* upperConvergence;
00195             service::ConnectionManager* connectionManager;
00196             wimac::Component* layer;
00197         } friends_;
00198     };
00199 }
00200 
00201 #endif
00202 

Generated on Sun May 27 03:31:41 2012 for openWNS by  doxygen 1.5.5