Howto:Exposing Subsystems to Nasal: Difference between revisions

Line 36: Line 36:
== Patching ==
== Patching ==
=== SimGear ===
=== SimGear ===
For starters, we will just add some debugging statements to the event manager
For starters, we will just add some debugging statements to the event manager. The event manager maintains two queues for timers, one for timers intended to work with simulation time, and one with realtime (i.e. those also executing when paused). These timers are fields/members of the SGEventMgr class which inherits from SGSubsystem, they are accessible as _simQueue and _rtQueue, using the interface of the SGTimerQueue class, the size of the queue is stored in the private _numEntries field (int), which can be made accessible by adding a public getter method, which in turn can then be used by the SGEventMgr subsystem to access the size of each queue:
 
<syntaxhighlight lang="diff">
<syntaxhighlight lang="diff">
diff --git a/simgear/structure/event_mgr.cxx b/simgear/structure/event_mgr.cxx
diff --git a/simgear/structure/event_mgr.cxx b/simgear/structure/event_mgr.cxx