more ai generated doc with human review
This commit is contained in:
@@ -3,44 +3,67 @@
|
||||
Introspection module - interface for containers
|
||||
Ivan Pelipenko peri4ko@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/>.
|
||||
*/
|
||||
//! \addtogroup Introspection
|
||||
//! \{
|
||||
//! \file piintrospection_containers.h
|
||||
//! \brief Container introspection
|
||||
//! \~english Interface for container introspection and memory tracking
|
||||
//! \~russian Интерфейс для интроспекции контейнеров и отслеживания памяти
|
||||
//! \details
|
||||
//! \~english Provides interface for tracking container memory allocations and usage
|
||||
//! \~russian Предоставляет интерфейс для отслеживания выделения и использования памяти контейнерами
|
||||
|
||||
#ifndef PIINTROSPECTION_CONTAINERS_H
|
||||
#define PIINTROSPECTION_CONTAINERS_H
|
||||
# define PIINTROSPECTION_CONTAINERS_H
|
||||
|
||||
#include "pibase.h"
|
||||
# include "pibase.h"
|
||||
|
||||
//! \~english Container type information structure
|
||||
//! \~russian Структура информации о типе контейнера
|
||||
struct PIP_EXPORT PIIntrospectionContainersType {
|
||||
~PIIntrospectionContainersType();
|
||||
void finish();
|
||||
//! \~english Type identifier
|
||||
//! \~russian Идентификатор типа
|
||||
uint id = 0;
|
||||
//! \~english Type name
|
||||
//! \~russian Имя типа
|
||||
const char * name = nullptr;
|
||||
//! \~english Demangled type name
|
||||
//! \~russian Демангл-имя типа
|
||||
const char * demangled = "?";
|
||||
//! \~english Initialization flag
|
||||
//! \~russian Флаг инициализации
|
||||
bool inited = false;
|
||||
//! \~english Has demangled name flag
|
||||
//! \~russian Флаг наличия demangled имени
|
||||
bool has_demangled = false;
|
||||
};
|
||||
|
||||
#if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
|
||||
# if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
|
||||
|
||||
# include "piintrospection_base.h"
|
||||
|
||||
class PIIntrospectionContainers;
|
||||
# include "piintrospection_base.h"
|
||||
|
||||
//! \~english Container type information template
|
||||
//! \~russian Шаблон информации о типе контейнера
|
||||
template<typename T>
|
||||
class PIIntrospectionContainersTypeInfo {
|
||||
public:
|
||||
//! \~english Get container type information
|
||||
//! \~russian Получить информацию о типе контейнера
|
||||
static const PIIntrospectionContainersType & get() {
|
||||
static PIIntrospectionContainersType ret = create();
|
||||
return ret;
|
||||
@@ -55,7 +78,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
# define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())
|
||||
# define PIINTROSPECTION_CONTAINERS (PIIntrospectionContainersInterface::instance())
|
||||
|
||||
// clang-format off
|
||||
# define PIINTROSPECTION_CONTAINER_NEW(t, isz) PIINTROSPECTION_CONTAINERS->containerNew (PIIntrospectionContainersTypeInfo<t>::get(), isz);
|
||||
@@ -67,6 +90,8 @@ private:
|
||||
// clang-format on
|
||||
|
||||
|
||||
//! \~english Container introspection interface
|
||||
//! \~russian Интерфейс интроспекции контейнеров
|
||||
class PIP_EXPORT PIIntrospectionContainersInterface {
|
||||
friend class PIIntrospection;
|
||||
friend class PIIntrospectionServer;
|
||||
@@ -75,11 +100,23 @@ public:
|
||||
__PIINTROSPECTION_SINGLETON_H__(Containers)
|
||||
|
||||
// clang-format off
|
||||
//! \~english Notify about new container allocation
|
||||
//! \~russian Уведомить о новом выделении контейнера
|
||||
void containerNew (const PIIntrospectionContainersType & ti, uint isz);
|
||||
//! \~english Notify about container deletion
|
||||
//! \~russian Уведомить об удалении контейнера
|
||||
void containerDelete(const PIIntrospectionContainersType & ti);
|
||||
//! \~english Notify about container memory allocation
|
||||
//! \~russian Уведомить о выделении памяти контейнером
|
||||
void containerAlloc (const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
//! \~english Notify about container memory freeing
|
||||
//! \~russian Уведомить об освобождении памяти контейнером
|
||||
void containerFree (const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
//! \~english Notify about container memory usage
|
||||
//! \~russian Уведомить об использовании памяти контейнером
|
||||
void containerUsed (const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
//! \~english Notify about container unused memory
|
||||
//! \~russian Уведомить о неиспользуемой памяти контейнера
|
||||
void containerUnused(const PIIntrospectionContainersType & ti, ullong cnt);
|
||||
// clang-format on
|
||||
|
||||
@@ -91,14 +128,15 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#else
|
||||
# define PIINTROSPECTION_CONTAINER_NEW(t, isz)
|
||||
# define PIINTROSPECTION_CONTAINER_DELETE(t)
|
||||
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt)
|
||||
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt)
|
||||
# define PIINTROSPECTION_CONTAINER_USED(t, cnt)
|
||||
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt)
|
||||
#endif
|
||||
# else
|
||||
# define PIINTROSPECTION_CONTAINER_NEW(t, isz)
|
||||
# define PIINTROSPECTION_CONTAINER_DELETE(t)
|
||||
# define PIINTROSPECTION_CONTAINER_ALLOC(t, cnt)
|
||||
# define PIINTROSPECTION_CONTAINER_FREE(t, cnt)
|
||||
# define PIINTROSPECTION_CONTAINER_USED(t, cnt)
|
||||
# define PIINTROSPECTION_CONTAINER_UNUSED(t, cnt)
|
||||
# endif // defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
|
||||
|
||||
|
||||
#endif // PIINTROSPECTION_CONTAINERS_H
|
||||
//! \}
|
||||
|
||||
Reference in New Issue
Block a user