.. _program_listing_file__tmp_ws_src_fastrtps_include_dds_core_detail_ReferenceImpl.hpp: Program Listing for File ReferenceImpl.hpp ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/fastrtps/include/dds/core/detail/ReferenceImpl.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp /* * Copyright 2019, Proyectos y Sistemas de Mantenimiento SL (eProsima). * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef EPROSIMA_DDS_CORE_REFERENCE_IMPL_HPP_ #define EPROSIMA_DDS_CORE_REFERENCE_IMPL_HPP_ /* * OMG PSM class declaration */ #include namespace dds { namespace core { // Implementation template Reference::Reference( null_type&) : impl_() { } template Reference::Reference( const Reference& ref) : impl_(ref.impl_) { } template template Reference::Reference( const Reference& ref) { //To Implement // ISOCPP_REPORT_STACK_DDS_BEGIN(*this); // impl_ = OSPL_CXX11_STD_MODULE::dynamic_pointer_cast(ref.impl_); // if (impl_ != ref.impl_) { // throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(ref).name() + " to " + typeid(*this).name()); // } } template Reference::Reference( DELEGATE_T* p) : impl_(p) { } template Reference::Reference( const DELEGATE_REF_T& p) : impl_(p) { //OMG_DDS_LOG("MM", "Reference(DELEGATE_REF_T& p)"); } template Reference::~Reference() { } template Reference::operator DELEGATE_REF_T() const { //To implement // ISOCPP_REPORT_STACK_NC_BEGIN(); // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_; } template template bool Reference::operator ==( const R& ref) const { //To implement // ISOCPP_REPORT_STACK_DDS_BEGIN(*this); // bool equal = false; // if (this->is_nil() && ref.is_nil()) { // /* Both delegates are null. */ // equal = true; // } else if (!this->is_nil() && !ref.is_nil()) { // /* Check delegates. */ // equal = (this->delegate() == ref.delegate()); // } // return equal; } template template bool Reference::operator !=( const R& ref) const { //To implement // ISOCPP_REPORT_STACK_DDS_BEGIN(*this); // return !(*this == ref); } template template Reference& Reference::operator =( const Reference& that) { //To implement // OMG_DDS_STATIC_ASSERT((dds::core::is_base_of::value)); // if(this != (Reference*)&that) // { // *this = Reference(that); // } // return *this; } template template Reference& Reference::operator =( const R& rhs) { //To implement // OMG_DDS_STATIC_ASSERT((dds::core::is_base_of< DELEGATE_T, typename R::DELEGATE_T>::value)); // if(this != (Reference*)&rhs) // { // *this = Reference(rhs); // } // return *this; } template Reference& Reference::operator =( const null_type) { //To implement // DELEGATE_REF_T tmp; // impl_ = tmp; // return *this; } template bool Reference::is_nil() const { //To implement // return impl_.get() == 0; } template bool Reference::operator ==( const null_type) const { //To implement // return this->is_nil(); } template bool Reference::operator !=( const null_type) const { //To implement // return !(this->is_nil()); } template const typename Reference::DELEGATE_REF_T& Reference::delegate() const { //To implement // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_; } template typename Reference::DELEGATE_REF_T& Reference::delegate() { //To implement // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_; } template DELEGATE* Reference::operator ->() { //To implement // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_.get(); } template const DELEGATE* Reference::operator ->() const { //To implement // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_.get(); } template Reference::operator const typename Reference::DELEGATE_REF_T& () const { //To implement // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_; } template Reference::operator typename Reference::DELEGATE_REF_T& () { //To implement // ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__); // return impl_; } template void Reference::set_ref( DELEGATE_T* p) { //To implement // impl_.reset(p); } template bool operator ==( null_type, const Reference& r) { //To implement // return r.is_nil(); } template bool operator !=( null_type, const Reference& r) { //To implement // return !r.is_nil(); } } //namespace core } //namespace dds #endif //EPROSIMA_DDS_CORE_REFERENCE_IMPL_HPP_