Skip to content

Commit

Permalink
Another attempt to fix #80.
Browse files Browse the repository at this point in the history
  • Loading branch information
eao197 committed Mar 19, 2024
1 parent be8e3d3 commit 3d47a8b
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 14 deletions.
62 changes: 62 additions & 0 deletions dev/so_5/detect_os.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* SObjectizer-5
*/

/*!
* \file
* \brief Helper macros for detection of compiler/platform.
*
* \since v.5.8.2
*/

#pragma once

/*!
* \def SO_5_OS_WIN32
* \brief A marker for Win32 platform.
*
* \note This marker is also defined for Win64 platform.
*/

/*!
* \def SO_5_OS_WIN64
* \brief A marker for Win64 platform.
*/

/*!
* \def SO_5_OS_WINDOWS
* \brief A marker for Windows platform.
*
* Defined if SO_5_OS_WIN32 or SO_5_OS_WIN64 are defined.
*/

/*!
* \def SO_5_OS_UNIX
* \brief A marker for Unix platforms, but not macOS/iOS.
*/

/*!
* \def SO_5_OS_APPLE
* \brief A marker for macOS/iOS.
*/

#if defined( _WIN64 )
#define SO_5_OS_WIN64
#endif

#if defined( _WIN32 )
#define SO_5_OS_WIN32
#endif

#if defined( SO_5_OS_WIN32 ) || defined( SO_5_OS_WIN64 )
#define SO_5_OS_WINDOWS
#endif

#if defined(unix) || defined(__unix__) || defined(__unix)
#define SO_5_OS_UNIX
#endif

#if defined(__APPLE__)
#define SO_5_OS_APPLE
#endif

38 changes: 24 additions & 14 deletions dev/so_5/stats/messages.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

/*!
* \file
* \since
* v.5.5.4
*
* \brief Messages with monitoring information.
*
* \since v.5.5.4
*/

#pragma once
Expand All @@ -16,6 +16,8 @@

#include <so_5/message.hpp>

#include <so_5/detect_os.hpp>

#include <so_5/stats/prefix.hpp>
#include <so_5/stats/work_thread_activity.hpp>

Expand All @@ -33,19 +35,28 @@ namespace stats
namespace messages
{

/*
* Implementation note: this type has to be marked as SO_5_TYPE for
* clang on FreeBSD/macOS. But SO_5_TYPE shouldn't be used on Windows.
*/
#if defined(SO_5_OS_WINDOWS)
#define SO_5_EXPORT_IMPORT_FOR_QUANTITY_MSG /* empty */
#else
#define SO_5_EXPORT_IMPORT_FOR_QUANTITY_MSG SO_5_TYPE
#endif

/*!
* \since
* v.5.5.4
*
* \brief A message with value of some quantity.
*
* This message can be used for monitoring things like queue sizes,
* count of delayed messages, count of cooperations and so on.
*
* \tparam T type for representing quantity.
*
* \since v.5.5.4
*/
template< typename T >
struct quantity : public message_t
struct SO_5_EXPORT_IMPORT_FOR_QUANTITY_MSG quantity : public message_t
{
//! Prefix of data_source name.
prefix_t m_prefix;
Expand All @@ -66,33 +77,32 @@ struct quantity : public message_t
{}
};

#undef SO_5_EXPORT_IMPORT_FOR_QUANTITY_MSG

/*!
* \brief Notification about start of new stats distribution.
*
* \since
* v.5.5.18
*
* \note This message is empty now but it is not declared as a signal.
* It is for a possibility of expansion of the message in the future.
*
* \since v.5.5.18
*/
struct SO_5_TYPE distribution_started : public message_t {};

/*!
* \brief Notification about finish of stats distribution.
*
* \since
* v.5.5.18
*
* \note This message is empty now but it is not declared as a signal.
* It is for a possibility of expansion of the message in the future.
*
* \since v.5.5.18
*/
struct SO_5_TYPE distribution_finished : public message_t {};

/*!
* \brief Information about one work thread activity.
*
* \since
* v.5.5.18
* \since v.5.5.18
*/
struct SO_5_TYPE work_thread_activity : public message_t
{
Expand Down

0 comments on commit 3d47a8b

Please # to comment.