using System;

namespace Medivators.Common
{
	/// <summary>
	/// Class guarantees a value will be unique throughout
	/// the entire session
	/// </summary>
	public class Sequence
	{
		#region singleton constructor

		private static long _val = 0;
		private static Sequence _instance = null;
		private Sequence() { }
		public static Sequence GetInstance()
		{
			if (_instance == null)
				_instance = new Sequence();
			return _instance;
		}

		#endregion

		public long Value
		{
			get { return _val; }
		}
		public long NextValue
		{
			get { return ++_val; }
		}

		public void Reset()
		{
			_val = 0;
		}
		public void Reset(long ResetValue)
		{
			_val = ResetValue;
		}
	}
}
