User Manual, Developers Guide and API Documentation

HasConnector.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_HASCONNECTOR_HPP
00029 #define WNS_LDK_HASCONNECTOR_HPP
00030 
00031 #include <WNS/ldk/HasConnectorInterface.hpp>
00032 #include <WNS/ldk/ConnectorRegistry.hpp>
00033 #include <WNS/ldk/SinglePort.hpp>
00034 #include <WNS/ldk/SingleConnector.hpp>
00035 
00036 
00037 namespace wns { namespace ldk {
00038 
00043         namespace hasconnector
00044         {
00049             typedef SingleConnector DefaultConnectorStrategy;
00050         }
00051 
00057         template <typename CONNECTORTYPE = hasconnector::DefaultConnectorStrategy,
00058                   typename PORTID = SinglePort>
00059         class HasConnector
00060             : public virtual HasConnectorInterface,
00061               public virtual ConnectorRegistry
00062         {
00063         public:
00064             HasConnector()
00065                 : ConnectorRegistry(),
00066                   lower_()
00067             {
00068                 addToConnectorRegistry(PORTID().name, &lower_);
00069             }
00070 
00071         HasConnector(const HasConnector& other)
00072                 : ConnectorRegistry(),
00073                   lower_()
00074             {
00075                 addToConnectorRegistry(PORTID().name, &lower_);
00076             }
00077 
00078             HasConnector(ConnectorRegistry* cr)
00079                 : ConnectorRegistry(),
00080                   lower_()
00081             {
00082                 cr->addToConnectorRegistry(PORTID().name, &lower_);
00083             }
00084 
00085             virtual
00086             ~HasConnector()
00087             {}
00088 
00089             CONNECTORTYPE*
00090             getConnector() const
00091             {
00092                 return &lower_;
00093             }
00094 
00095         private:
00096             mutable CONNECTORTYPE lower_;
00097         };
00098 
00099     } // ldk
00100 } // wns
00101 
00102 
00103 #endif // NOT defined WNS_LDK_HASCONNECTOR_HPP
00104 

Generated on Thu May 24 03:31:41 2012 for openWNS by  doxygen 1.5.5