doc, small fixes

This commit is contained in:
2022-05-08 19:23:52 +03:00
parent 460519c075
commit 3107949e6f
24 changed files with 1061 additions and 406 deletions

View File

@@ -2,7 +2,7 @@
* \ingroup System
* \~\brief
* \~english External process
* \~russian Внешний процесс
* \~russian Внешний процесс
*/
/*
PIP - Platform Independent Primitives

View File

@@ -20,6 +20,46 @@
#include "pisingleapplication.h"
#include "pisharedmemory.h"
//! \class PISingleApplication pisingleapplication.h
//! \~\details
//! \~english
//!
//!
//! \~russian
//! Этот класс позволяет отслеживать повторный запуск приложения
//! и передавать сообщение первому запущеному.
//!
//! Видят друг друга %PISingleApplication с одинаковыми "app_name",
//! задаваемым в конструкторе.
//!
//! Если проверка \a isFirst() успешна, значит этот экземпляр
//! запущен первым, и можно соединиться к событию \a messageReceived().
//!
//! Если проверка провалена, значит этот экземпляр не первый,
//! и можно послать ему сообщение с помощью \a sendMessage(),
//! а затем выйти.
//!
//! \~\code
//! int main(int argc, char * argv[]) {
//! PISingleApplication sapp("myapp");
//! if (sapp.isFirst()) {
//! piCout << "I`m first, wait for another";
//! CONNECTL(&sapp, messageReceived, [](PIByteArray msg){
//! piCout << "Msg from another:" << PIString(msg);
//! });
//! } else {
//! piCout << "I`m not first, send and exit";
//! sapp.sendMessage(PIString("Hello!").toByteArray());
//! return 0;
//! }
//! WAIT_FOREVER
//! return 0;
//! }
//! \endcode
//!
#define SHM_SIZE 1024*32

View File

@@ -1,3 +1,9 @@
/*! \file pisingleapplication.h
* \ingroup System
* \~\brief
* \~english Single-instance application control
* \~russian Контроль одного экземпляра приложения
*/
/*
PIP - Platform Independent Primitives
Single application
@@ -24,16 +30,46 @@
class PISharedMemory;
//! \ingroup System
//! \~\brief
//! \~english Single-instance application control.
//! \~russian Контроль одного экземпляра приложения.
class PIP_EXPORT PISingleApplication: public PIThread {
PIOBJECT_SUBCLASS(PISingleApplication, PIThread)
public:
//! \~english Construct %PISingleApplication with name "app_name"
//! \~russian Создает %PISingleApplication с именем "app_name"
PISingleApplication(const PIString & app_name = PIString());
~PISingleApplication();
//! \~english Returns if this application instance is launched first
//! \~russian Возвращает первым ли был запущен этот экземпляр приложения
bool isFirst() const;
EVENT_HANDLER1(void, sendMessage, const PIByteArray &, m);
EVENT1(messageReceived, const PIByteArray &, m)
EVENT1(messageReceived, PIByteArray, m)
//! \handlers
//! \{
//! \fn void sendMessage(const PIByteArray & m)
//! \brief
//! \~english Send message "m" to first launched application
//! \~russian Посылает сообщение "m" первому запущеному приложению
//! \}
//! \events
//! \{
//! \fn void messageReceived(PIByteArray m)
//! \brief
//! \~english Raise on first launched application receive message from another
//! \~russian Вызывается первым запущеным приложением по приему сообщения от других
//! \}
private:
void begin();