add doxygen via opencode

This commit is contained in:
2026-02-27 23:42:09 +03:00
parent 1739836a18
commit b53ef184dc
63 changed files with 3374 additions and 681 deletions

View File

@@ -1,26 +1,29 @@
/*! \file piprotectedvariable.h
* \ingroup Thread
* \~\brief
* \~english Thread-safe variable
* \~russian Потокобезопасная переменная
*/
//! \file piprotectedvariable.h
//! \ingroup Thread
//! \brief
//! \~english Thread-safe variable
//! \~russian Потокобезопасная переменная
//!
//! \details
//! \~english Template class for thread-safe variable access with mutex protection.
//! \~russian Шаблонный класс для потокобезопасного доступа к переменной с защитой мьютексом.
/*
PIP - Platform Independent Primitives
Thread-safe variable
Ivan Pelipenko peri4ko@yandex.ru, Stephan Fomenko, Andrey Bychkov work.a.b@yandex.ru
PIP - Platform Independent Primitives
Thread-safe variable
Ivan Pelipenko peri4ko@yandex.ru, Stephan Fomenko, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PIPROTECTEDVARIABLE_H
@@ -29,25 +32,37 @@
#include "pimutex.h"
//! \~english Thread-safe variable template class
//! \~russian Шаблонный класс потокобезопасной переменной
template<typename T>
class PIP_EXPORT PIProtectedVariable {
public:
//! \~english
//! \~russian
//! \~english Pointer wrapper for thread-safe access
//! \~russian Обертка указателя для потокобезопасного доступа
class PIP_EXPORT Pointer {
friend class PIProtectedVariable<T>;
public:
//! \~english Copy constructor
//! \~russian Конструктор копирования
Pointer(const Pointer & v): pv(v.pv), counter(v.counter + 1) {}
//! \~english Destructor - unlocks mutex
//! \~russian Деструктор - разблокирует мьютекс
~Pointer() {
if (counter == 0) pv.mutex.unlock();
}
//! \~english Access member
//! \~russian Доступ к члену
T * operator->() { return &pv.var; }
//! \~english Access value
//! \~russian Доступ к значению
T & operator*() { return pv.var; }
private:
Pointer() = delete;
//! \~english Construct from PIProtectedVariable
//! \~russian Конструктор из PIProtectedVariable
Pointer(PIProtectedVariable<T> & v): pv(v) {}
PIProtectedVariable<T> & pv;