/** \file
 *
 *  Contains the DepthRateCalculator class declaration.
 *
 *  DepthRateCalculator.h should only be included by DepthRateCalculator.cpp
 *  Other classes should include DepthRateCalculatorIF.h
 *
 *  Copyright (c) 2007,2008,2009 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#ifndef DEPTHRATECALCULATOR_H_
#define DEPTHRATECALCULATOR_H_

#include "component/SyncComponent.h"

class UniversalDataReader;
class UniversalDataWriter;

/**
 *  Over simplified DepthRateCalculator component.
 *  Uses a simple differencing formula
 *  \f$ dz/dt \approx \frac{z(t)-z(t-\delta t)}{\delta t} \f$
 *  to calculate the depth rate.
 *
 *  \todo augment with 3 and 4-point backwards difference formulas:
 *  \f$ dz/dt \approx \frac{3z(t)-4z(t-\delta t)+z(t-2\delta t)}{2\delta t} \f$
 *  and
 *  \f$ dz/dt \approx \frac{11z(t)-18z(t-\delta t)+9z(t-2\delta t)-2z(t-3\delta t)}{6\delta t} \f$
 *
 *  DepthRateCalculator.h should only be included by DepthRateCalculator.cpp
 *  Other classes should include DepthRateCalculatorIF.h
 *
 *  \ingroup modules_derivation
 */
class DepthRateCalculator : public SyncDerivationComponent
{
public:
    DepthRateCalculator( const Module* module );
    virtual ~DepthRateCalculator();

    /// Initialize function
    void initialize( void );

    /// Uninitialize function
    void uninitialize( void );

    /// The actual "payload" of the component
    void run();

private:

    float lastDepth_;
    float missedSecs_;

    // Accessors
    UniversalDataReader* depthReader_;
    UniversalDataWriter* depthRateWriter_;

};

#endif /*RATECALCULATOR_H_*/
