diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/SplitterChannel.cpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/SplitterChannel.cpp')
-rw-r--r-- | contrib/libs/poco/Foundation/src/SplitterChannel.cpp | 226 |
1 files changed, 113 insertions, 113 deletions
diff --git a/contrib/libs/poco/Foundation/src/SplitterChannel.cpp b/contrib/libs/poco/Foundation/src/SplitterChannel.cpp index 69ba36a240..a0bc69919d 100644 --- a/contrib/libs/poco/Foundation/src/SplitterChannel.cpp +++ b/contrib/libs/poco/Foundation/src/SplitterChannel.cpp @@ -1,113 +1,113 @@ -// -// SplitterChannel.cpp -// -// Library: Foundation -// Package: Logging -// Module: SplitterChannel -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/SplitterChannel.h" -#include "Poco/LoggingRegistry.h" -#include "Poco/StringTokenizer.h" - - -namespace Poco { - - -SplitterChannel::SplitterChannel() -{ -} - - -SplitterChannel::~SplitterChannel() -{ - try - { - close(); - } - catch (...) - { - poco_unexpected(); - } -} - - -void SplitterChannel::addChannel(Channel* pChannel) -{ - poco_check_ptr (pChannel); - - FastMutex::ScopedLock lock(_mutex); - - pChannel->duplicate(); - _channels.push_back(pChannel); -} - - -void SplitterChannel::removeChannel(Channel* pChannel) -{ - FastMutex::ScopedLock lock(_mutex); - - for (ChannelVec::iterator it = _channels.begin(); it != _channels.end(); ++it) - { - if (*it == pChannel) - { - pChannel->release(); - _channels.erase(it); - break; - } - } -} - - -void SplitterChannel::setProperty(const std::string& name, const std::string& value) -{ - if (name.compare(0, 7, "channel") == 0) - { - StringTokenizer tokenizer(value, ",;", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); - for (StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it) - { - addChannel(LoggingRegistry::defaultRegistry().channelForName(*it)); - } - } - else Channel::setProperty(name, value); -} - - -void SplitterChannel::log(const Message& msg) -{ - FastMutex::ScopedLock lock(_mutex); - - for (ChannelVec::iterator it = _channels.begin(); it != _channels.end(); ++it) - { - (*it)->log(msg); - } -} - - -void SplitterChannel::close() -{ - FastMutex::ScopedLock lock(_mutex); - - for (ChannelVec::iterator it = _channels.begin(); it != _channels.end(); ++it) - { - (*it)->release(); - } - _channels.clear(); -} - - -int SplitterChannel::count() const -{ - FastMutex::ScopedLock lock(_mutex); - - return (int) _channels.size(); -} - - -} // namespace Poco +// +// SplitterChannel.cpp +// +// Library: Foundation +// Package: Logging +// Module: SplitterChannel +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/SplitterChannel.h" +#include "Poco/LoggingRegistry.h" +#include "Poco/StringTokenizer.h" + + +namespace Poco { + + +SplitterChannel::SplitterChannel() +{ +} + + +SplitterChannel::~SplitterChannel() +{ + try + { + close(); + } + catch (...) + { + poco_unexpected(); + } +} + + +void SplitterChannel::addChannel(Channel* pChannel) +{ + poco_check_ptr (pChannel); + + FastMutex::ScopedLock lock(_mutex); + + pChannel->duplicate(); + _channels.push_back(pChannel); +} + + +void SplitterChannel::removeChannel(Channel* pChannel) +{ + FastMutex::ScopedLock lock(_mutex); + + for (ChannelVec::iterator it = _channels.begin(); it != _channels.end(); ++it) + { + if (*it == pChannel) + { + pChannel->release(); + _channels.erase(it); + break; + } + } +} + + +void SplitterChannel::setProperty(const std::string& name, const std::string& value) +{ + if (name.compare(0, 7, "channel") == 0) + { + StringTokenizer tokenizer(value, ",;", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM); + for (StringTokenizer::Iterator it = tokenizer.begin(); it != tokenizer.end(); ++it) + { + addChannel(LoggingRegistry::defaultRegistry().channelForName(*it)); + } + } + else Channel::setProperty(name, value); +} + + +void SplitterChannel::log(const Message& msg) +{ + FastMutex::ScopedLock lock(_mutex); + + for (ChannelVec::iterator it = _channels.begin(); it != _channels.end(); ++it) + { + (*it)->log(msg); + } +} + + +void SplitterChannel::close() +{ + FastMutex::ScopedLock lock(_mutex); + + for (ChannelVec::iterator it = _channels.begin(); it != _channels.end(); ++it) + { + (*it)->release(); + } + _channels.clear(); +} + + +int SplitterChannel::count() const +{ + FastMutex::ScopedLock lock(_mutex); + + return (int) _channels.size(); +} + + +} // namespace Poco |