# HTManager

## Functions

| `HTManager`
| `~HTManager`
void | `Tick`
void | `RegisterClient`
void | `UnRegisterClient`
HTManager * | `GetCurrentHTManager`

## Detailed Description

class HTManager

  HTManager provides a centralized timing service for MVO. It is intended to allow animation or other ongoing actions to proceed without completely usurping control of the application.

  The timer service is completely platform and GUI independent and therefore requires timer ticks to be delivered from whatever GUI or system calls are appropriate from the environment. It is recommended (though not required) that such ticks be delivered at the highest available frequency from the system. See CTDriver.cpp in hoops_mfc for an example.

  Once such ticks are set up, clients can register themselves to request notification at any frequency. Such clients must derive from HTClient. A reference implementation is provided by HTCObjectRotate.[cpp,h]

  The HTManager’s sense of time is achieved by repeated calls to HOOPS/3dGS’ HC_Show_Time. Refer to the 3dGS reference manual.

  This platform-independent class keeps an array of linked lists to store all of the events for one second, then has a spillover list to handle anything that needs to be scheduled further out. Its main job is to dispatch timer messages from the OS to whatever clients would like to request them. With this service in place, clients can safely release control during an animation, knowing that control will be returned when it is needed.

  Public Functions

  HTManager(int output_hz = 100)

    Constructs an HTManager object.

    Parameters

      output_hz – The number of buckets into which the timer manager splits a single second.

  virtual ~HTManager()
  virtual void Tick(float time)

    The mechanism for receiving timer events from the OS is platform dependent, so here we only provide a function call for the external “timer driver” to deliver timer events. It is recommended that such events be delivered at the highest available frequency.

  void RegisterClient(HTClient *c)

    This method informs the timer manager of a client that would like to start receiving timer events.

    Parameters

      c – A pointer to the HTClient that would like to receiver timer events.

  void UnRegisterClient(HTClient *c)

    This method stops the timer service for the given client.

    Parameters

      c – A pointer the HTClient that no longer wants to receive timer events.

  Public Static Functions

  static HTManager *GetCurrentHTManager()
    Returns

      A pointer to the timer manager currently associated with hoops_mvo’s central HDB object.