* PIThread::~PIThread() now unregister itself from introspection, if terminates than show warning * PISystemMonitor now correctly stops * PIPeer now can correctly stopAndWait * PIPeer::destroy(), protected method for close all eths and threads * new PIINTROSPECTION_STOP macro * Introspection now can be correctly stopped by macro, more safety ClientServer: * ClientBase::close() stop and disconnect channel * Server clients clean-up now event-based * No warnings on client destructor
85 lines
2.4 KiB
C++
85 lines
2.4 KiB
C++
/*! \file piintrospection_server.h
|
||
* \ingroup Introspection
|
||
* \~\brief
|
||
* \~english Introspection server
|
||
* \~russian Сервер интроспекции
|
||
*/
|
||
/*
|
||
PIP - Platform Independent Primitives
|
||
Introspection module
|
||
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 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/>.
|
||
*/
|
||
|
||
#ifndef PIINTROSPECTION_SERVER_H
|
||
#define PIINTROSPECTION_SERVER_H
|
||
|
||
#ifdef DOXYGEN
|
||
|
||
//! \ingroup Introspection
|
||
//! \~english Start introspection server with name "name"
|
||
//! \~russian Запускает сервер интроспекции с именем "name"
|
||
# define PIINTROSPECTION_START(name)
|
||
|
||
//! \ingroup Introspection
|
||
//! \~english Stop introspection server
|
||
//! \~russian Останавливает сервер интроспекции
|
||
# define PIINTROSPECTION_STOP
|
||
|
||
#else
|
||
|
||
# if defined(PIP_INTROSPECTION) && !defined(PIP_FORCE_NO_PIINTROSPECTION)
|
||
|
||
# include "pipeer.h"
|
||
|
||
class PIIntrospectionServer;
|
||
class PISystemMonitor;
|
||
|
||
# define PIINTROSPECTION_SERVER (PIIntrospectionServer::instance())
|
||
# define PIINTROSPECTION_START(name) PIINTROSPECTION_SERVER->start(#name);
|
||
# define PIINTROSPECTION_STOP PIINTROSPECTION_SERVER->stop();
|
||
|
||
class PIP_EXPORT PIIntrospectionServer: public PIPeer {
|
||
PIOBJECT_SUBCLASS(PIIntrospectionServer, PIPeer);
|
||
|
||
public:
|
||
static PIIntrospectionServer * instance();
|
||
|
||
void start(const PIString & server_name);
|
||
void stop();
|
||
|
||
private:
|
||
PIIntrospectionServer();
|
||
~PIIntrospectionServer();
|
||
NO_COPY_CLASS(PIIntrospectionServer);
|
||
|
||
PIString genName();
|
||
void dataReceived(const PIString & from, const PIByteArray & data) override;
|
||
EVENT_HANDLER(void, sysmonDeleted);
|
||
|
||
PRIVATE_DECLARATION(PIP_EXPORT)
|
||
PISystemMonitor * sysmon = nullptr;
|
||
PIMutex sysmon_mutex;
|
||
};
|
||
|
||
# else
|
||
# define PIINTROSPECTION_START(name)
|
||
# define PIINTROSPECTION_STOP
|
||
# endif
|
||
|
||
#endif // DOXYGEN
|
||
|
||
#endif // PIINTROSPECTION_SERVER_H
|