GPU-Calc: remove Alloc_Host_Ptr for clmem of NAN vector
[LibreOffice.git] / o3tl / qa / cow_wrapper_clients.cxx
blobbfb53f22a9bd4800c6a38934a204e623e875d17f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "cow_wrapper_clients.hxx"
21 #include <rtl/instance.hxx>
23 namespace o3tltests {
25 class cow_wrapper_client2_impl
27 public:
28 cow_wrapper_client2_impl() : mnValue(0) {}
29 explicit cow_wrapper_client2_impl( int nVal ) : mnValue(nVal) {}
30 void setValue( int nVal ) { mnValue = nVal; }
31 int getValue() const { return mnValue; }
33 bool operator==( const cow_wrapper_client2_impl& rRHS ) const { return mnValue == rRHS.mnValue; }
34 bool operator!=( const cow_wrapper_client2_impl& rRHS ) const { return mnValue != rRHS.mnValue; }
35 bool operator<( const cow_wrapper_client2_impl& rRHS ) const { return mnValue < rRHS.mnValue; }
37 private:
38 int mnValue;
41 cow_wrapper_client2::cow_wrapper_client2() : maImpl()
45 cow_wrapper_client2::cow_wrapper_client2( int nVal ) :
46 maImpl( cow_wrapper_client2_impl(nVal) )
50 cow_wrapper_client2::~cow_wrapper_client2()
54 cow_wrapper_client2::cow_wrapper_client2( const cow_wrapper_client2& rSrc ) :
55 maImpl(rSrc.maImpl)
59 cow_wrapper_client2& cow_wrapper_client2::operator=( const cow_wrapper_client2& rSrc )
61 maImpl = rSrc.maImpl;
63 return *this;
66 void cow_wrapper_client2::modify( int nVal )
68 maImpl->setValue( nVal );
71 int cow_wrapper_client2::queryUnmodified() const
73 return maImpl->getValue();
76 void cow_wrapper_client2::makeUnique()
78 maImpl.make_unique();
80 bool cow_wrapper_client2::is_unique() const
82 return maImpl.is_unique();
84 oslInterlockedCount cow_wrapper_client2::use_count() const
86 return maImpl.use_count();
88 void cow_wrapper_client2::swap( cow_wrapper_client2& r )
90 o3tl::swap(maImpl, r.maImpl);
93 bool cow_wrapper_client2::operator==( const cow_wrapper_client2& rRHS ) const
95 return maImpl == rRHS.maImpl;
97 bool cow_wrapper_client2::operator!=( const cow_wrapper_client2& rRHS ) const
99 return maImpl != rRHS.maImpl;
101 bool cow_wrapper_client2::operator<( const cow_wrapper_client2& rRHS ) const
103 return maImpl < rRHS.maImpl;
106 // ---------------------------------------------------------------------------
108 cow_wrapper_client3::cow_wrapper_client3() : maImpl()
112 cow_wrapper_client3::cow_wrapper_client3( int nVal ) :
113 maImpl( cow_wrapper_client2_impl(nVal) )
117 cow_wrapper_client3::~cow_wrapper_client3()
121 cow_wrapper_client3::cow_wrapper_client3( const cow_wrapper_client3& rSrc ) :
122 maImpl(rSrc.maImpl)
126 cow_wrapper_client3& cow_wrapper_client3::operator=( const cow_wrapper_client3& rSrc )
128 maImpl = rSrc.maImpl;
130 return *this;
133 void cow_wrapper_client3::modify( int nVal )
135 maImpl->setValue( nVal );
138 int cow_wrapper_client3::queryUnmodified() const
140 return maImpl->getValue();
143 void cow_wrapper_client3::makeUnique()
145 maImpl.make_unique();
147 bool cow_wrapper_client3::is_unique() const
149 return maImpl.is_unique();
151 oslInterlockedCount cow_wrapper_client3::use_count() const
153 return maImpl.use_count();
155 void cow_wrapper_client3::swap( cow_wrapper_client3& r )
157 o3tl::swap(maImpl, r.maImpl);
160 bool cow_wrapper_client3::operator==( const cow_wrapper_client3& rRHS ) const
162 return maImpl == rRHS.maImpl;
164 bool cow_wrapper_client3::operator!=( const cow_wrapper_client3& rRHS ) const
166 return maImpl != rRHS.maImpl;
168 bool cow_wrapper_client3::operator<( const cow_wrapper_client3& rRHS ) const
170 return maImpl < rRHS.maImpl;
173 // ---------------------------------------------------------------------------
175 namespace { struct theDefaultClient4 : public rtl::Static< o3tl::cow_wrapper< int >,
176 theDefaultClient4 > {}; }
178 cow_wrapper_client4::cow_wrapper_client4() :
179 maImpl(theDefaultClient4::get())
183 cow_wrapper_client4::cow_wrapper_client4( int nVal ) :
184 maImpl( nVal )
188 cow_wrapper_client4::~cow_wrapper_client4()
192 cow_wrapper_client4::cow_wrapper_client4( const cow_wrapper_client4& rSrc ) :
193 maImpl(rSrc.maImpl)
197 cow_wrapper_client4& cow_wrapper_client4::operator=( const cow_wrapper_client4& rSrc )
199 maImpl = rSrc.maImpl;
201 return *this;
204 bool cow_wrapper_client4::is_default() const
206 return maImpl.same_object(theDefaultClient4::get());
209 bool cow_wrapper_client4::operator==( const cow_wrapper_client4& rRHS ) const
211 return maImpl == rRHS.maImpl;
213 bool cow_wrapper_client4::operator!=( const cow_wrapper_client4& rRHS ) const
215 return maImpl != rRHS.maImpl;
217 bool cow_wrapper_client4::operator<( const cow_wrapper_client4& rRHS ) const
219 return maImpl < rRHS.maImpl;
222 } // namespace o3tltests
224 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */