Sha256: fb18eaaa83eaf73ce18fb56eaf4e35d7d647461b4c09932df659803588c12bf0

Contents?: true

Size: 1.65 KB

Versions: 30

Compression:

Stored size: 1.65 KB

Contents

#include "reflex/ruby/timer.h"


#include "reflex/exception.h"
#include "reflex/ruby/view.h"
#include "reflex/ruby/selector.h"
#include "defs.h"
#include "selector.h"


RUCY_DEFINE_WRAPPER_VALUE_FROM_TO(Reflex::Timer)

#define THIS      to<Reflex::Timer*>(self)

#define CHECK     RUCY_CHECK_OBJ(Reflex::Timer, self)

#define CALL(fun) RUCY_CALL_SUPER(THIS, fun)


static
RUCY_DEF_ALLOC(alloc, klass)
{
	Reflex::reflex_error(__FILE__, __LINE__, "can not instantiate Timer class.");
}
RUCY_END

static
RUCY_DEF0(stop)
{
	CHECK;
	THIS->stop();
}
RUCY_END

static
RUCY_DEF0(get_owner)
{
	CHECK;
	return value(THIS->owner());
}
RUCY_END

static
RUCY_DEF0(get_id)
{
	CHECK;
	return value(THIS->id());
}
RUCY_END

static
RUCY_DEF0(get_interval)
{
	CHECK;
	return value(THIS->interval());
}
RUCY_END

static
RUCY_DEF1(set_count, count)
{
	CHECK;
	THIS->set_count(to<int>(count));
	return count;
}
RUCY_END

static
RUCY_DEF0(get_count)
{
	CHECK;
	return value(THIS->count());
}
RUCY_END

static
RUCY_DEF0(is_finished)
{
	CHECK;
	return value(THIS->is_finished());
}
RUCY_END


static Class cTimer;

void
Init_reflex_timer ()
{
	Module mReflex = define_module("Reflex");

	cTimer = mReflex.define_class("Timer");
	cTimer.define_alloc_func(alloc);
	cTimer.define_method("stop", stop);
	cTimer.define_method("owner",     get_owner);
	cTimer.define_method("id",        get_id);
	cTimer.define_method("interval",  get_interval);
	cTimer.define_method("count=",    set_count);
	cTimer.define_method("count",     get_count);
	cTimer.define_method("finished?", is_finished);

	define_selector_methods<Reflex::Timer>(cTimer);
}


namespace Reflex
{


	Class
	timer_class ()
	{
		return cTimer;
	}


}// Reflex

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
reflexion-0.2.1 ext/reflex/timer.cpp
reflexion-0.2 ext/reflex/timer.cpp
reflexion-0.1.57 ext/reflex/timer.cpp
reflexion-0.1.56 ext/reflex/timer.cpp
reflexion-0.1.55 ext/reflex/timer.cpp
reflexion-0.1.54 ext/reflex/timer.cpp
reflexion-0.1.53 ext/reflex/timer.cpp
reflexion-0.1.52 ext/reflex/timer.cpp
reflexion-0.1.51 ext/reflex/timer.cpp
reflexion-0.1.50 ext/reflex/timer.cpp
reflexion-0.1.49 ext/reflex/timer.cpp
reflexion-0.1.48 ext/reflex/timer.cpp
reflexion-0.1.47 ext/reflex/timer.cpp
reflexion-0.1.46 ext/reflex/timer.cpp
reflexion-0.1.45 ext/reflex/timer.cpp
reflexion-0.1.44 ext/reflex/timer.cpp
reflexion-0.1.43 ext/reflex/timer.cpp
reflexion-0.1.42 ext/reflex/timer.cpp
reflexion-0.1.41 ext/reflex/timer.cpp
reflexion-0.1.40 ext/reflex/timer.cpp