AngleRange.h

#pragma once


#include "Angle.h"


namespace Robotics
{
    /// 角度範囲
    [ System::ComponentModel::TypeConverter( System::ComponentModel::ExpandableObjectConverter::typeid ) ]  // 拡張可能なオブジェクト
    public value class AngleRange
    {
    // Construction --------------------------------------------------------
    public:
        AngleRange( double minimum, double maximum );
        AngleRange( Angle minimum, Angle maximum );


    // Operation -----------------------------------------------------------
    public:
        bool IsWithinRange( Angle val );
        void ExpandRange( Angle value );

        virtual System::String^ ToString() override;


    // Overload ------------------------------------------------------------
    public:
        static bool operator==( AngleRange% left, AngleRange% right );
        static bool operator!=( AngleRange% left, AngleRange% right );


    // Attribute ===========================================================
    private:
        Angle m_maximum;    ///< 上限
        Angle m_minimum;    ///< 下限


    // Property ------------------------------------------------------------
    public:
        /// 上限
        property Angle Maximum
        {
            Angle get()
            {
                return m_maximum;
            }
            void set( Angle value )
            {
                m_maximum = value;
            }
        }

        /// 下限
        property Angle Minimum
        {
            Angle get()
            {
                return m_minimum;
            }
            void set( Angle value )
            {
                m_minimum = value;
            }
        }


        /// 範囲の大きさ
        [ System::ComponentModel::Browsable( false ) ]  // 参照不可
        property Angle Size
        {
            Angle get()
            {
                // 上限と下限の差の絶対値を返す
                return Angle( System::Math::Abs( m_maximum - m_minimum ) );
            }
        }
    };
}