#include "script_api.h"

#include "../common/python_utils.h"

#include <qapplication.h>

SimgridSimulationInterface* SimgridSimulationInterface::_instance = NULL;

SimgridSimulationInterface::SimgridSimulationInterface()
{
	_innerInstance = NULL;
}

SimgridSimulationInterface::~SimgridSimulationInterface()
{
}

SimgridSimulationInterface *SimgridSimulationInterface::instance()
{
	ENTER_FUNCTION(SimgridSimulationInterface::instance);

	if(_instance == NULL) {
		_instance = new SimgridSimulationInterface;
	}

	return _instance;
}

void SimgridSimulationInterface::setInnerInstance(SimgridSimulationInterface *inner)
{
	_innerInstance = inner;
}

void SimgridSimulationInterface::setComponentMessage(const char *comp, const char *message)
{
	ENTER_FUNCTION(SimgridSimulationInterface::setComponentMessage);

	Q_ASSERT(_innerInstance != NULL);
	_innerInstance->setComponentMessage(comp, message);
}

void SimgridSimulationInterface::setComponentRedLevel(const char *comp, int level)
{
	ENTER_FUNCTION(SimgridSimulationInterface::setComponentRedLevel);

	Q_ASSERT(_innerInstance != NULL);
	_innerInstance->setComponentRedLevel(comp, level);
}

void SimgridSimulationInterface::incComponentRedLevel(const char *comp)
{
	ENTER_FUNCTION(SimgridSimulationInterface::incComponentRedLevel);

	Q_ASSERT(_innerInstance != NULL);
	_innerInstance->incComponentRedLevel(comp);
}

void SimgridSimulationInterface::decComponentRedLevel(const char *comp)
{
	ENTER_FUNCTION(SimgridSimulationInterface::decComponentRedLevel);

	Q_ASSERT(_innerInstance != NULL);
	_innerInstance->decComponentRedLevel(comp);
}

void SimgridSimulationInterface::scriptStdoutMsg(const char *msg)
{
	ENTER_FUNCTION(SimgridSimulationInterface::scriptStdoutMsg);

	Q_ASSERT(_innerInstance != NULL);
	_innerInstance->scriptStdoutMsg(msg);
}

void SimgridSimulationInterface::scriptStderrMsg(const char *msg)
{
	ENTER_FUNCTION(SimgridSimulationInterface::scriptStderrMsg);

	Q_ASSERT(_innerInstance != NULL);
	_innerInstance->scriptStderrMsg(msg);
}

SimulationGraphic *SimgridSimulationInterface::createGraphic()
{
	Q_ASSERT(_innerInstance != NULL);
	return _innerInstance->createGraphic();
}

