MAK Legion API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
eventManager.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
8 
9 #pragma once
10 
11 #include "legionDataStore/export.h"
18 
19 #include <string>
20 #include <vector>
21 #include <functional>
22 #include <atomic>
23 
24 
25 namespace Legion
26 {
28 
29  typedef UInt64 EventManagerHandle;
30 
34  {
35  public:
37  template<typename EVENT_TYPE>
38  EVENT_TYPE createEvent();
39 
41  virtual EventManagerHandle handle() const;
42 
44  virtual UInt32 addEvent(const EventInstance& iEvent);
45 
47  virtual EventType registerEventType(const EventDescriptor& reg);
48 
50  virtual ParameterId parameterId(EventType eventType, const std::string& parameterName);
51 
55  template<typename EVENT_TYPE>
56  UInt32 addEventCallback(Callback<void(Span<EVENT_TYPE>&)> cb);
57 
58 
61  template<typename EVENT_TYPE>
62  bool removeEventCallback(UInt32 handle);
63 
64 
66  template<typename EVENT_TYPE>
67  const std::vector<const EVENT_TYPE> getEvents();
68 
69 
71  template<typename EVENT_TYPE>
72  const std::vector<EVENT_TYPE> peekEvents();
73 
75  virtual UInt32 nextId();
76 
77  virtual bool selfReflecting() const;
78  virtual void setSelfReflecting(bool val);
79 
80 
81  protected:
84 
86  virtual ~EventManager();
87  friend class SimulationDatabase;
88 
89  virtual void addInterest(const EventType eventTypeId);
90  virtual void removeInterest(const EventType eventTypeId);
91 
92 
93 
94  struct CallbackData
95  {
97  std::function<void(EventHandle* events, UInt32 count)> convertAndExecute;
98  };
99 
100  static void callback(void* usr, EventHandle* events, UInt32 count);
101  std::vector<CallbackData*> myCallbackData;
102 
103 
104  std::atomic<int> myNextId;
105 
107  };
108 }
109 
std::function< void(EventHandle *events, UInt32 count)> convertAndExecute
Definition: eventManager.h:97
UInt64 EventManagerHandle
Definition: eventManager.h:27
std::atomic< int > myNextId
Definition: eventManager.h:104
Defines a template callback object to make binding member function pointers easier.
The EventManager manages the creation and distribution of simulation events such as Fire and Detonate...
Definition: eventManager.h:33
An event descriptor describes the layout of an event.
Definition: eventDescriptor.h:37
A span represents a contiguous array of objects in memory.
Definition: span.h:21
Definition: eventManager.h:94
Callback template for binding static or member functions for callback at later time The return type a...
Definition: callback.h:66
An EventInstance is a single instance of a simulation event such as Fire or Detonate.
Definition: eventInstance.h:32
#define LEGION_DLL
Definition: legionDataStore/export.h:24
unsigned int UInt32
Definition: dataTypes.h:44
The SimulationDatabase stores all data for the simulation. It also owns the event, control, and view managers.
Definition: simulationDatabase.h:39
std::vector< CallbackData * > myCallbackData
Definition: eventManager.h:101
UInt64 EventHandle
Definition: eventInstance.h:22
UInt32 handle
Definition: eventManager.h:96
unsigned long long UInt64
Definition: dataTypes.h:46
UInt32 ParameterId
Definition: controlInstance.h:23
UInt32 EventType
Definition: eventInstance.h:20
EventManagerHandle myHandle
Definition: eventManager.h:106

Document ID: Generated on Mon Mar 8 15:11:30 EST 2021 from SVN revision 225633
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)