• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/hpp/dds/topic/TopicInstance.hpp

Go to the documentation of this file.
00001 #ifndef OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_
00002 #define OMG_DDS_TOPIC_TOPIC_INSTANCE_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 <dds/core/corefwd.hpp>     // for dds::core::Time
00023 #include <dds/core/InstanceHandle.hpp>
00024 
00025 namespace dds { namespace topic {
00026 
00027 template <typename T>
00028 class TopicInstance {
00029 public:
00030     TopicInstance() {}
00031 
00032     /* implicit */ TopicInstance(const dds::core::InstanceHandle& h)
00033     : h_(h), sample_() {}
00034 
00035     TopicInstance(const dds::core::InstanceHandle& h, const T& the_sample)
00036         : h_(h), sample_(the_sample) { }
00037 public:
00038     /* implicit */ operator const dds::core::InstanceHandle() const {
00039         return h_;
00040     }
00041 
00042     const dds::core::InstanceHandle handle() const {
00043         return h_;
00044     }
00045 
00046     void handle(const dds::core::InstanceHandle& h) { h_ = h; }
00047 
00048     const T& sample() const { return sample_; }
00049 
00050     T& sample() {return sample_; }
00051 
00052     void sample(const T& the_sample) { sample_ = the_sample; }
00053 
00054 private:
00055     dds::core::InstanceHandle h_;
00056     T sample_;
00057 };
00058 
00059 }}
00060 #endif /* OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ */

Generated on Tue Nov 9 2010 02:16:21 for dds-psm-cxx-doc by  doxygen 1.7.1