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

src/hpp/dds/core/Value.hpp

Go to the documentation of this file.
00001 #ifndef OMG_DDS_CORE_VALUE_HPP_
00002 #define OMG_DDS_CORE_VALUE_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>
00023 
00024 
00025 namespace dds { namespace core {
00026 
00030 template <typename D>
00031 class Value {
00032 protected:
00033     Value() { }
00034     Value(const Value& p) : d_(p.d_) { }
00035 
00036 public:
00037     template <typename ARG>
00038     Value(const ARG& arg) : d_(arg) { }
00039 
00040     template <typename ARG1, typename ARG2>
00041     Value(const ARG1& arg1, const ARG2& arg2) : d_(arg1, arg2) { }
00042     
00043     template <typename ARG1, typename ARG2, typename ARG3>
00044     Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3)
00045     : d_(arg1, arg2, arg3) { }
00046     
00047 public:
00048     ~Value() { }
00049 
00050 public:
00051     Value& operator=(const Value& other) {
00052         if (this != &other) {
00053             d_ = other.d_;
00054         }
00055         return *this;
00056     }
00057 
00058     bool operator==(const Value& other) {
00059         return (d_ == other.d_);
00060     }
00061 
00062     bool operator !=(const Value& other) {
00063         return !(d_ == other.d_);
00064     }
00065 
00066 public:
00067     const D* operator->() const { return d_; }
00068     D* operator->() { return &d_; }
00069 
00070     const D& delegate() const { return d_; }
00071     D& delegate() { return d_;}
00072 
00073 protected:
00074     D d_;
00075 };
00076 
00077 } } /* dds / core */
00078 
00079 #endif /* OMG_DDS_CORE_VALUE_HPP_ */

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