/*
 * Copyright (C) 2008-2012 Delft University of Technology - All rights reserved.
 *
 * Author: Reijer Idema
 */

/**
 * @file Interface.h
 * Power system data interface abstract base class header.
 */
#ifndef PowerSystem_Interface_h
#define PowerSystem_Interface_h

#include <string>			// USES string
#include "../PowerSystem.def"

POWERSYSTEM_NAMESPACE_BEGIN

// Forward declarations
class PowerSystem;

/**
 * Power system data interface abstract base class.
 * Implements an abstract interface to power system data.
 */
class Interface
{
public:
	// TYPES
	typedef int ErrorType;		///< Type of interface errors.

	// LIFECYCLE
	Interface(void);
	virtual ~Interface(void);

	// ACCESS
	/**
	 * Opens a power system data source.
	 * @param rSourceName name of the data source.
	 * @return \c true on success, \c false on failure.
	 */
	virtual bool Open(const std::string& rSourceName) = 0;

	/**
	 * Closes the power system data source.
	 * Does nothing if no data source is open.
	 */
	virtual void Close(void) = 0;

	/**
	 * Read power system data from the data source.
	 * @return 0 on success, otherwise an error code.
	 */
	virtual bool Read(PowerSystem& rPowerSystem) = 0;
};

POWERSYSTEM_NAMESPACE_END

#endif // PowerSystem_Interface_h
