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

#ifndef ABORTSAMPLE_H_
#define ABORTSAMPLE_H_

#include "component/Behavior.h"

/**
 *  Contains the AbortSample Behavior/Command
 *
 *  Returns statisfied if the elpased time since
 *  last valid acoustic_receive_time (universal variable)
 *  exceeds the allowed duration.
 *
 *  AbortSample.h should only be included by AbortSample.cpp
 *  Other classes should include AbortSampleIF.h
 *
 *  \ingroup modules_sample
 **/

class AbortSample : public Behavior
{
public:

    AbortSample( const Str& prefix, const Module* module );

    virtual ~AbortSample();

    /// Initialize function
    void initialize( void );

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

    /// Runs and returns true if acoustic timer has expired
    /// Otherwise returns false
    bool runIfUnsatisfied( void );

    /// Returns true when acoustic timer has expired
    bool isSatisfied( void );

    /// Uninit function
    void uninitialize( void );

    /// Mission Component factory interface
    static Behavior* CreateBehavior( const Str& prefix, const Module* module );

protected:

    // Indicates successful initialization
    bool initialized_;

    /// Writes the abort sample flag
    DataWriter* stopSamplingWriter_;

private:

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

#endif /* ABORTSAMPLE_H_ */
