1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #include "cow_wrapper_clients.hxx" 25 26 namespace o3tltests { 27 28 class cow_wrapper_client2_impl 29 { 30 public: cow_wrapper_client2_impl()31 cow_wrapper_client2_impl() : mnValue(0) {} cow_wrapper_client2_impl(int nVal)32 explicit cow_wrapper_client2_impl( int nVal ) : mnValue(nVal) {} setValue(int nVal)33 void setValue( int nVal ) { mnValue = nVal; } getValue() const34 int getValue() const { return mnValue; } 35 operator ==(const cow_wrapper_client2_impl & rRHS) const36 bool operator==( const cow_wrapper_client2_impl& rRHS ) const { return mnValue == rRHS.mnValue; } operator !=(const cow_wrapper_client2_impl & rRHS) const37 bool operator!=( const cow_wrapper_client2_impl& rRHS ) const { return mnValue != rRHS.mnValue; } operator <(const cow_wrapper_client2_impl & rRHS) const38 bool operator<( const cow_wrapper_client2_impl& rRHS ) const { return mnValue < rRHS.mnValue; } 39 40 private: 41 int mnValue; 42 }; 43 cow_wrapper_client2()44cow_wrapper_client2::cow_wrapper_client2() : maImpl() 45 { 46 } 47 cow_wrapper_client2(int nVal)48cow_wrapper_client2::cow_wrapper_client2( int nVal ) : 49 maImpl( cow_wrapper_client2_impl(nVal) ) 50 { 51 } 52 ~cow_wrapper_client2()53cow_wrapper_client2::~cow_wrapper_client2() 54 { 55 } 56 cow_wrapper_client2(const cow_wrapper_client2 & rSrc)57cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) : 58 maImpl(rSrc.maImpl) 59 { 60 } 61 operator =(const cow_wrapper_client2 & rSrc)62cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc ) 63 { 64 maImpl = rSrc.maImpl; 65 66 return *this; 67 } 68 modify(int nVal)69void cow_wrapper_client2::modify( int nVal ) 70 { 71 maImpl->setValue( nVal ); 72 } 73 queryUnmodified() const74int cow_wrapper_client2::queryUnmodified() const 75 { 76 return maImpl->getValue(); 77 } 78 makeUnique()79void cow_wrapper_client2::makeUnique() 80 { 81 maImpl.make_unique(); 82 } is_unique() const83bool cow_wrapper_client2::is_unique() const 84 { 85 return maImpl.is_unique(); 86 } use_count() const87oslInterlockedCount cow_wrapper_client2::use_count() const 88 { 89 return maImpl.use_count(); 90 } swap(cow_wrapper_client2 & r)91void cow_wrapper_client2::swap( cow_wrapper_client2& r ) 92 { 93 o3tl::swap(maImpl, r.maImpl); 94 } 95 operator ==(const cow_wrapper_client2 & rRHS) const96bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const 97 { 98 return maImpl == rRHS.maImpl; 99 } operator !=(const cow_wrapper_client2 & rRHS) const100bool cow_wrapper_client2::operator!=( const cow_wrapper_client2& rRHS ) const 101 { 102 return maImpl != rRHS.maImpl; 103 } operator <(const cow_wrapper_client2 & rRHS) const104bool cow_wrapper_client2::operator<( const cow_wrapper_client2& rRHS ) const 105 { 106 return maImpl < rRHS.maImpl; 107 } 108 109 // --------------------------------------------------------------------------- 110 cow_wrapper_client3()111cow_wrapper_client3::cow_wrapper_client3() : maImpl() 112 { 113 } 114 cow_wrapper_client3(int nVal)115cow_wrapper_client3::cow_wrapper_client3( int nVal ) : 116 maImpl( cow_wrapper_client2_impl(nVal) ) 117 { 118 } 119 ~cow_wrapper_client3()120cow_wrapper_client3::~cow_wrapper_client3() 121 { 122 } 123 cow_wrapper_client3(const cow_wrapper_client3 & rSrc)124cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) : 125 maImpl(rSrc.maImpl) 126 { 127 } 128 operator =(const cow_wrapper_client3 & rSrc)129cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& rSrc ) 130 { 131 maImpl = rSrc.maImpl; 132 133 return *this; 134 } 135 modify(int nVal)136void cow_wrapper_client3::modify( int nVal ) 137 { 138 maImpl->setValue( nVal ); 139 } 140 queryUnmodified() const141int cow_wrapper_client3::queryUnmodified() const 142 { 143 return maImpl->getValue(); 144 } 145 makeUnique()146void cow_wrapper_client3::makeUnique() 147 { 148 maImpl.make_unique(); 149 } is_unique() const150bool cow_wrapper_client3::is_unique() const 151 { 152 return maImpl.is_unique(); 153 } use_count() const154oslInterlockedCount cow_wrapper_client3::use_count() const 155 { 156 return maImpl.use_count(); 157 } swap(cow_wrapper_client3 & r)158void cow_wrapper_client3::swap( cow_wrapper_client3& r ) 159 { 160 o3tl::swap(maImpl, r.maImpl); 161 } 162 operator ==(const cow_wrapper_client3 & rRHS) const163bool cow_wrapper_client3::operator==( const cow_wrapper_client3& rRHS ) const 164 { 165 return maImpl == rRHS.maImpl; 166 } operator !=(const cow_wrapper_client3 & rRHS) const167bool cow_wrapper_client3::operator!=( const cow_wrapper_client3& rRHS ) const 168 { 169 return maImpl != rRHS.maImpl; 170 } operator <(const cow_wrapper_client3 & rRHS) const171bool cow_wrapper_client3::operator<( const cow_wrapper_client3& rRHS ) const 172 { 173 return maImpl < rRHS.maImpl; 174 } 175 176 } // namespace o3tltests 177