Orocos Real-Time Toolkit  2.6.0
PortInterface.hpp
00001 /***************************************************************************
00002   tag: Peter Soetens  Thu Oct 22 11:59:07 CEST 2009  PortInterface.hpp
00003 
00004                         PortInterface.hpp -  description
00005                            -------------------
00006     begin                : Thu October 22 2009
00007     copyright            : (C) 2009 Sylvain Joyeux
00008     email                : sylvain.joyeux@m4x.org
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
00035  *                                                                         *
00036  ***************************************************************************/
00037 
00038 
00039 #ifndef ORO_EXECUTION_PORT_INTERFACE_HPP
00040 #define ORO_EXECUTION_PORT_INTERFACE_HPP
00041 
00042 #include <string>
00043 #include "../internal/rtt-internal-fwd.hpp"
00044 #include "../ConnPolicy.hpp"
00045 #include "../internal/ConnID.hpp"
00046 #include "ChannelElementBase.hpp"
00047 #include "../types/rtt-types-fwd.hpp"
00048 #include "../rtt-fwd.hpp"
00049 
00050 namespace RTT
00051 { namespace base {
00052 
00057     class RTT_API PortInterface
00058     {
00059         std::string name;
00060         std::string mdesc;
00061     protected:
00062         DataFlowInterface* iface;
00063 
00064         PortInterface(const std::string& name);
00065 
00066     public:
00067         virtual ~PortInterface() {}
00068 
00072         virtual internal::ConnID* getPortID() const;
00073 
00077         const std::string& getName() const { return name; }
00078 
00085         bool setName(const std::string& name);
00086 
00091         const std::string& getDescription() const { return mdesc; }
00092 
00098         PortInterface& doc(const std::string& desc);
00099 
00100 
00102         virtual bool connected() const = 0;
00103 
00105         virtual const types::TypeInfo* getTypeInfo() const = 0;
00106 
00108         virtual void disconnect() = 0;
00109 
00114         virtual bool disconnect(PortInterface* port) = 0;
00115 
00119         virtual bool isLocal() const;
00120 
00124         virtual int serverProtocol() const;
00125 
00132         virtual PortInterface* clone() const = 0;
00133 
00141         virtual PortInterface* antiClone() const = 0;
00142 
00147         virtual Service* createPortObject();
00148 
00155         virtual bool connectTo(PortInterface* other, ConnPolicy const& policy) = 0;
00156 
00163         virtual bool connectTo(PortInterface* other) = 0;
00164 
00173         virtual bool createStream(ConnPolicy const& policy) = 0;
00174 
00179         virtual bool addConnection(internal::ConnID* cid, ChannelElementBase::shared_ptr channel_input, ConnPolicy const& policy = ConnPolicy() ) = 0;
00180 
00186         virtual bool removeConnection(internal::ConnID* cid) = 0;
00187 
00194         void setInterface(DataFlowInterface* iface);
00199         DataFlowInterface* getInterface() const;
00200 
00210         virtual const internal::ConnectionManager* getManager() const = 0;
00211 };
00212 
00213 }}
00214 
00215 #endif