#ifndef __NODE_OPENCV_H__ #define __NODE_OPENCV_H__ #include #include #include #include #include #include #include #include using namespace v8; using namespace node; #define REQ_FUN_ARG(I, VAR) \ if (args.Length() <= (I) || !args[I]->IsFunction()) \ return v8::ThrowException(v8::Exception::TypeError( \ String::New("Argument " #I " must be a function"))); \ Local VAR = Local::Cast(args[I]); #define SETUP_FUNCTION(TYP) \ HandleScope scope; \ TYP *self = ObjectWrap::Unwrap(args.This()); #define JSFUNC(NAME) \ static Handle NAME(const Arguments& args); #define JSTHROW_TYPE(ERR) \ return v8::ThrowException(v8::Exception::TypeError(v8::String::New(ERR))); #define JSTHROW(ERR) \ return v8::ThrowException(v8::Exception::Error(v8::String::New(ERR))); #define INT_FROM_ARGS(NAME, IND) \ if (args[IND]->IsInt32()){ \ NAME = args[IND]->Uint32Value(); \ } #define DOUBLE_FROM_ARGS(NAME, IND) \ if (args[IND]->IsInt32()){ \ NAME = args[IND]->NumberValue(); \ } class OpenCV: public node::ObjectWrap{ public: static void Init(Handle target); static Handle ReadImage(const v8::Arguments&); }; #endif