Blame view

src/SpiceKernel/SpiceKernelStatus.cc 1.01 KB
cebd3f0e   Benjamin Renard   First implementat...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/**
 * 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 */