#include "measure.hpp"

#include <cstddef>

#ifdef MEASURE
extern "C" {
	void *measure_init(const char *name);
	void measure_clean(void *measure);
	void measure_start(void *measure);
	void measure_pause(void *measure);
	void measure_stop(void *measure);
}
#endif

measure::measure(const std::string &name)
{
#ifdef MEASURE
	measure_ptr = measure_init(name.c_str());
#endif
}

measure::~measure()
{
#ifdef MEASURE
    measure_clean(measure_ptr);
	measure_ptr = NULL;
#endif

}

void measure::start()
{
#ifdef MEASURE
	measure_start(measure_ptr);
#endif
}

void measure::pause()
{
#ifdef MEASURE
	measure_pause(measure_ptr);
#endif
}

void measure::stop()
{
#ifdef MEASURE
	measure_stop(measure_ptr);
#endif
}