//
// LDASTools frameCPP - A library implementing the LIGO/Virgo frame
// specification
//
// Copyright (C) 2018 California Institute of Technology
//
// LDASTools frameCPP is free software; you may redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 (GPLv2) of the
// License or at your discretion, any later version.
//
// LDASTools frameCPP is distributed in the hope that it will be useful, but
// without any warranty or even the implied warranty of merchantability
// or fitness for a particular purpose. See the GNU General Public
// License (GPLv2) for more details.
//
// Neither the names of the California Institute of Technology (Caltech),
// The Massachusetts Institute of Technology (M.I.T), The Laser
// Interferometer Gravitational-Wave Observatory (LIGO), nor the names
// of its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// You should have received a copy of the licensing terms for this
// software included in the file LICENSE located in the top-level
// directory of this package. If you did not, you can view a copy at
// http://dcc.ligo.org/M1500244/LICENSE
//

#ifndef FrameCPP_UNIVERSAL_FrameH_HH
#define FrameCPP_UNIVERSAL_FrameH_HH

#if !defined( SWIGIMPORTED )
#include "framecpp/Universal/impl/FrameHClassicIO.hh"
#include "framecpp/Universal/impl/FrameHSerialIO.hh"
#endif /* !defined( SWIGIMPORTED ) */

#if defined( __cplusplus ) && !defined( SWIGIMPORTED )
namespace FrameCPP
{
    namespace Universal
    {
        //===================================================================
        /// \brief Event data
        //===================================================================
        class FrameH : public FrameHImpl::ClassicIO< FrameH >,
                       public FrameHImpl::SerialIO< FrameH >
        {
        public:
            //-----------------------------------------------------------------
            /// \brief Default constructor
            //-----------------------------------------------------------------
            FrameH( );

            //-----------------------------------------------------------------
            /// \brief Explicate construction
            ///
            /// \param[in] name
            ///     Name of project or other experiment description
            /// \param[in] run
            ///     Run number (number < 0 reserved for simulated data);
            ///     monotonic for experimental runs.
            /// \param[in] frame
            ///     Frame number, monotonically increasing until end of run,
            ///     re-starting from 0 with each new run.
            /// \param[in] time
            ///     Frame start time in GPS units.
            /// \param[in] dt
            ///     Frame length in seconds
            /// \param[in] dqual
            ///     Data quality flag
            ///
            /// \return
            ///     A new instance of this object.
            //-----------------------------------------------------------------
            FrameH( const name_type&  name,
                    run_type          run,
                    frame_type        frame,
                    const GTime_type& time,
                    const dt_type     dt,
                    dataQuality_type  dqual = 0 );

            //-----------------------------------------------------------------
            /// \brief Copy Constructor
            ///
            /// \param[in] frame
            ///     Frame to use as the base
            ///
            /// \return
            ///     A new instance of the object.
            //-----------------------------------------------------------------
            FrameH( const FrameH& frame );

            //-----------------------------------------------------------------
            /// \brief Virtual constructor
            //-----------------------------------------------------------------
            virtual inline FrameH*
            Clone( ) const
            {
                return new FrameH( *this );
            }

            //-----------------------------------------------------------------
            /// \brief equality operator
            ///
            /// \param[in] RHS
            ///     The FrameH object to be compared.
            ///
            /// \return
            ///     The value true is returned if this object is equivelent
            ///     to the RHS instance; false otherwise.
            //-----------------------------------------------------------------
            virtual bool
            operator==( const Common::FrameSpec::Object& Obj ) const;

            /// Typed equality declared as a hidden friend, not a member, so
            /// it does not pair with the virtual operator==(Object&) override
            /// above under C++20's reversed-candidate rule.
            friend bool
            operator==( const FrameH& LHS, const FrameH& RHS )
            {
                return ( LHS.FrameHImpl::Data::operator==( RHS ) );
            }

        protected:
        };

    } // namespace Universal
} // namespace FrameCPP

#endif /* defined( __cplusplus ) && !defined( SWIGIMPORTED ) */

#endif /* FrameCPP_UNIVERSAL_FrameH_HH */
