Skip to content

Commit e9aed4d

Browse files
committed
Relocate SINTRA_TYPE_ID macro
1 parent b2f74b9 commit e9aed4d

File tree

4 files changed

+27
-36
lines changed

4 files changed

+27
-36
lines changed

include/sintra/detail/messaging/message.h

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ struct Message: public Message_prefix, public T
450450
return invalid_type_id;
451451
}
452452

453-
454453
Message(const Message&) = default;
455454
Message(Message&&) = default;
456455
Message& operator=(const Message&) = default;
@@ -585,6 +584,16 @@ struct ring_payload_traits<Message<T, RT, ID, EXPORTER>> {
585584
/* reusable macro */
586585
#define DEFINE_STRUCT_(...) VA_NARGS_CALL_OVERLOAD(VA_DEFINE_STRUCT_, __VA_ARGS__)
587586

587+
#define SINTRA_TYPE_ID(idv) \
588+
static_assert((idv) > 0, "SINTRA_TYPE_ID id must be non-zero."); \
589+
static_assert( \
590+
(idv) <= sintra::max_user_type_id, \
591+
"SINTRA_TYPE_ID id must fit in the user id range." \
592+
); \
593+
static constexpr sintra::type_id_type sintra_type_id() \
594+
{ \
595+
return sintra::make_user_type_id(idv); \
596+
}
588597

589598

590599
#define SINTRA_MESSAGE_BASE(name, idv, ...) \
@@ -599,18 +608,18 @@ struct ring_payload_traits<Message<T, RT, ID, EXPORTER>> {
599608
using name = sintra::Message<sm_body_type_##name, void, idv, Transceiver_type>; \
600609

601610

602-
#define SINTRA_MESSAGE(name, ...) \
611+
#define SINTRA_MESSAGE(name, ...) \
603612
SINTRA_MESSAGE_BASE(name, sintra::invalid_type_id, __VA_ARGS__)
604613

605-
#define SINTRA_MESSAGE_EXPLICIT(name, idv, ...) \
606-
static_assert((idv) > 0, "SINTRA_MESSAGE_EXPLICIT id must be non-zero."); \
607-
static_assert( \
608-
(idv) <= sintra::max_user_type_id, \
609-
"SINTRA_MESSAGE_EXPLICIT id must fit in the user id range." \
610-
); \
614+
#define SINTRA_MESSAGE_EXPLICIT(name, idv, ...) \
615+
static_assert((idv) > 0, "SINTRA_MESSAGE_EXPLICIT id must be non-zero."); \
616+
static_assert( \
617+
(idv) <= sintra::max_user_type_id, \
618+
"SINTRA_MESSAGE_EXPLICIT id must fit in the user id range." \
619+
); \
611620
SINTRA_MESSAGE_BASE(name, sintra::make_user_type_id(idv), __VA_ARGS__)
612621

613-
#define SINTRA_MESSAGE_RESERVED(name, ...) \
622+
#define SINTRA_MESSAGE_RESERVED(name, ...) \
614623
SINTRA_MESSAGE_BASE(name, (type_id_type)sintra::detail::reserved_id::name, __VA_ARGS__)
615624

616625

include/sintra/detail/messaging/process_message_reader_impl.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ bool Process_message_reader::stop_and_wait(double waiting_period)
195195
<< "Process_message_reader::stop_and_wait timeout: pid="
196196
<< static_cast<unsigned long long>(m_process_instance_id)
197197
<< " req_running=" << m_req_running.load()
198-
<< " rep_running=" << m_rep_running.load()
199-
<< "\n";
198+
<< " rep_running=" << m_rep_running.load() << "\n";
200199
}
201200
}
202201
return no_readers();
@@ -381,8 +380,7 @@ void Process_message_reader::request_reader_function()
381380
<< " sender_iid=" << static_cast<unsigned long long>(m->sender_instance_id)
382381
<< " recv_iid=" << static_cast<unsigned long long>(m->receiver_instance_id)
383382
<< " proc_iid="
384-
<< static_cast<unsigned long long>(s_mproc ? s_mproc->m_instance_id : 0ULL)
385-
<< "\n";
383+
<< static_cast<unsigned long long>(s_mproc ? s_mproc->m_instance_id : 0ULL) << "\n";
386384
}
387385

388386
for (auto sid : sids) {
@@ -392,8 +390,7 @@ void Process_message_reader::request_reader_function()
392390
Log_stream(log_level::debug)
393391
<< "[sintra_trace_world] pid=" << static_cast<int>(getpid())
394392
<< " sid_match=" << static_cast<unsigned long long>(sid)
395-
<< " handlers=" << shl->second.size()
396-
<< "\n";
393+
<< " handlers=" << shl->second.size() << "\n";
397394
}
398395
for (auto& e : shl->second) {
399396
e(*m);
@@ -637,8 +634,7 @@ void Process_message_reader::reply_reader_function()
637634
<< "Warning: Reply reader received message for function_instance_id="
638635
<< static_cast<unsigned long long>(m->function_instance_id)
639636
<< " but no active handler found (receiver_instance_id="
640-
<< static_cast<unsigned long long>(m->receiver_instance_id)
641-
<< ")\n";
637+
<< static_cast<unsigned long long>(m->receiver_instance_id) << ")\n";
642638
}
643639
}
644640
}
@@ -652,8 +648,7 @@ void Process_message_reader::reply_reader_function()
652648
<< static_cast<unsigned long long>(m->receiver_instance_id)
653649
<< " but object no longer exists (sender="
654650
<< static_cast<unsigned long long>(m->sender_instance_id)
655-
<< ", function=" << static_cast<unsigned long long>(m->function_instance_id)
656-
<< ")\n";
651+
<< ", function=" << static_cast<unsigned long long>(m->function_instance_id) << ")\n";
657652
}
658653
}
659654
}

include/sintra/detail/transceiver.h

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2025, Ioannis Makris
1+
// Copyright (c) 2025, Ioannis Makris
22
// Licensed under the BSD 2-Clause License, see LICENSE.md file for details.
33

44
#pragma once
@@ -34,19 +34,6 @@ using std::remove_reference;
3434
using std::string;
3535
using std::unordered_map;
3636

37-
#define SINTRA_TYPE_ID(idv) \
38-
static_assert((idv) > 0, "SINTRA_TYPE_ID id must be non-zero."); \
39-
static_assert( \
40-
(idv) <= sintra::max_user_type_id, \
41-
"SINTRA_TYPE_ID id must fit in the user id range." \
42-
); \
43-
static constexpr sintra::type_id_type sintra_type_id() \
44-
{ \
45-
return sintra::make_user_type_id(idv); \
46-
}
47-
48-
49-
5037

5138
//////////////////////////////////////////////////////////////////////////
5239
///// BEGIN Typed_instance_id //////////////////////////////////////////////

include/sintra/sintra.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ void enable_recovery();
145145
} // namespace sintra
146146

147147

148-
// -- Runtime utilities ------------------------------------------------------
149-
// High-level synchronisation, logging, message composition helpers, and the
148+
// -- Runtime utilities ------------------------------------------------------
149+
// High-level synchronisation, logging, message composition helpers, and the
150150
// process runtime live here. Historically these were gathered in
151-
// `detail/sintra_impl.h`; we now include the specific headers directly to keep
151+
// `detail/sintra_impl.h`; we now include the specific headers directly to keep
152152
// dependency relationships obvious.
153153
#include "detail/barrier.h"
154154
#include "logging.h"

0 commit comments

Comments
 (0)