//
//  offset.h - tool offset class header file
//
//  $Id: offset.h 53 2014-02-07 19:39:59Z brian $ 
//
//  Copyright (c) 1999-2014 by Precision Micro Control Corp. All rights reserved.
//
#ifndef OFFSET_H
#define OFFSET_H

/// <summary>
/// Offset table
/// </summary>
class OffsetTable : CObject
{
public:
	/// <summary>Constructor.</summary>
	OffsetTable(char new_id = 0) { Init(new_id); }
	/// <summary>Destructor.</summary>
	~OffsetTable(void) {}

	/// <summary>Assignment operator.</summary>
	OffsetTable& operator=(const OffsetTable& rhs);

	/// <summary>Generate configuration text for offsets and place in file.</summary>
	/// <param name="cfg_file">Stream to use.</param>
	void						Configure(std::fstream& cfg_file);
	/// <summary>Convert the current offset ID ('A' to 'Z') to a zero based index.</summary>
	/// <returns>Index.</returns>
	int							GetIndex() { return m_offset_id - 'A'; }
	/// <summary>Initialize an offset.</summary>
	/// <param name="new_id">Offset ID.</param>
	void						Init(char new_id);
	/// <summary>Initialize the object.</summary>
	void						Initialize(void);
	/// <summary>Save the offset table settings to the machine file.</summary>
	/// <param name="ini_file">Machine file name and path.</param>
	void						SaveData(const char* ini_file);
	/// <summary>Restore the offset table settings from the machine file.</summary>
	/// <param name="ini_file">Machine file name and path.</param>
	void						RestoreData(const char* ini_file);

public:
	// NOTE: It appears that these could be private if setup_offsets_dlg.cpp was made a friend of this class
	CDimension					Geometry[OFFSET_SIZE];			///< Geometry offset data
	CDimension					Wear[OFFSET_SIZE];				///< Wear offset data
	CAppDouble					WearFactor[OFFSET_SIZE];		///< Wear factor data

private:
	char						m_offset_id;					///< Offset Table ID is a character 'A' - 'Z'
};

#endif			// OFFSET_H
