CCA
|
PortConfiguration.h
Go to the documentation of this file.
00001 /* ============================================================ 00002 * 00003 * This file is a part of CCA project 00004 * 00005 * Copyright (C) 2011 by Arne Nordmann <anordman at cor-lab dot uni-bielefeld dot de> 00006 * 00007 * This file may be licensed under the terms of the 00008 * GNU Lesser General Public License Version 3 (the ``LGPL''), 00009 * or (at your option) any later version. 00010 * 00011 * Software distributed under the License is distributed 00012 * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either 00013 * express or implied. See the LGPL for the specific language 00014 * governing rights and limitations. 00015 * 00016 * You should have received a copy of the LGPL along with this 00017 * program. If not, go to http://www.gnu.org/licenses/lgpl.html 00018 * or write to the Free Software Foundation, Inc., 00019 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00020 * 00021 * The development of this software was supported by: 00022 * CoR-Lab, Research Institute for Cognition and Robotics 00023 * Bielefeld University 00024 * 00025 * ============================================================ */ 00026 00027 #pragma once 00028 00029 #include <rsb/Scope.h> 00030 #include <rsb/ParticipantConfig.h> 00031 00032 namespace cca { 00033 00034 class PortConfiguration; 00035 typedef boost::shared_ptr<PortConfiguration> PortConfigurationPtr; 00036 00042 class PortConfiguration { 00043 00044 public: 00045 00046 typedef enum { 00047 CCALocal = 1, CCARemote = 2, CCALocalRemote = 3 00048 } Transport; 00049 00053 virtual std::string print() const; 00054 00068 static PortConfigurationPtr DEFAULT(const std::string &scope, 00069 unsigned int queuesize = 1, bool keeplatest = true); 00070 00084 static PortConfigurationPtr LOCAL(const std::string &scope, 00085 unsigned int queuesize = 1, bool keeplatest = true); 00086 00100 static PortConfigurationPtr REMOTE(const std::string &scope, 00101 unsigned int queuesize = 1, bool keeplatest = true); 00102 00116 static PortConfigurationPtr LOCALREMOTE(const std::string &scope, 00117 unsigned int queuesize = 1, bool keeplatest = true); 00118 00135 static PortConfigurationPtr PROFILE(const std::string &profile, 00136 const std::string &scope, unsigned int queuesize = 1, 00137 bool keeplatest = true); 00138 00143 static PortConfigurationPtr create(Transport transport, 00144 const std::string &scope, unsigned int queuesize = 1, 00145 bool keeplatest = true); 00146 00151 static PortConfigurationPtr create(const std::string &profile, 00152 const std::string &scope, unsigned int queuesize = 1, 00153 bool keeplatest = true); 00154 00159 void setQueueSize(unsigned int queuesize = 1); 00160 00165 unsigned int getQueueSize() const; 00166 00171 void setKeepLatest(bool keeplatest = true); 00172 00177 bool keepLatest(); 00178 00182 virtual rsb::ScopePtr getScopePtr() const; 00183 00187 virtual rsb::ParticipantConfig rsbConfig() const; 00188 00192 virtual rsb::ParticipantConfig& rsbConfigMutable(); 00193 00199 virtual bool isLocalPort() const; 00200 00206 virtual bool isRemotePort() const; 00207 00208 virtual ~PortConfiguration(); 00209 00210 protected: 00220 PortConfiguration(const std::string &scope, unsigned int queuesize = 1, 00221 bool keeplatest = true); 00222 00232 PortConfiguration(const std::string &scope, bool local, bool remote, 00233 unsigned int queuesize = 1, bool keeplatest = true); 00234 00238 bool local; 00239 00243 bool remote; 00244 00248 bool keeplatest; 00249 00253 rsb::ScopePtr scope; 00254 00258 rsb::ParticipantConfig rsbconfig; 00259 00264 unsigned int queuesize; 00265 00266 }; 00267 00274 bool operator==(PortConfigurationPtr const a, PortConfigurationPtr const b); 00275 00276 }