SpiceKernelStatus.cc 1.01 KB
/**
 * SpiceKernelStatus.cc
 *
 *  Created on: 18 jul. 2016
 *      Author: AKKA IS
 */

#include "SpiceKernelStatus.hh"
#include "SpiceKernelLogger.hh"

#include "SpiceUsr.h"

namespace AMDA {
namespace SpiceKernel {

bool SpiceKernelStatus::_initialized = false;

bool SpiceKernelStatus::CheckErrors(bool reset)
{
	if(!_initialized) {
		SpiceChar returnAct[32] = "RETURN";
		SpiceChar printAct[32] = "NONE";
		erract_c("SET", sizeof(returnAct), returnAct);   // Reset action to return
		errprt_c("SET", sizeof(printAct), printAct);     // ... and print nothing
		_initialized = true;
	}

	if(!failed_c())
		return false;

	const int SHORT_DESC_LEN = 26;
	SpiceChar naifShort[SHORT_DESC_LEN];
	getmsg_c("SHORT", SHORT_DESC_LEN, naifShort);
	const int LONG_DESC_LEN = 1841;
	SpiceChar naifLong[LONG_DESC_LEN];
	getmsg_c("LONG", LONG_DESC_LEN, naifLong);

	if(reset) {
		reset_c();
	}

	LOG4CXX_ERROR(gLogger, "SpiceKernelStatus::CheckErrors - " << naifShort << " - " << naifLong);

	return true;
}


} /* AMDA */
} /* SpiceKernel */