//
// 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_PTR_STRUCT_HH
#define FrameCPP__UNIVERSAL_PTR_STRUCT_HH

#ifndef SWIGIMPORTED
#include <vector>

#include <boost/serialization/access.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/version.hpp>
#endif /* SWIGIMPORTED */

#include "ldastoolsal/types.hh"

#include "framecpp/Universal/impl/PTR_STRUCTData.hh"
#include "framecpp/Universal/impl/PTR_STRUCTClassicIO.hh"
#include "framecpp/Universal/impl/PTR_STRUCTSerialIO.hh"

namespace FrameCPP
{
    namespace Universal
    {
        //===================================================================
        /// \brief Message Log Data Structure Definition
        //===================================================================
        class PTR_STRUCT : public PTR_STRUCTImpl::ClassicIO< PTR_STRUCT >,
                           public PTR_STRUCTImpl::SerialIO< PTR_STRUCT >
        {
        public:
            //-----------------------------------------------------------------
            /// \brief Default constructor
            ///
            /// \return
            ///    A new instance of this object.
            //-----------------------------------------------------------------
            PTR_STRUCT( );

            //-----------------------------------------------------------------
            /// \brief Copy Constructor
            ///
            /// \param[in] Source
            ///     The object from which to copy the information.
            ///
            /// \return
            ///    A new instance of this object.
            //-----------------------------------------------------------------
            PTR_STRUCT( const PTR_STRUCT& Source );

            //-----------------------------------------------------------------
            /// \brief Copy Constructor
            ///
            /// \param[in] Alarm
            ///     Name of message, error flag or alarm state.
            /// \param[in] Message
            ///     Message body
            /// \param[in] Severity
            ///     Message severity level.
            /// \param[in] GTime
            ///     GPS time corresponding to this PTR_STRUCT.
            ///
            /// \return
            ///    A new instance of this object.
            //-----------------------------------------------------------------
            PTR_STRUCT( Data::class_type    ClassId,
                        Data::instance_type Instance );

#if 0
            //-----------------------------------------------------------------
            /// \brief Constructor
            ///
            /// \param[in] Stream
            ///     The stream from which the earliest version of the
            ///     FrAdcData structure was read.
            ///
            /// \return
            ///     A new instance of an FrAdcData object
            //-----------------------------------------------------------------
            PTR_STRUCT( istream_type& Stream );
#endif /* 0 */
#if 0
            //-----------------------------------------------------------------
            /// \brief Promotion Constructor
            ///
            /// \param[in] Stream
            ///     The stream from which the earliest version of the
            ///     FrAdcData structure was read.
            ///
            /// \return
            ///     A new instance of an FrAdcData object
            //-----------------------------------------------------------------
            PTR_STRUCT( Previous::PTR_STRUCT& Source, istream_type* Stream );
#endif /* 0 */

            virtual ~PTR_STRUCT( );

            //-----------------------------------------------------------------
            /// \brief Merge with another PTR_STRUCT
            ///
            /// \param[in] RHS
            ///     The source of the information to append to this PTR_STRUCT
            ///     structure.
            ///
            /// \return
            ///     A reference to this object
            //-----------------------------------------------------------------
            PTR_STRUCT& Merge( const PTR_STRUCT& RHS );

#if !defined( SWIG )
            //-----------------------------------------------------------------
            /// Typed equality declared as a hidden friend, not a member on
            /// ClassicIO<PTR_STRUCT>, so it does not pair with the virtual
            /// operator==(Object&) override on the mixin under C++20's
            /// reversed-candidate rule.
            //-----------------------------------------------------------------
            friend bool
            operator==( const PTR_STRUCT& LHS, const PTR_STRUCT& RHS )
            {
                return ( LHS.PTR_STRUCTImpl::Data::operator==( RHS ) );
            }
#endif /* ! defined(SWIG) */
        };

    } // namespace Universal
} // namespace FrameCPP

#endif /* FrameCPP__UNIVERSAL_PTR_STRUCT_HH */
