Orocos Real-Time Toolkit
2.6.0
|
00001 /*************************************************************************** 00002 tag: The SourceWorks Tue Sep 7 00:55:18 CEST 2010 OperationInterface.hpp 00003 00004 OperationInterface.hpp - description 00005 ------------------- 00006 begin : Tue September 07 2010 00007 copyright : (C) 2010 The SourceWorks 00008 email : peter@thesourceworks.com 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_OPERATION_REPOSITORY_HPP 00040 #define ORO_OPERATION_REPOSITORY_HPP 00041 00042 #include <string> 00043 #include <vector> 00044 #include <map> 00045 00046 #include "rtt-config.h" 00047 #include "base/DataSourceBase.hpp" 00048 #include "internal/DataSource.hpp" 00049 #include "ArgumentDescription.hpp" 00050 #include "FactoryExceptions.hpp" 00051 #include "OperationInterfacePart.hpp" 00052 00053 00054 namespace RTT 00055 { 00062 class RTT_API OperationInterface 00063 { 00064 protected: 00065 typedef std::map<std::string, OperationInterfacePart*> map_t; 00066 map_t data; 00067 public: 00071 typedef std::vector<base::DataSourceBase::shared_ptr> Arguments; 00072 00076 void clear(); 00077 00081 std::vector<std::string> getNames() const; 00082 00086 bool hasMember(const std::string& name) const; 00087 00096 int getArity(const std::string& name) const; 00097 00107 int getCollectArity(const std::string& name) const; 00108 00114 bool isSynchronous(const std::string& name) const; 00115 00128 base::DataSourceBase::shared_ptr produce(const std::string& name, const Arguments& args, ExecutionEngine* caller) const; 00129 00144 base::DataSourceBase::shared_ptr produceSend(const std::string& name, const Arguments& args, ExecutionEngine* caller) const; 00145 00160 base::DataSourceBase::shared_ptr produceHandle(const std::string& name) const; 00161 00178 base::DataSourceBase::shared_ptr produceCollect(const std::string& name, const Arguments& args, internal::DataSource<bool>::shared_ptr blocking) const; 00179 00180 #ifdef ORO_SIGNALLING_OPERATIONS 00181 00196 Handle produceSignal(const std::string& name, base::ActionInterface* func, const std::vector<base::DataSourceBase::shared_ptr>& args) const; 00197 #endif 00198 00201 typedef std::vector<ArgumentDescription> Descriptions; 00202 00211 Descriptions getArgumentList(const std::string& name) const; 00212 00221 std::string getResultType(const std::string& name) const; 00222 00231 std::string getDescription(const std::string& name) const; 00232 00239 void add(const std::string& name, OperationInterfacePart* part); 00240 00246 void remove(const std::string& name); 00247 00253 OperationInterfacePart* getPart(const std::string& name); 00254 }; 00255 } 00256 00257 #endif