User Manual, Developers Guide and API Documentation

PhaseDescriptor.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 #ifndef WNS_LDK_FCF_PHASEDESCRIPTOR_H
00028 #define WNS_LDK_FCF_PHASEDESCRIPTOR_H
00029 
00030 #include <WNS/Cloneable.hpp>
00031 #include <WNS/SmartPtr.hpp>
00032 #include <WNS/StaticFactory.hpp>
00033 
00034 #include <WNS/ldk/fcf/FrameBuilderConfigCreator.hpp>
00035 
00036 namespace wns { namespace ldk {
00037 
00038     class FunctionalUnit;
00039 
00040     namespace fcf {
00041 
00042         class FrameBuilder;
00043         class CompoundCollectorInterface;
00044 
00050         enum DurationPolicy
00051             {
00052                 Fixed = 1,
00053                 Expanding = 2
00054             };
00055 
00061         class PhaseDescriptorInterface
00062         {
00063         public:
00064             virtual ~PhaseDescriptorInterface() {}
00065 
00069             virtual std::string getName() const = 0;
00070 
00074             virtual void onFUNCreated() = 0;
00075 
00079             //virtual void setMaximumDuration() = 0;
00080 
00084             virtual CompoundCollectorInterface*
00085             getCompoundCollector() const = 0;
00086 
00087         };
00088 
00099         class PhaseDescriptor
00100             : public PhaseDescriptorInterface,
00101               virtual public wns::RefCountable
00102         {
00103         public:
00104             PhaseDescriptor( FrameBuilder* frameBuilder, const wns::pyconfig::View& config );
00105 
00106 
00107             std::string getName() const { return name_; }
00108 
00109             void onFUNCreated();
00110 
00111             bool operator==(const PhaseDescriptor& rhs) const
00112             {
00113                 return name_ == rhs.name_;
00114             }
00115 
00116             FrameBuilder* getFrameBuilder() const
00117             {
00118                 assure( frameBuilder_, "frame builder not specified yet" );
00119                 return frameBuilder_;
00120             }
00121 
00122             CompoundCollectorInterface* getCompoundCollector() const
00123             {
00124                 assure( compoundCollector_, "CompoundCollector not specified yet");
00125                 return compoundCollector_;
00126             }
00127 
00128             void setName( const std::string& name ) { name_ = name; }
00129 
00130         protected:
00131             std::string name_;
00132             FrameBuilder* frameBuilder_;
00133             wns::pyconfig::View config_;
00134             CompoundCollectorInterface* compoundCollector_;
00135 
00136             friend class FrameBuilder;
00137         };
00138 
00139         typedef wns::SmartPtr<PhaseDescriptor> PhaseDescriptorPtr;
00140 
00141         typedef FrameBuilderConfigCreator<PhaseDescriptor> PhaseDescriptorCreator;
00142         typedef wns::StaticFactory<PhaseDescriptorCreator> PhaseDescriptorFactory;
00143 
00152         class BasicPhaseDescriptor
00153             : public PhaseDescriptor,
00154               public wns::Cloneable<BasicPhaseDescriptor>
00155         {
00156         public:
00157             BasicPhaseDescriptor( FrameBuilder* frameBuilder,
00158                           const wns::pyconfig::View& config ):
00159                 PhaseDescriptor( frameBuilder, config ),
00160                 wns::Cloneable<BasicPhaseDescriptor>()
00161             {}
00162 
00163             wns::CloneableInterface* clone() const
00164             {
00165                 return wns::Cloneable<BasicPhaseDescriptor>::clone();
00166             }
00167         };
00168 }}}
00169 #endif
00170 

Generated on Fri May 25 03:31:42 2012 for openWNS by  doxygen 1.5.5