00001 #ifndef OMG_TDDS_CORE_WAIT_SET_HPP_ 00002 #define OMG_TDDS_CORE_WAIT_SET_HPP_ 00003 00004 /* Copyright 2010, Object Management Group, Inc. 00005 * Copyright 2010, PrismTech, Corp. 00006 * Copyright 2010, Real-Time Innovations, Inc. 00007 * All rights reserved. 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); 00010 * you may not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, 00017 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include <vector> 00023 00024 #include <dds/core/corefwd.hpp> 00025 #include <dds/core/Reference.hpp> 00026 00027 00028 namespace tdds { namespace core { namespace cond { 00037 template <typename DELEGATE> 00038 class WaitSet : public dds::core::Reference<DELEGATE> { 00039 public: 00040 typedef std::vector<dds::core::cond::Condition> ConditionSeq; 00041 00042 public: 00043 OMG_DDS_REF_TYPE(WaitSet, dds::core::Reference, DELEGATE) 00044 00045 public: 00046 static WaitSet newWaitSet(); 00047 00048 ~WaitSet() { } 00049 00050 void close() { 00051 this->delegate()->close(); 00052 } 00053 00054 public: 00083 const ConditionSeq wait(const dds::core::Duration& timeout) { 00084 return this->delegate()->wait(timeout); 00085 } 00086 00115 const ConditionSeq wait() { 00116 return this->delegate()->wait(); 00117 } 00118 00147 ConditionSeq& wait(ConditionSeq& triggered, 00148 const dds::core::Duration& timeout) { 00149 return this->delegate()->wait(triggered, timeout); 00150 } 00151 00180 ConditionSeq& wait(ConditionSeq& triggered) { 00181 return this->delegate()->wait(triggered); 00182 } 00183 00184 public: 00190 void dispatch() { 00191 this->delegate()->dispatch(); 00192 } 00193 00199 void dispatch(const dds::core::Duration& timeout) { 00200 this->delegate()->dispatch(timeout); 00201 } 00202 00203 public: 00207 WaitSet& operator +=(const dds::core::cond::Condition& cond) { 00208 return this->delegate()->attach_condition(cond); 00209 } 00210 00214 WaitSet& operator -=(const dds::core::cond::Condition& cond) { 00215 return this->delegate()->detach_condition(cond); 00216 } 00217 00228 void attach_condition(const dds::core::cond::Condition& cond) { 00229 this->delegate()->attach_condition(cond); 00230 } 00231 00240 bool detach_condition(const dds::core::cond::Condition& cond) { 00241 return this->delegate()->detach_condition(cond); 00242 } 00243 00249 const ConditionSeq conditions() { 00250 return this->delegate()->conditions(); 00251 } 00252 00258 ConditionSeq& conditions(ConditionSeq& conds) const { 00259 return this->delegate()->conditions(conds); 00260 } 00261 }; 00262 } } } 00263 #endif /* OMG_TDDS_CORE_WAIT_SET_HPP_ */ 00264
1.7.1