VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
fireDetonationSender.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright (c) 2026 MAK Technologies, Inc.
3  * All rights reserved.
4  ******************************************************************************/
5 
6 #pragma once
7 
10 
11 #include <vrfMsgTransport/event.h>
12 #include <vrfutil/rwUUID.h>
13 #include <json/json.h>
14 #include <tbb/spin_mutex.h>
15 #include <boost/signals2.hpp>
16 #include <memory>
17 #include <set>
18 #include <string>
19 #include <vector>
20 
21 namespace makVrfEvents
22 {
23  class DtFireEvent;
24  class DtDetonationEvent;
25 }
26 
27 // ============================================================================
28 // DtFireDetonationEventSource
29 // ============================================================================
30 
38 {
39 public:
40  DtFireDetonationEventSource() = default;
41  ~DtFireDetonationEventSource() override = default;
42 
43  void subscribe(makVrfEvents::DtEventManager* em) override;
44  void unsubscribe() override;
45 
47  std::vector<Json::Value> drainFireEvents();
48 
50  std::vector<Json::Value> drainDetonationEvents();
51 
52 private:
53  void onFireEvent(const makVrfEvents::DtEvent& event);
54  void onDetonationEvent(const makVrfEvents::DtEvent& event);
55 
56  mutable tbb::spin_mutex myQueueMutex;
57  std::vector<Json::Value> myPendingFireEvents;
58  std::vector<Json::Value> myPendingDetonationEvents;
59 
60  boost::signals2::connection myFireConnection;
61  boost::signals2::connection myDetonationConnection;
62 };
63 
64 // ============================================================================
65 // DtFireDetonationSender
66 // ============================================================================
67 
87 {
88 public:
90  ~DtFireDetonationSender() override = default;
91 
93  std::shared_ptr<DtIInteractionEventSource> eventSource() const override { return myEventSource; }
94 
95  std::vector<Json::Value> drainFiltered(DtWebLvcClientSession& session) override;
96 
97 private:
98  std::shared_ptr<DtFireDetonationEventSource> myEventSource;
99 
102  std::set<std::string> mySentFireEventIds;
103 };
boost::signals2::connection myDetonationConnection
Definition: fireDetonationSender.h:61
DtFireDetonationSender - Filters and delivers WeaponFire and MunitionDetonation interactions for one ...
Definition: fireDetonationSender.h:86
boost::signals2::connection myFireConnection
Definition: fireDetonationSender.h:60
DtIInteractionTypeSender - Abstract interface for a single interaction type sub-sender.
Definition: iInteractionTypeSender.h:26
The DtEventManager handles the sending and receipt of system events (fire, detonate, command, etc). It provides a thread-safe way for the sim engine to send and receive such events, between both components within this sim engine and other remote applications.
Definition: eventManager.h:33
std::shared_ptr< DtIInteractionEventSource > eventSource() const override
Returns the event source for registration with DtInteractionProcessor.
Definition: fireDetonationSender.h:93
Contains the DtUUID class declaration.
std::vector< Json::Value > myPendingFireEvents
Definition: fireDetonationSender.h:57
std::vector< Json::Value > drainFireEvents()
Atomically swap-and-return all pending fire event records.
Definition: event.h:13
std::vector< Json::Value > myPendingDetonationEvents
Definition: fireDetonationSender.h:58
std::vector< Json::Value > drainFiltered(DtWebLvcClientSession &session) override
Drain events from the owned source, apply filtering against session, and return the JSON records that...
void onFireEvent(const makVrfEvents::DtEvent &event)
std::set< std::string > mySentFireEventIds
EventIds of fire events forwarded to this client whose matching detonation has not yet been seen...
Definition: fireDetonationSender.h:102
~DtFireDetonationSender() override=default
std::vector< Json::Value > drainDetonationEvents()
Atomically swap-and-return all pending detonation event records.
~DtFireDetonationEventSource() override=default
tbb::spin_mutex myQueueMutex
Definition: fireDetonationSender.h:56
DtFireDetonationEventSource - Subscribes to VRF fire and detonation signals, serializes events to JSO...
Definition: fireDetonationSender.h:37
void onDetonationEvent(const makVrfEvents::DtEvent &event)
void unsubscribe() override
Disconnect all signal subscriptions. Called once by DtInteractionProcessor::shutdown().
void subscribe(makVrfEvents::DtEventManager *em) override
Subscribe to relevant signals on em. Called once by DtInteractionProcessor::initialize().
std::shared_ptr< DtFireDetonationEventSource > myEventSource
Definition: fireDetonationSender.h:98
WebLVC Client Session - Tracks state for each connected client per SISO-STD-017-2022 Section 5...
Definition: webLVCClientSession.h:28
DtIInteractionEventSource - Abstract interface for a per-interaction-type event collector.
Definition: iInteractionEventSource.h:27

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)