User Manual, Developers Guide and API Documentation

None.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-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_LDK_ARQ_NONE_HPP
00029 #define WNS_LDK_ARQ_NONE_HPP
00030 
00031 #include <WNS/ldk/arq/ARQ.hpp>
00032 #include <WNS/ldk/fu/Plain.hpp>
00033 #include <WNS/ldk/Forwarding.hpp>
00034 #include <WNS/ldk/SuspendableInterface.hpp>
00035 #include <WNS/ldk/SuspendSupport.hpp>
00036 
00037 #include <WNS/pyconfig/View.hpp>
00038 
00039 namespace wns { namespace ldk { namespace arq {
00040 
00041     class NoneCommand :
00042         public ARQCommand
00043     {
00044     public:
00045         virtual bool
00046         isACK() const
00047         {
00048             return false;
00049         }
00050 
00051         struct {} local;
00052         struct {} peer;
00053         struct {} magic;
00054     };
00055 
00056     /*
00057      * @brief Forwarding only FunctionalUnit conforming to the ARQ interface
00058      */
00059     class None :
00060         public ARQ,
00061         public wns::ldk::fu::Plain<None, NoneCommand>,
00062         public Delayed<None>,
00063         virtual public SuspendableInterface,
00064         public SuspendSupport
00065     {
00066     public:
00067         None(fun::FUN* fuNet, const wns::pyconfig::View& config) :
00068                 ARQ(config),
00069                 wns::ldk::fu::Plain<None, NoneCommand>(fuNet),
00070                 Delayed<None>(),
00071                 SuspendSupport(fuNet, config),
00072 
00073                 compound()
00074         {}
00075 
00076 
00077         // Delayed interface realisation
00078         virtual bool hasCapacity() const
00079         {
00080             return !compound;
00081         } // hasCapacity
00082 
00083         virtual void
00084         processOutgoing(const CompoundPtr& _compound)
00085         {
00086             assure(hasCapacity(), "yeye, something went wrong.");
00087 
00088             compound = _compound;
00089             activateCommand(compound->getCommandPool());
00090         } // processOutgoing
00091 
00092         // virtual const CompoundPtr hasSomethingToSend() const; // implemented by ARQ
00093         // virtual CompoundPtr getSomethingToSend(); // implemented by ARQ
00094 
00095         virtual void
00096         processIncoming(const CompoundPtr& compound)
00097         {
00098             getDeliverer()->getAcceptor(compound)->onData(compound);
00099         } // processIncoming
00100 
00101 
00102         // ARQ interface realization
00103         virtual const wns::ldk::CompoundPtr hasACK() const
00104         {
00105             return CompoundPtr();
00106         } // hasACK
00107 
00108         virtual const wns::ldk::CompoundPtr hasData() const
00109         {
00110             return compound;
00111         } // hasData
00112 
00113         virtual wns::ldk::CompoundPtr getACK()
00114         {
00115             return CompoundPtr();
00116         } // getACK;
00117 
00118         virtual wns::ldk::CompoundPtr getData()
00119         {
00120             CompoundPtr it = compound;
00121             compound = CompoundPtr();
00122             return it;
00123         } // getData
00124 
00125     private:
00126         virtual bool onSuspend() const
00127         {
00128             return !compound;
00129         } // onSuspend
00130 
00131         CompoundPtr compound;
00132     };
00133 
00134 }}}
00135 
00136 #endif // NOT defined WNS_LDK_ARQ_NONE_HPP
00137 
00138 
00139 

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