Sirikata
liboh/plugins/js/JSObjects/JSTimer.hpp
Go to the documentation of this file.
00001 #ifndef __SIRIKATA_JS_TIMER_HPP__
00002 #define __SIRIKATA_JS_TIMER_HPP__
00003 
00004 
00005 #include <v8.h>
00006 
00007 namespace Sirikata {
00008 namespace JS {
00009 namespace JSTimer{
00010 
00011 v8::Handle<v8::Value> resetTimer(const v8::Arguments& args);
00012 v8::Handle<v8::Value> clear(const v8::Arguments& args);
00013 v8::Handle<v8::Value> suspend(const v8::Arguments& args);
00014 v8::Handle<v8::Value> resume(const v8::Arguments& args);
00015 v8::Handle<v8::Value> isSuspended(const v8::Arguments& args);
00016 v8::Handle<v8::Value> getAllData(const v8::Arguments& args);
00017 v8::Handle<v8::Value> getType(const v8::Arguments& args);
00018 
00019 void setNullTimer(const v8::Arguments& args);
00020 
00021 
00022 
00023 #define INLINE_DECODE_TIMER_ERROR(toConvert,whereError,whereWriteTo)            \
00024     JSTimerStruct* whereWriteTo = NULL;                                         \
00025     {                                                                           \
00026         String _errMsg = "In " #whereError " of timer.  Cannot complete because likely already cleared this timer."; \
00027         whereWriteTo = JSTimerStruct::decodeTimerStruct(toConvert,_errMsg);   \
00028         if (whereWriteTo == NULL)                                               \
00029         {              \
00030             return v8::ThrowException(v8::Exception::Error(v8::String::New(_errMsg.c_str(), _errMsg.length()))); \
00031         } \
00032     }
00033 
00034 
00035 
00036 } //jstimer
00037 } //js
00038 } //sirikata
00039 
00040 #endif