diff options
author | Devtools Arcadia <arcadia-devtools@yandex-team.ru> | 2022-02-07 18:08:42 +0300 |
---|---|---|
committer | Devtools Arcadia <arcadia-devtools@mous.vla.yp-c.yandex.net> | 2022-02-07 18:08:42 +0300 |
commit | 1110808a9d39d4b808aef724c861a2e1a38d2a69 (patch) | |
tree | e26c9fed0de5d9873cce7e00bc214573dc2195b7 /contrib/libs/poco/Foundation/src/SharedMemory.cpp | |
download | ydb-1110808a9d39d4b808aef724c861a2e1a38d2a69.tar.gz |
intermediate changes
ref:cde9a383711a11544ce7e107a78147fb96cc4029
Diffstat (limited to 'contrib/libs/poco/Foundation/src/SharedMemory.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/SharedMemory.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/contrib/libs/poco/Foundation/src/SharedMemory.cpp b/contrib/libs/poco/Foundation/src/SharedMemory.cpp new file mode 100644 index 0000000000..da43a421c0 --- /dev/null +++ b/contrib/libs/poco/Foundation/src/SharedMemory.cpp @@ -0,0 +1,90 @@ +// +// SharedMemory.cpp +// +// Library: Foundation +// Package: Processes +// Module: SharedMemory +// +// Copyright (c) 2007, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/SharedMemory.h" +#include "Poco/Exception.h" +#if defined(POCO_NO_SHAREDMEMORY) +#include "SharedMemory_DUMMY.cpp" +#elif defined(POCO_OS_FAMILY_WINDOWS) +#include "SharedMemory_WIN32.cpp" +#elif defined(POCO_OS_FAMILY_UNIX) +#include "SharedMemory_POSIX.cpp" +#else +#include "SharedMemory_DUMMY.cpp" +#endif + + +namespace Poco { + + +SharedMemory::SharedMemory(): + _pImpl(0) +{ +} + + +SharedMemory::SharedMemory(const std::string& name, std::size_t size, AccessMode mode, const void* addrHint, bool server): + _pImpl(new SharedMemoryImpl(name, size, mode, addrHint, server)) +{ +} + + +SharedMemory::SharedMemory(const Poco::File& file, AccessMode mode, const void* addrHint): + _pImpl(new SharedMemoryImpl(file, mode, addrHint)) +{ +} + + +SharedMemory::SharedMemory(const SharedMemory& other): + _pImpl(other._pImpl) +{ + if (_pImpl) + _pImpl->duplicate(); +} + + +SharedMemory::~SharedMemory() +{ + if (_pImpl) + _pImpl->release(); +} + + +SharedMemory& SharedMemory::operator = (const SharedMemory& other) +{ + SharedMemory tmp(other); + swap(tmp); + return *this; +} + + +char* SharedMemory::begin() const +{ + if (_pImpl) + return _pImpl->begin(); + else + return 0; +} + + +char* SharedMemory::end() const +{ + if (_pImpl) + return _pImpl->end(); + else + return 0; +} + + +} // namespace Poco |