Skip to content

Commit

Permalink
Service process common object. (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
aregtech committed Mar 19, 2024
1 parent abc1b93 commit 0a3340a
Show file tree
Hide file tree
Showing 49 changed files with 1,754 additions and 1,775 deletions.
4 changes: 4 additions & 0 deletions framework/areg-extend.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,15 @@
<ClCompile Include="extend\db\private\SqliteDatabase.cpp" />
<ClCompile Include="extend\service\private\DataRateHelper.cpp" />
<ClCompile Include="extend\service\private\NESystemService.cpp" />
<ClCompile Include="extend\service\private\posix\ServiceApplicationBasePosix.cpp" />
<ClCompile Include="extend\service\private\ServiceApplicationBase.cpp" />
<ClCompile Include="extend\service\private\SystemServiceBase.cpp" />
<ClCompile Include="extend\service\private\IEServiceConnectionHandler.cpp" />
<ClCompile Include="extend\service\private\ServerConnection.cpp" />
<ClCompile Include="extend\service\private\ServerReceiveThread.cpp" />
<ClCompile Include="extend\service\private\ServerSendThread.cpp" />
<ClCompile Include="extend\service\private\ServiceCommunicatonBase.cpp" />
<ClCompile Include="extend\service\private\win32\ServiceApplicationBaseWin32.cpp" />
</ItemGroup>
<ItemGroup>
<Text Include="extend\CMakeLists.txt" />
Expand All @@ -70,6 +73,7 @@
<ClInclude Include="extend\service\DataRateHelper.hpp" />
<ClInclude Include="extend\service\NESystemService.hpp" />
<ClInclude Include="extend\console\SystemServiceConsole.hpp" />
<ClInclude Include="extend\service\ServiceApplicationBase.hpp" />
<ClInclude Include="extend\service\SystemServiceBase.hpp" />
<ClInclude Include="extend\service\IEServiceConnectionHandler.hpp" />
<ClInclude Include="extend\service\ServerConnection.hpp" />
Expand Down
12 changes: 12 additions & 0 deletions framework/areg-extend.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@
<ClCompile Include="extend\db\private\LogSqliteDatabase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="extend\service\private\ServiceApplicationBase.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="extend\service\private\posix\ServiceApplicationBasePosix.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="extend\service\private\win32\ServiceApplicationBaseWin32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Text Include="extend\CMakeLists.txt">
Expand Down Expand Up @@ -116,6 +125,9 @@
<ClInclude Include="extend\db\LogSqliteDatabase.hpp">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="extend\service\ServiceApplicationBase.hpp">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="extend\Readme.md">
Expand Down
4 changes: 0 additions & 4 deletions framework/areg.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="areg\appbase\private\posix\ApplicationPosix.cpp" />
<ClCompile Include="areg\appbase\private\posix\NEApplicationPosix.cpp" />
<ClCompile Include="areg\appbase\private\win32\ApplicationWin32.cpp" />
<ClCompile Include="areg\appbase\private\configure.cpp" />
<ClCompile Include="areg\appbase\private\Application.cpp" />
<ClCompile Include="areg\appbase\private\NEApplication.cpp" />
<ClCompile Include="areg\appbase\private\win32\NEApplicationWin32.cpp" />
<ClCompile Include="areg\base\private\posix\CriticalSectionIX.cpp" />
<ClCompile Include="areg\base\private\posix\FilePosix.cpp" />
<ClCompile Include="areg\base\private\posix\MutexIX.cpp" />
Expand Down Expand Up @@ -427,8 +425,6 @@
</ItemGroup>
<ItemGroup>
<Text Include="areg\appbase\private\CMakeLists.txt" />
<Text Include="areg\appbase\private\posix\CMakeLists.txt" />
<Text Include="areg\appbase\private\win32\CMakeLists.txt" />
<Text Include="areg\base\private\CMakeLists.txt" />
<Text Include="areg\base\private\posix\CMakeLists.txt" />
<Text Include="areg\base\private\win32\CMakeLists.txt" />
Expand Down
8 changes: 0 additions & 8 deletions framework/areg.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,6 @@
<ClCompile Include="areg\trace\private\IELogDatabaseEngine.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="areg\appbase\private\win32\NEApplicationWin32.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="areg\appbase\private\posix\NEApplicationPosix.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="system\windows\GEWindows.h">
Expand Down Expand Up @@ -1164,8 +1158,6 @@
<Text Include="CMakeLists.txt" />
<Text Include="areg\CMakeLists.txt" />
<Text Include="areg\appbase\private\CMakeLists.txt" />
<Text Include="areg\appbase\private\posix\CMakeLists.txt" />
<Text Include="areg\appbase\private\win32\CMakeLists.txt" />
<Text Include="areg\base\private\CMakeLists.txt" />
<Text Include="areg\base\private\posix\CMakeLists.txt" />
<Text Include="areg\base\private\win32\CMakeLists.txt" />
Expand Down
5 changes: 2 additions & 3 deletions framework/areg/appbase/private/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ list(APPEND areg_SRC
${areg_BASE}/appbase/private/Application.cpp
${areg_BASE}/appbase/private/configure.cpp
${areg_BASE}/appbase/private/NEApplication.cpp
${areg_BASE}/appbase/private/posix/ApplicationPosix.cpp
${areg_BASE}/appbase/private/win32/ApplicationWin32.cpp
)

include("${areg_BASE}/appbase/private/posix/CMakeLists.txt")
include("${areg_BASE}/appbase/private/win32/CMakeLists.txt")
24 changes: 24 additions & 0 deletions framework/areg/appbase/private/NEApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,27 @@ AREG_API_IMPL const std::vector<Identifier> NEApplication::LogScopePriorityInd
, { static_cast<unsigned int>(NETrace::eLogPriority::PrioInfo) , NETrace::PRIO_INFO_STR }
, { static_cast<unsigned int>(NETrace::eLogPriority::PrioDebug) , NETrace::PRIO_DEBUG_STR }
};

//! AREG TCP/IP Multicast Router Service name
AREG_API_IMPL char NEApplication::ROUTER_SERVICE_NAME_ASCII[] { 'm', 'c', 'r', 'o', 'u', 't', 'e', 'r', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', '\0' };

//! AREG TCP/IP Multicast Router Service name
AREG_API_IMPL wchar_t NEApplication::ROUTER_SERVICE_NAME_WIDE[] { 'm', 'c', 'r', 'o', 'u', 't', 'e', 'r', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', '\0' };

//! Router Service executable
AREG_API_IMPL char NEApplication::ROUTER_SERVICE_EXECUTABLE_ASCII[] { 'm', 'c', 'r', 'o', 'u', 't', 'e', 'r', '.', 'e', 'x', 'e', '\0' };

//! Router Service executable
AREG_API_IMPL wchar_t NEApplication::ROUTER_SERVICE_EXECUTABLE_WIDE[] { 'm', 'c', 'r', 'o', 'u', 't', 'e', 'r', '.', 'e', 'x', 'e', '\0' };

//! AREG TCP/IP Log Collector Service name
AREG_API_IMPL char NEApplication::LOGGER_SERVICE_NAME_ASCII[] { 'l', 'o', 'g', 'g', 'e', 'r', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', '\0' };

//! AREG TCP/IP Log Collector Service name
AREG_API_IMPL wchar_t NEApplication::LOGGER_SERVICE_NAME_WIDE[] { 'l', 'o', 'g', 'g', 'e', 'r', '.', 's', 'e', 'r', 'v', 'i', 'c', 'e', '\0' };

//! Log Collector Service executable
AREG_API_IMPL char NEApplication::LOGGER_SERVICE_EXECUTABLE_ASCII[] { 'l', 'o', 'g', 'g', 'e', 'r', '.', 'e', 'x', 'e', '\0' };

//! Log Collector Service executable
AREG_API_IMPL wchar_t NEApplication::LOGGER_SERVICE_EXECUTABLE_WIDE[] { 'l', 'o', 'g', 'g', 'e', 'r', '.', 'e', 'x', 'e', '\0' };
4 changes: 0 additions & 4 deletions framework/areg/appbase/private/posix/CMakeLists.txt

This file was deleted.

44 changes: 0 additions & 44 deletions framework/areg/appbase/private/posix/NEApplicationPosix.cpp

This file was deleted.

4 changes: 0 additions & 4 deletions framework/areg/appbase/private/win32/CMakeLists.txt

This file was deleted.

44 changes: 0 additions & 44 deletions framework/areg/appbase/private/win32/NEApplicationWin32.cpp

This file was deleted.

6 changes: 2 additions & 4 deletions framework/areg/ipc/NERemoteService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ namespace NERemoteService
**/
enum eRemoteConnection : uint32_t
{
/* Remote instance is disconnected. */
RemoteDisconnected = 0
/* Remote instance is connected. */
, RemoteConnected = 1
RemoteDisconnected = 0 //!< Remote instance is disconnected.
, RemoteConnected = 1 //!< Remote instance is connected.
};

/**
Expand Down
2 changes: 1 addition & 1 deletion framework/areg/trace/private/TraceMessage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void TraceMessage::logTrace( NETrace::eLogPriority logPrio, const char * format,
inline void TraceMessage::_sendLog( unsigned int scopeId, NETrace::eLogPriority msgPrio, const char * format, va_list args )
{
LogMessage logData(NETrace::eLogMessageType::LogMessageText, scopeId, msgPrio, nullptr, 0);
logData.logMessageLen = String::formatStringList( logData.logMessage, NETrace::LOG_MESSAGE_IZE - 1, format, args );
logData.logMessageLen = String::formatStringList( logData.logMessage, NETrace::LOG_MESSAGE_IZE, format, args );
TraceManager::logMessage( logData );
}

Expand Down
58 changes: 55 additions & 3 deletions framework/extend/service/NESystemService.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
* \brief AREG Platform, The system service basic settings.
************************************************************************/

/************************************************************************
* Include files.
************************************************************************/
/************************************************************************
* Include files.
************************************************************************/
#include "areg/base/GEGlobal.h"

#include "areg/base/NEString.hpp"
#include "extend/console/Console.hpp"
#include "extend/console/OptionParser.hpp"

Expand Down Expand Up @@ -158,6 +159,24 @@ namespace NESystemService
* \brief Coordinate to start to display information message.
**/
constexpr Console::Coord COORD_INFO_MSG { 0, 8 };

/**
* \brief Converts the argument list from 'char' or 'wchar_t' type to the 'char'.
* The memory of returned value should be freed by calling 'deleteArgument'.
* \tparam CharType The type of the string. Should be 'char' or 'wchar_t'.
* \param argv The list of arguments received in 'main' function.
* \param argc The number of arguments in the argument list.
* \returns Returns argument list of type 'char'
**/
template<typename CharType>
inline char** convertArguments(CharType** argv, int argc);

/**
* \brief Deletes the list of arguments returned by 'convertArguments' function.
* \param argv The list of arguments returned by 'convertArguments' function.
* \param argc The number of arguments in the argument list.
**/
inline void deleteArguments(char** argv, int argc);
}

//////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -210,4 +229,37 @@ inline const char * const NESystemService::getString( NESystemService::eSystemSe
}
}

template<typename CharType>
inline char** NESystemService::convertArguments(CharType** argv, int argc)
{
char** result = argc != 0 ? DEBUG_NEW char* [argc] : nullptr;
if (result != nullptr)
{
for (int i = 0; i < argc; ++i)
{
CharType* entry = argv[i];
uint32_t length = static_cast<uint32_t>(NEString::getStringLength<CharType>(entry));
uint32_t size = length + 1u;
char* arg = DEBUG_NEW char[size];
NEString::copyString<char, CharType>(arg, size, entry);
result[i] = arg;
}
}

return result;
}

inline void NESystemService::deleteArguments(char** argv, int argc)
{
if (argv != nullptr)
{
for (int i = 0; i < argc; ++i)
{
delete[] argv[i];
}

delete[] argv;
}
}

#endif // AREG_EXTEND_SERVICE_NESYSTEMSERVICE_HPP

0 comments on commit 0a3340a

Please sign in to comment.