/***************************************************************************
 * Copyright (c)  2014  Zephyr Software LLC. All rights reserved.
 *
 * This software is furnished under a license and/or other restrictive
 * terms and may be used and copied only in accordance with such terms
 * and the inclusion of the above copyright notice. This software or
 * any other copies thereof may not be provided or otherwise made
 * available to any other person without the express written consent
 * of an authorized representative of Zephyr Software LCC. Title to,
 * ownership of, and all rights in the software is retained by
 * Zephyr Software LCC.
 *
 * Zephyr Software LLC. Proprietary Information
 *
 * Unless otherwise specified, the information contained in this
 * directory, following this legend, and/or referenced herein is
 * Zephyr Software LLC. (Zephyr) Proprietary Information. 
 *
 * CONTACT
 *
 * For technical assistance, contact Zephyr Software LCC. at:
 *      
 *
 * Zephyr Software, LLC
 * 2040 Tremont Rd
 * Charlottesville, VA 22911
 *
 * E-mail: jwd@zephyr-software.com
 **************************************************************************/

#ifndef zipr_sdk_range_h
#define zipr_sdk_range_h


namespace Zipr_SDK
{

typedef uintptr_t RangeAddress_t;


class Range_t
{
	public:
		Range_t(RangeAddress_t p_s, RangeAddress_t p_e) : m_start(p_s), m_end(p_e) { }
		Range_t() : m_start(0), m_end(0) { }

		virtual RangeAddress_t getStart() const { return m_start; }
		virtual RangeAddress_t getEnd() const { return m_end; }
		virtual void SetStart(RangeAddress_t s) { m_start=s; }
		virtual void SetEnd(RangeAddress_t e) { m_end=e; }

		virtual bool Is2ByteRange()
		{
			return (m_end - m_start) == 2;
		};
		virtual bool Is5ByteRange()
		{
			return (m_end - m_start) == 5;
		};

		virtual bool IsInfiniteRange()
		{
			return m_end==(RangeAddress_t)-1;
		};

	protected:

		RangeAddress_t m_start, m_end;
};

struct Range_tCompare
{
        bool operator() (const Range_t first, const Range_t second) const
        {
                return first.getEnd() < second.getStart();
        }
};

}
#endif