#ifndef __SCRIPT_API_H
#define __SCRIPT_API_H


#include <QList>

#include "simulation_graphic.h"

class SimgridSimulation;


/**
This class is an interface to use from scripts. The staff is done by another object that is set setInnerInstance.<br>
This class acts like a bridge from the script to C++ and all the functions that I want to export to be used from the script<br>
are put here and implemnted in _innerInstance.
*/
class SimgridSimulationInterface /*: public QObject*/ {
//	Q_OBJECT

	friend class SimgridSimulation;
public:
	static SimgridSimulationInterface *instance();

	~SimgridSimulationInterface();
	
	/**
	Set the message that appears at the top of the host.
	*/
	virtual void setComponentMessage(const char *host, const char *message);

	/**
	Param level (%): Determines that the component shows a level of red to show that the node is busy or other during a simulation.
	*/
	virtual void setComponentRedLevel(const char *comp, int level);

	/**
	Increment red level 5% of the given component.
	*/
	virtual void incComponentRedLevel(const char *comp);

	/**
	Decrement red level 5% of the given component.
	*/
	virtual void decComponentRedLevel(const char *comp);

	/**
	Print a message to stdout.
	*/
	virtual void scriptStdoutMsg(const char *msg);

	/**
	Print a message to stderr.
	*/
	virtual void scriptStderrMsg(const char *msg);

	/**
	Create a graphic to display results.<br>
	Return: the new created graphic.<br>
	Remarks: only 1 graphic is supported.
	*/
	virtual SimulationGraphic *createGraphic();

protected:
	SimgridSimulationInterface();

	void setInnerInstance(SimgridSimulationInterface *inner);

	//SimulationGraphicList graphics() { return _graphics; }

	//void clearGraphics();

private:
	static SimgridSimulationInterface *_instance;

	// this instance does the staff
	SimgridSimulationInterface *_innerInstance;
};

#endif // __SCRIPT_API_H