| 1 | // |
|---|---|
| 2 | // AtomicCounter.cpp |
| 3 | // |
| 4 | // Library: Foundation |
| 5 | // Package: Core |
| 6 | // Module: AtomicCounter |
| 7 | // |
| 8 | // Copyright (c) 2009, Applied Informatics Software Engineering GmbH. |
| 9 | // and Contributors. |
| 10 | // |
| 11 | // SPDX-License-Identifier: BSL-1.0 |
| 12 | // |
| 13 | |
| 14 | |
| 15 | #include "Poco/AtomicCounter.h" |
| 16 | |
| 17 | |
| 18 | namespace Poco { |
| 19 | |
| 20 | |
| 21 | AtomicCounter::AtomicCounter(): |
| 22 | _counter(0) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | |
| 27 | AtomicCounter::AtomicCounter(AtomicCounter::ValueType initialValue): |
| 28 | _counter(initialValue) |
| 29 | { |
| 30 | } |
| 31 | |
| 32 | |
| 33 | AtomicCounter::AtomicCounter(const AtomicCounter& counter): |
| 34 | _counter(counter.value()) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | |
| 39 | AtomicCounter::~AtomicCounter() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | |
| 44 | AtomicCounter& AtomicCounter::operator = (const AtomicCounter& counter) |
| 45 | { |
| 46 | _counter.store(counter._counter.load()); |
| 47 | return *this; |
| 48 | } |
| 49 | |
| 50 | |
| 51 | AtomicCounter& AtomicCounter::operator = (AtomicCounter::ValueType value) |
| 52 | { |
| 53 | _counter.store(value); |
| 54 | return *this; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | } // namespace Poco |
| 59 |