Home

hersto:  Library/TimeDependent.h

Source of Library/TimeDependent.h:

Here is a link for right-clicking and downloading the file: Library/TimeDependent.h (1.65 K Byte),

and below is its content to view online.



/*
  TimeDependent.h
 
  Common base class for CTDamper and CTChaser.
  Forms an object that needs to perform actions
  in a frequent manner, e.g. in an animation
  framework. Provides a Tick(.) method that is
  to be called frequently and can announce when
  it needs thos method calls and when not.

  Author:
      Herbert Stocker

  HomePage:
      http://www.hersto.net/Followers
      (various resources there)

  License:
      You may use this file in any project and
      modify it as long as you keep this comment
      block unchanged.

  Accompanying Files:
      TimeDependent.cpp

  Documentation:
      See http://www.hersto.net/Followers

 */


#pragma once


class CTimeDependent
{
public:
    CTimeDependent();
    virtual ~CTimeDependent();

    virtual void Tick(double DeltaT, double Now); // does an update to the internal state and calls the receiver function set with SetReceiver if a change to value has happened.
    virtual void SetNeedTickCB(void* pvContext, double (*pfNeedTickCB) (void* pvContext, CTimeDependent* pCaller, bool bNeedTick));

protected:

    void* mpvNeedTickContext;
    double (*mpfNeedTickCB) (void* pvContext, CTimeDependent* pCaller, bool bNeedTick);

    void mfUnRegisterFromTimer();
    // should be called from the destructor of the derived class if
    // the timer needs to see the derived class.
    // Otherwise the destructor of CTimeDependent will unregister, 
    // which would make the timer see only a CTimeDependent object,
    // because then the derived class members have already been destroyed.
    // (The compiler will even adjust the vtable for this)
};




__.-.__
end of document