//
// LDASTools frameCPP - A library implementing the LIGO/Virgo frame
// specification
//
// Copyright (C) 2019 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__IMPL__FrSHData_HH
#define FrameCPP_UNIVERSAL__IMPL__FrSHData_HH

#include "framecpp/Universal/impl/FrObjectMetaData.hh"

namespace FrameCPP
{
    namespace Universal
    {
        namespace FrSHImpl
        {
            //-----------------------------------------------------------
            /// @brief Storage space for FrSH information
            ///
            /// This stores information about an FrSH element that
            /// needs to persist beyond an I/O operation
            //-----------------------------------------------------------
            class Data : public Impl::FrObjectMetaData< Data >
            {
            public:
                struct v3
                {
                    /// Name of structure being described by this dictionary
                    /// structure
                    typedef std::string name_type;
                    /// Comment
                    typedef std::string comment_type;
                    /// Class number of structure being described
                    typedef INT_2U class_type;
                };

                using v4 = v3;
                using v5 = v4;
                using v6 = v5;
                using v7 = v6;
                using v8 = v7;
                using v9 = v8;

                //-------------------------------------------------------

                using current_version = v9;

                using name_type = typename current_version::name_type;
                using comment_type = typename current_version::comment_type;
                using class_type = typename current_version::class_type;

                //-----------------------------------------------------------------
                /// \brief Return class of object
                ///
                /// \return
                ///    Class number of structure being described
                //-----------------------------------------------------------------
                class_type GetClass( ) const
                {
                    return ( klass );
                }

                //-----------------------------------------------------------------
                /// \brief Return comment of object
                ///
                /// \return
                ///   Comment
                //-----------------------------------------------------------------
                const comment_type&
                GetComment( ) const
                {
                    return ( comment );
                }

                //-----------------------------------------------------------------
                /// \brief Return name of object
                ///
                /// \return
                ///   Name of structure being described by this dictionary
                ///   structure
                //-----------------------------------------------------------------
                const name_type&
                GetName( ) const
                {
                    return ( name );
                }

                //-----------------------------------------------------------------
                /// \brief Field-by-field equality on the FrSH data slice.
                //-----------------------------------------------------------------
                bool
                operator==( const Data& RHS ) const
                {
                    return ( ( name == RHS.name ) &&
                             ( klass == RHS.klass ) &&
                             ( comment == RHS.comment ) );
                }

            protected:
                name_type name; /**< Name of structure being described by this
                                   dictionary structure */
                comment_type comment; /**< Comment */
                class_type
                    klass; /**< Class number of structure being described */
            };
        }; // namespace FrSHImpl

    } // namespace Universal

} // namespace FrameCPP

FR_OBJECT_META_DATA_DECLARE_UNIVERSAL( FrSHImpl )

#endif /* FrameCPP_UNIVERSAL__IMPL__FrSHData_HH */
