MAK Legion API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
simulationDatabase.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
8 
9 
10 #pragma once
11 
12 #include "legionDataStore/export.h"
15 
16 #include <vector>
17 #include <map>
18 #include <list>
19 
20 namespace Legion
21 {
22  class Configuration;
23  class EventManager;
24  class ControlManager;
25  class ReadStateInstance;
26  class WriteStateInstance;
27  class ViewManager;
28 
31 
33  typedef UInt64 InstanceHandle;
34  typedef UInt32 AttributeSetId;
36  typedef UInt32 AttributeIndex;
37 
40  {
41  public:
43  SimulationDatabase(const Configuration& config);
45  virtual~SimulationDatabase();
46 
48  virtual DatabaseHandle handle() const { return myHandle; }
49 
53  virtual void beginFrame(double time);
56  virtual void endFrame();
57 
61  virtual bool inFrame() const;
62 
64  virtual UInt64 currentFrame() const;
65 
67  virtual double simTime() const;
68 
69 
71  virtual UInt32 clientId() const;
72 
74  virtual bool addBeginFrameCallback(BeginFrameCb bfcb);
75  virtual bool removeBeginFrameCallback(BeginFrameCb bfcb);
77  virtual bool addEndFrameCallback(EndFrameCb efd);
78  virtual bool removeEndFrameCallback(EndFrameCb efd);
79 
81  virtual AttributeSetId registerAttributeSet(const AttributeSetDescriptor& descriptor);
83  virtual AttributeId registerAttribute(UInt32 setId, const AttributeDescriptor& descriptor);
84 
86  virtual AttributeSetId findAttributeSetId(const std::string& name);
87 
89  virtual AttributeIndex findAttributeIndex(UInt32 setId, const std::string& name);
91  virtual AttributeIndex findAttributeIndex(UInt32 setId, UInt32 attrId);
92 
96  template<typename OBJECT_TYPE>
97  OBJECT_TYPE createInstance();
98 
102  virtual InstanceHandle findInstance(GlobalIdentifier globalId);
103 
105  virtual void destroyInstance(const WriteStateInstance& instance);
106 
108  virtual ClientIdentifier getClientId(InstanceHandle instance);
109 
113  virtual GlobalIdentifier findGlobalId(InstanceHandle handle);
114 
116  virtual Bool reserve(AttributeSetId type, UInt32 count);
119  virtual UInt32 capacity(AttributeSetId type);
120 
122  virtual EventManager& eventManager();
124  virtual ControlManager& controlManager();
126  virtual ViewManager& viewManager();
127 
128  protected:
130 
134 
135  static void beginFrameCallback(void* usr, double simTime);
136  static void endFrameCallback(void* usr);
137  std::vector<BeginFrameCb> myBeginFrameCallbacks;
138  std::vector<EndFrameCb> myEndFrameCallbacks;
139  };
140 }
141 
EventManager * myEventManager
Definition: simulationDatabase.h:131
ControlManager * myControlManager
Definition: simulationDatabase.h:132
The ViewManager creates and manages the views of a database.
Definition: viewManager.h:48
UInt16 ClientIdentifier
Definition: dataTypes.h:52
UInt64 DatabaseHandle
Definition: simulationDatabase.h:32
Defines a template callback object to make binding member function pointers easier.
DatabaseHandle myHandle
Definition: simulationDatabase.h:129
An attribute descriptor describes a single attribute.
Definition: attributeSetDescriptor.h:32
std::vector< BeginFrameCb > myBeginFrameCallbacks
Definition: simulationDatabase.h:137
The EventManager manages the creation and distribution of simulation events such as Fire and Detonate...
Definition: eventManager.h:33
Callback template for binding static or member functions for callback at later time The return type a...
Definition: callback.h:66
UInt32 AttributeSetId
Definition: readStateInstance.h:22
UInt64 GlobalIdentifier
a globally unique identifier
Definition: dataTypes.h:50
std::vector< EndFrameCb > myEndFrameCallbacks
Definition: simulationDatabase.h:138
#define LEGION_DLL
Definition: legionDataStore/export.h:24
UInt32 AttributeIndex
Definition: readStateInstance.h:21
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
UInt32 AttributeId
Definition: simulationDatabase.h:35
Callback< void()> EndFrameCb
Definition: simulationDatabase.h:30
The WriteStateInstance is the base class of all write simulation object repository classes...
Definition: writeStateInstance.h:34
unsigned long long UInt64
Definition: dataTypes.h:46
ViewManager * myViewManager
Definition: simulationDatabase.h:133
Callback< void(double)> BeginFrameCb
Definition: simulationDatabase.h:27
virtual DatabaseHandle handle() const
Returns the handle to the internal representation of this object.
Definition: simulationDatabase.h:48
The configuration object parses the command line and loads a configuration file to provide the user c...
Definition: configuration.h:23
The control manager is responsible for creating and adding controls to the simulation database...
Definition: controlManager.h:33
UInt64 InstanceHandle
Definition: readStateInstance.h:20
/brief An attribute set descriptor describes a group of attributes that are treated as a single set o...
Definition: attributeSetDescriptor.h:47
UInt8 Bool
Definition: dataTypes.h:53

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)