/** \file
 *
 *  Specifies the interface details for the HFRCMTimeInterpolator
 *  component in the EstimationModule.
 *
 *  HFRCMTimeInterpolator.h should only be included by
 *  HFRCMTimeInterpolator.cpp
 *  Other classes should include HFRCMTimeInterpolator.h
 *
 *  Copyright (c) 2013, 2014 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#ifndef HFRCMTIMEINTERPOLATOR_H_
#define HFRCMTIMEINTERPOLATOR_H_

#include "component/SyncComponent.h"
#include "data/Mtx.h"

#include "HFRadarCompactModelForecaster.h" // for TOTAL_HOURS, etc.

class UniversalDataReader;
class BlobReader;
class ConfigReader;

/**
 *  Specifies the interface details for the HFRCMTimeInterpolator
 *  component in the EstimationModule.
 *
 *  HFRCMTimeInterpolator.h should only be included by
 *  HFRCMTimeInterpolator.cpp
 *  Other classes should include HFRCMTimeInterpolator.h
 *
 *  \ingroup modules_estimation
 */

class HFRCMTimeInterpolator : public SyncEstimationComponent
{
public:
    HFRCMTimeInterpolator( const Module* module );
    virtual ~HFRCMTimeInterpolator();

    /// Initialize function
    void initialize( void );

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

    /// Return the singleton
    static HFRCMTimeInterpolator* Instance()
    {
        return Instance_;
    }

    /// Look up the expansion coefficients at the specified time.
    bool lookupExpansionCoefficients( Timestamp ts, Mtx & ec ); // TODO: Is there a reason that I should not make this a static function so that user components to not need to store the pointer to the singleton in order to call the function?

protected:

    int verbosity_;
    Mtx expansionCoefficients_;
//    Mtx expansionCoefficientsNow_;
    double forecastEpochSeconds_[ HFRadarCompactModelForecasterIF::TOTAL_HOURS ];
    int numModes_;
    int numTimes_;
    Timestamp forecastStart_;
    Timestamp forecastEnd_;
    bool haveValidForecast_;

    // readers & writers
    BlobReader *expansionCoefficientsReader_;
    BlobReader *forecastTimesReader_;

    // Configuration readers

    static HFRCMTimeInterpolator* Instance_;

private:
    // Note that the copy constructor below is private and not given a body.
    // Any attempt to call it will return a compiler error.
    HFRCMTimeInterpolator( const HFRCMTimeInterpolator& old ); // disallow copy constructor

};

#endif /* HFRCMTIMEINTERPOLATOR_H_ */
