00001 #ifndef OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_ 00002 #define OMG_TDDS_CORE_QOS_ENTITY_QOS_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 <tdds/core/corefwd.hpp> 00023 #include <dds/core/Value.hpp> 00024 00025 00026 namespace tdds { namespace core { namespace qos { 00027 00028 /* Acts as a container for Qos policies allowing to set and retrieve all 00029 * the policies of an entity as a unit. 00030 */ 00031 template <typename DELEGATE> 00032 class EntityQos : public dds::core::Value<DELEGATE> { 00033 public: 00034 EntityQos() : dds::core::Value<DELEGATE>() { } 00035 00036 template <typename T> 00037 EntityQos(const EntityQos<T>& qos) : 00038 dds::core::Value<DELEGATE>(qos.delegate()) { } 00039 00040 public: 00041 ~EntityQos() { } 00042 00043 public: 00051 template <typename POLICY> 00052 void policy(const POLICY& p) { 00053 this->dds::core::Value<DELEGATE>::delegate().policy(p); 00054 } 00055 00062 template <typename POLICY> 00063 const POLICY& policy() const { 00064 return this->delegate().template policy<POLICY>(); 00065 } 00066 00073 template <typename POLICY> 00074 POLICY& policy() { 00075 return this->delegate().template policy<POLICY>(); 00076 } 00077 00078 template <typename POLICY> 00079 EntityQos& operator << (const POLICY& p) { 00080 this->delegate().policy(p); 00081 return *this; 00082 } 00083 00084 template <typename POLICY> 00085 EntityQos& operator >> (POLICY& p) const { 00086 p = this->delegate().template policy<POLICY>(); 00087 return *this; 00088 } 00089 00090 template <typename T> 00091 EntityQos<DELEGATE>& operator = (const EntityQos<T>& other) { 00092 if (this != (EntityQos<DELEGATE>*)&other) { 00093 this->d_ = other.delegate(); 00094 } 00095 return *this; 00096 } 00097 }; 00098 } } } /* namespace tdds / namespace core / namespace qos */ 00099 00100 #endif /* OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_ */
1.7.1