void define_ruby_class() { if(rb_klass) return; /* * opencv = rb_define_module("OpenCV"); * cvpoint2d32f = rb_define_class_under(opencv, "CvPoint2D32f", rb_cObject); * * note: this comment is used by rdoc. */ VALUE opencv = rb_module_opencv(); VALUE cvpoint2d32f = cCvPoint2D32f::rb_class(); rb_klass = rb_define_class_under(opencv, "CvPoint3D32f", cvpoint2d32f); rb_define_alloc_func(rb_klass, rb_allocate); rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1); rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1); rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0); rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1); rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0); rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1); rb_define_method(rb_klass, "z", RUBY_METHOD_FUNC(rb_z), 0); rb_define_method(rb_klass, "z=", RUBY_METHOD_FUNC(rb_set_z), 1); rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0); rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0); }
void Init_blake2_ext() { cBlake2 = rb_define_class("Blake2", rb_cObject); rb_define_alloc_func(cBlake2, blake2_alloc); rb_define_private_method(cBlake2, "initialize", RUBY_METHOD_FUNC(m_blake2_initialize), 2); rb_define_method(cBlake2, "digest", RUBY_METHOD_FUNC(m_blake2_digest), 2); }
void define_ruby_class() { if (rb_klass) return; /* * opencv = rb_define_module("OpenCV"); * * note: this comment is used by rdoc. */ VALUE opencv = rb_module_opencv(); rb_klass = rb_define_class_under(opencv, "CvHuMoments", rb_cObject); rb_define_alloc_func(rb_klass, rb_allocate); rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), 1); rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0); rb_define_alias(rb_klass, "to_a", "to_ary"); DEFINE_CVHUMOMENTS_GETTER(hu1); DEFINE_CVHUMOMENTS_GETTER(hu2); DEFINE_CVHUMOMENTS_GETTER(hu3); DEFINE_CVHUMOMENTS_GETTER(hu4); DEFINE_CVHUMOMENTS_GETTER(hu5); DEFINE_CVHUMOMENTS_GETTER(hu6); DEFINE_CVHUMOMENTS_GETTER(hu7); }
void wdm_rb_monitor_init() { WDM_DEBUG("Registering WDM::Monitor with Ruby!"); wdm_rb_sym_call = rb_intern("call"); wdm_rb_sym_files = rb_intern("files"); wdm_rb_sym_directories = rb_intern("directories"); wdm_rb_sym_attributes = rb_intern("attributes"); wdm_rb_sym_size = rb_intern("size"); wdm_rb_sym_last_write = rb_intern("last_write"); wdm_rb_sym_last_access = rb_intern("last_access"); wdm_rb_sym_creation = rb_intern("creation"); wdm_rb_sym_security = rb_intern("security"); wdm_rb_sym_default = rb_intern("default"); eWDM_MonitorRunningError = rb_define_class_under(mWDM, "MonitorRunningError", eWDM_Error); eWDM_InvalidDirectoryError = rb_define_class_under(mWDM, "InvalidDirectoryError", eWDM_Error); eWDM_UnknownFlagError = rb_define_class_under(mWDM, "UnknownFlagError", eWDM_Error); eWDM_UnwatchableDirectoryError = rb_define_class_under(mWDM, "UnwatchableDirectoryError", eWDM_Error); cWDM_Monitor = rb_define_class_under(mWDM, "Monitor", rb_cObject); rb_define_alloc_func(cWDM_Monitor, rb_monitor_alloc); rb_define_method(cWDM_Monitor, "watch", RUBY_METHOD_FUNC(rb_monitor_watch), -1); rb_define_method(cWDM_Monitor, "watch_recursively", RUBY_METHOD_FUNC(rb_monitor_watch_recursively), -1); rb_define_method(cWDM_Monitor, "run!", RUBY_METHOD_FUNC(rb_monitor_run_bang), 0); rb_define_method(cWDM_Monitor, "stop", RUBY_METHOD_FUNC(rb_monitor_stop), 0); }
/** * require時に呼び出し */ extern "C" void Init_hello() { VALUE c = rb_define_class("Hello", rb_cObject); rb_define_alloc_func(c, wrap_Hello_alloc); rb_define_private_method(c, "initialize", RUBY_METHOD_FUNC(wrap_Hello_init), 0); rb_define_method(c, "say_hello", RUBY_METHOD_FUNC(wrap_Hello_sayHello), 0); }
// init void init_IdMapDb() { cIdMapDb = rb_define_class_under(GettextpoHelper, "IdMapDb", rb_cObject); rb_define_singleton_method(cIdMapDb, "new", RUBY_METHOD_FUNC(cIdMapDb_new), 1); rb_define_method(cIdMapDb, "create", RUBY_METHOD_FUNC(cIdMapDb_create), 1); rb_define_method(cIdMapDb, "normalize_database", RUBY_METHOD_FUNC(cIdMapDb_normalize_database), 0); rb_define_method(cIdMapDb, "get_min_id", RUBY_METHOD_FUNC(cIdMapDb_get_min_id), 1); rb_define_method(cIdMapDb, "get_min_id_array", RUBY_METHOD_FUNC(cIdMapDb_get_min_id_array), 2); }
WindowBindings::WindowBindings() : RubyBindings<Window, false>( rb_define_class("MHWindow", rb_cObject), "WindowBindings") { rb_define_method(_class, "ratio", RUBY_METHOD_FUNC(WindowBindings::Ratio), 0); rb_define_method(_class, "width", RUBY_METHOD_FUNC(WindowBindings::Width), 0); rb_define_method(_class, "height", RUBY_METHOD_FUNC(WindowBindings::Height), 0); }
void Initialize() { rb_mStorage = rb_define_module_under(rb_mJubatus, "Storage"); rb_cBasicStorage = rb_define_class_under(rb_mStorage, "BasicStorage", rb_cObject); rb_define_alloc_func(rb_cBasicStorage, storage_alloc); rb_define_method(rb_cBasicStorage, "initialize", RUBY_METHOD_FUNC(storage_init), 0); rb_define_method(rb_cBasicStorage, "type", RUBY_METHOD_FUNC(storage_type), 0); }
void Init_sort() { VALUE c = rb_define_class("Sort", rb_cObject); rb_define_alloc_func(c, wrap_Sort_alloc); rb_define_private_method(c, "initialize", RUBY_METHOD_FUNC(wrap_Sort_init), 1); rb_define_method(c, "inspect", RUBY_METHOD_FUNC(wrap_Sort_toString), 0); rb_define_method(c, "to_s", RUBY_METHOD_FUNC(wrap_Sort_toString), 0); rb_define_method(c, "greet", RUBY_METHOD_FUNC(wrap_Sort_greet), 0); rb_define_method(c, "values", RUBY_METHOD_FUNC(wrap_Sort_getValues), 0); }
void define_ruby_class() { if (rb_klass) return; /* * opencv = rb_define_module("OpenCV"); * cvmat = rb_define_class_under(opencv, "CvMat", rb_cObject); * * note: this comment is used by rdoc. */ VALUE opencv = rb_module_opencv(); VALUE cvmat = cCvMat::rb_class(); rb_klass = rb_define_class_under(opencv, "IplImage", cvmat); rb_define_alloc_func(rb_klass, rb_allocate); rb_define_singleton_method(rb_klass, "load", RUBY_METHOD_FUNC(rb_load_image), -1); rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1); rb_define_method(rb_klass, "get_roi", RUBY_METHOD_FUNC(rb_get_roi), 0); rb_define_alias(rb_klass, "roi", "get_roi"); rb_define_method(rb_klass, "set_roi", RUBY_METHOD_FUNC(rb_set_roi), 1); rb_define_alias(rb_klass, "roi=", "set_roi"); rb_define_method(rb_klass, "reset_roi", RUBY_METHOD_FUNC(rb_reset_roi), 0); rb_define_method(rb_klass, "get_coi", RUBY_METHOD_FUNC(rb_get_coi), 0); rb_define_alias(rb_klass, "coi", "get_coi"); rb_define_method(rb_klass, "set_coi", RUBY_METHOD_FUNC(rb_set_coi), 1); rb_define_alias(rb_klass, "coi=", "set_coi"); rb_define_method(rb_klass, "reset_coi", RUBY_METHOD_FUNC(rb_reset_coi), 0); rb_define_method(rb_klass, "smoothness", RUBY_METHOD_FUNC(rb_smoothness), -1); }
void Init_sash() { VALUE mSash = rb_define_module("Sash"); rb_define_singleton_method(mSash, "digest", RUBY_METHOD_FUNC(rb_digest), -1); rb_define_singleton_method(mSash, "base64", RUBY_METHOD_FUNC(rb_base64), -1); rb_define_const(mSash, "METHOD_SDBM", INT2FIX(0)); rb_define_const(mSash, "METHOD_DJB2", INT2FIX(1)); sMethod = ID2SYM(rb_intern("method")); rb_gc_mark(sMethod); }
// The initialization method for this module void Init_ruby_bluetooth() { bt_module = rb_define_module("Bluetooth"); bt_device_class = rb_define_class_under(bt_module, "Device", rb_cObject); bt_devices_class = rb_define_class_under(bt_module, "Devices", rb_cObject); rb_define_singleton_method(bt_devices_class, "scan", RUBY_METHOD_FUNC(bt_devices_scan), 0); rb_define_method(bt_device_class, "initialize", RUBY_METHOD_FUNC(bt_device_new), 2); rb_define_attr(bt_device_class, "addr", Qtrue, Qfalse); rb_define_attr(bt_device_class, "name", Qtrue, Qfalse); rb_undef_method(bt_devices_class, "initialize"); }
/* * call-seq: * == image -> bool * * compares two image. * * */ DLL_LOCAL VALUE _equal(VALUE self, VALUE other) { equal_obj obj; obj.self = _self; obj.other = other; return rb_rescue( RUBY_METHOD_FUNC(_equal_block),(VALUE)&obj, RUBY_METHOD_FUNC(_equal_rescue),Qnil ); }
void Init_client () { mysql_module = rb_define_module("MySQL"); binlog_class = rb_define_class_under(mysql_module, "Binlog", rb_cObject); client_class = rb_define_class_under(binlog_class, "Client", rb_cObject); rb_define_private_method (client_class, "initialize", RUBY_METHOD_FUNC(mysql_binlog_client_initialize), 1); rb_define_method(client_class, "connect", RUBY_METHOD_FUNC(mysql_binlog_client_connect), 0); rb_define_method(client_class, "set_position", RUBY_METHOD_FUNC(mysql_binlog_client_set_position), 1); rb_define_method(client_class, "get_position", RUBY_METHOD_FUNC(mysql_binlog_client_get_position), 0); rb_define_method(client_class, "wait_for_next_event", RUBY_METHOD_FUNC(mysql_binlog_client_wait_for_next_event), 0); }
extern "C" void Init_bayeux_sioux() { const VALUE mod_sioux = rb_define_module_under( rb_define_module( "Rack" ), "Sioux" ); VALUE class_ = rb_define_class_under( mod_sioux, "SiouxBayeuxImplementation", rb_cObject ); rb_define_alloc_func( class_, alloc_bayeux ); rb_define_method( class_, "run", RUBY_METHOD_FUNC( run_bayeux ), 2 ); rb_define_method( class_, "[]=", RUBY_METHOD_FUNC( update_node_bayeux ), 2 ); rb_define_method( class_, "subscribe_for_testing", RUBY_METHOD_FUNC( subscribe_bayeux ), 1 ); Init_pubsub_sioux(); }
void Init_OgreMovableObjectListener(VALUE rb_mOgre) { #if 0 rb_mOgre = rb_define_module("Ogre"); rb_mOgreMovableObject = rb_define_module_under(rb_mOgre,"MovableObject"); #endif rb_mOgreMovableObjectListener = rb_define_module_under(rb_mOgreMovableObject,"Listener"); rb_define_method(rb_mOgreMovableObjectListener,"object_destroyed",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y rb_define_method(rb_mOgreMovableObjectListener,"object_attached",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y rb_define_method(rb_mOgreMovableObjectListener,"object_detached",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y rb_define_method(rb_mOgreMovableObjectListener,"object_moved",RUBY_METHOD_FUNC(Ogre_dummy1),1);// in ogre.y }
void rb_define_fs_node(){ rb_cNode = rb_define_class("FSNode", rb_cObject); rb_define_alloc_func(rb_cNode, wrap_Node_allocate); rb_define_attr(rb_cNode, "server", 1, 1); rb_define_method(rb_cNode, "initialize", RUBY_METHOD_FUNC(rb_Node_initialize), -1); rb_define_method(rb_cNode, "send_pack", RUBY_METHOD_FUNC(rb_Node_send_pack), 1); rb_define_method(rb_cNode, "close", RUBY_METHOD_FUNC(rb_Node_close), 0); rb_define_method(rb_cNode, "active", RUBY_METHOD_FUNC(rb_Node_active), 0); rb_define_method(rb_cNode, "id", RUBY_METHOD_FUNC(rb_Node_id), 0); }
VALUE RubyUtils::KListToRubyValue(SharedValue obj) { // Lazily initialize the KMethod wrapper class if (KListClass == Qnil) { KListClass = rb_define_class("RubyKList", rb_cObject); rb_define_method(KListClass, "method_missing", RUBY_METHOD_FUNC(RubyKObjectMethodMissing), -1); rb_define_method(KListClass, "method", RUBY_METHOD_FUNC(RubyKObjectMethod), -1); rb_define_method(KListClass, "methods", RUBY_METHOD_FUNC(RubyKObjectMethods), 0); rb_define_method(KListClass, "respond_to?", RUBY_METHOD_FUNC(RubyKObjectRespondTo), -1); rb_define_method(KListClass, "[]", RUBY_METHOD_FUNC(RubyKListGetElt), -1); rb_define_method(KListClass, "[]=", RUBY_METHOD_FUNC(RubyKListSetElt), -1); rb_define_method(KListClass, "length", RUBY_METHOD_FUNC(RubyKListLength), -1); rb_define_method(KListClass, "each", RUBY_METHOD_FUNC(RubyKListEach), 0); } VALUE wrapper = Data_Wrap_Struct(KListClass, 0, RubyKObjectFree, new SharedValue(obj)); rb_obj_call_init(wrapper, 0, 0); return wrapper; }
void init_ruby_class() { #if 0 // For documentation using YARD VALUE opencv = rb_define_module("OpenCV"); #endif if (rb_klass) return; /* * opencv = rb_define_module("OpenCV"); * * note: this comment is used by rdoc. */ VALUE opencv = rb_module_opencv(); rb_klass = rb_define_class_under(opencv, "CvPoint", rb_cObject); rb_define_alloc_func(rb_klass, rb_allocate); rb_define_singleton_method(rb_klass, "compatible?", RUBY_METHOD_FUNC(rb_compatible_q), 1); rb_define_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1); rb_define_method(rb_klass, "x", RUBY_METHOD_FUNC(rb_x), 0); rb_define_method(rb_klass, "x=", RUBY_METHOD_FUNC(rb_set_x), 1); rb_define_method(rb_klass, "y", RUBY_METHOD_FUNC(rb_y), 0); rb_define_method(rb_klass, "y=", RUBY_METHOD_FUNC(rb_set_y), 1); rb_define_method(rb_klass, "to_s", RUBY_METHOD_FUNC(rb_to_s), 0); rb_define_method(rb_klass, "to_ary", RUBY_METHOD_FUNC(rb_to_ary), 0); rb_define_alias(rb_klass, "to_a", "to_ary"); }
void Init_CeguiDefaultResourceProvider(VALUE rb_mCegui) { #if 0 rb_mCegui = rb_define_module("CEGUI"); rb_cCeguiResourceProvider = rb_define_class_under(rb_mCegui,"ResourceProvider",rb_cObject); #endif rb_cCeguiDefaultResourceProvider = rb_define_class_under(rb_mCegui,"DefaultResourceProvider",rb_cCeguiResourceProvider); rb_define_alloc_func(rb_cCeguiDefaultResourceProvider,CeguiDefaultResourceProvider_alloc); rb_define_method(rb_cCeguiDefaultResourceProvider,"[]",RUBY_METHOD_FUNC(CeguiDefaultResourceProvider_get),1); rb_define_method(rb_cCeguiDefaultResourceProvider,"[]=",RUBY_METHOD_FUNC(CeguiDefaultResourceProvider_set),2); }
void Init_fuzzy_string() { mFuzzy = rb_define_module("FuzzyString"); fuzzy_default_language = rb_str_new2("en"); rb_global_variable(&fuzzy_default_language); rb_define_module_function(mFuzzy, "jaro_winkler_distance", RUBY_METHOD_FUNC(fuzzy_jaro_winkler_distance), 2); rb_define_module_function(mFuzzy, "levenstein_distance", RUBY_METHOD_FUNC(fuzzy_levenstein_distance), 2); rb_define_module_function(mFuzzy, "stem", RUBY_METHOD_FUNC(fuzzy_snowball), -1); rb_define_module_function(mFuzzy, "stem_languages", RUBY_METHOD_FUNC(fuzzy_snowball_languages), 0); rb_define_module_function(mFuzzy, "soundex", RUBY_METHOD_FUNC(fuzzy_soundex), 1); rb_define_const(mFuzzy, "VERSION", rb_str_new2(RUBY_FUZZY_VERSION)); }
void Init_melbourne(void) { VALUE rb_cMelbourne; melbourne::init_symbols(); #ifndef RUBINIUS VALUE rb_mRubinius = rb_const_get(rb_cObject, rb_intern("Rubinius")); #endif rb_cMelbourne = rb_define_class_under(rb_mRubinius, "Melbourne", rb_cObject); rb_define_method(rb_cMelbourne, "string_to_ast", RUBY_METHOD_FUNC(melbourne_string_to_ast), 3); rb_define_method(rb_cMelbourne, "file_to_ast", RUBY_METHOD_FUNC(melbourne_file_to_ast), 2); }
static VALUE rb_keychain_add_password(VALUE self, VALUE kind, VALUE options){ SecKeychainRef keychain=NULL; Data_Get_Struct(self, struct OpaqueSecKeychainRef, keychain); Check_Type(options, T_HASH); Check_Type(kind, T_STRING); CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); rb_add_value_to_cf_dictionary(attributes, kSecClass, kind); CFDictionarySetValue(attributes, kSecReturnAttributes, kCFBooleanTrue); CFDictionarySetValue(attributes, kSecReturnRef, kCFBooleanTrue); CFDictionarySetValue(attributes, kSecUseKeychain, keychain); VALUE rAttributes = Data_Wrap_Struct(rb_cPointerWrapper, NULL, NULL, attributes); rb_block_call(options, rb_intern("each"), 0, NULL, RUBY_METHOD_FUNC(add_conditions_to_query), (VALUE)rAttributes); CFDictionaryRef result; OSStatus status = SecItemAdd(attributes, (CFTypeRef*)&result); CFRelease(attributes); CheckOSStatusOrRaise(status); VALUE rb_keychain_item = rb_keychain_item_from_sec_dictionary(result); CFRelease(result); return rb_keychain_item; }
void register_math(VALUE rb_mlemon) { rb_define_const(rb_mlemon, "E", DBL2NUM(lemon::E)); rb_define_const(rb_mlemon, "LOG2E", DBL2NUM(lemon::LOG2E)); rb_define_const(rb_mlemon, "LOG10E", DBL2NUM(lemon::LOG10E)); rb_define_const(rb_mlemon, "LN2", DBL2NUM(lemon::LN2)); rb_define_const(rb_mlemon, "LN10", DBL2NUM(lemon::LN10)); rb_define_const(rb_mlemon, "PI", DBL2NUM(lemon::PI)); rb_define_const(rb_mlemon, "PI_2", DBL2NUM(lemon::PI_2)); rb_define_const(rb_mlemon, "PI_4", DBL2NUM(lemon::PI_4)); rb_define_const(rb_mlemon, "SQRT2", DBL2NUM(lemon::SQRT2)); rb_define_const(rb_mlemon, "SQRT1_2", DBL2NUM(lemon::SQRT1_2)); rb_define_module_function(rb_mlemon, "round", RUBY_METHOD_FUNC(wrap_round), 1); rb_define_module_function(rb_mlemon, "is_nan", RUBY_METHOD_FUNC(wrap_isNan), 1); }
void define_ruby_class() { if (rb_klass) return; /* * opencv = rb_define_module("OpenCV"); * * note: this comment is used by rdoc. */ VALUE opencv = rb_module_opencv(); rb_klass = rb_define_class_under(opencv, "CvHaarClassifierCascade", rb_cObject); rb_define_alloc_func(rb_klass, rb_allocate); rb_define_singleton_method(rb_klass, "load", RUBY_METHOD_FUNC(rb_load), 1); rb_define_method(rb_klass, "detect_objects", RUBY_METHOD_FUNC(rb_detect_objects), -1); }
RenderableBindings::RenderableBindings() : RubyBindings<Renderable, true>( rb_define_class("Renderable", rb_cObject), "RenderableBindings") { rb_define_method(_class, "set_translation_matrix", RUBY_METHOD_FUNC(RenderableBindings::SetTranslationMatrix), 3); }
static VALUE rb_keychain_item_save(VALUE self){ SecKeychainItemRef keychainItem = NULL; Data_Get_Struct(self, struct OpaqueSecKeychainItemRef, keychainItem); CFMutableDictionaryRef query = sec_query_identifying_item(keychainItem); CFMutableDictionaryRef attributes = CFDictionaryCreateMutable(NULL, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); VALUE rb_attributes = rb_ivar_get(self, rb_intern("@attributes")); VALUE attributes_wrapper = Data_Wrap_Struct(rb_cPointerWrapper, NULL, NULL, attributes); rb_block_call(rb_attributes, rb_intern("each"), 0, NULL, RUBY_METHOD_FUNC(copy_attributes_for_update), (VALUE)attributes_wrapper); VALUE newPassword = rb_ivar_get(self, rb_intern("@unsaved_password")); if(!NIL_P(newPassword)){ rb_add_value_to_cf_dictionary(attributes, kSecValueData, newPassword); } CFStringRef cfclass = rb_copy_item_class(keychainItem); CFDictionarySetValue(query, kSecClass, cfclass); CFRelease(cfclass); OSStatus result = SecItemUpdate(query, attributes); CFRelease(query); CFRelease(attributes); CheckOSStatusOrRaise(result); rb_keychain_item_reload(self); return self; }
void Init_rtMidiWrapper() { rb_rtMidiWrapper = rb_define_module("RtMidiLib"); rb_rtMidiIn = rb_define_class_under(rb_rtMidiWrapper, "MidiInDevice", rb_cObject); rb_define_alloc_func(rb_rtMidiIn, rtMidiIn_allocate); rb_define_method(rb_rtMidiIn, "getNumDevices", RUBY_METHOD_FUNC(rtMidiIn_getNumDevices), 0); rb_define_method(rb_rtMidiIn, "getDeviceNames", RUBY_METHOD_FUNC(rtMidiIn_getDeviceNames), 0); rb_define_method(rb_rtMidiIn, "connect", RUBY_METHOD_FUNC(rtMidiIn_connect), 1); //rb_define_method(rb_rtMidiIn, "disconnect", RUBY_METHOD_FUNC(rtMidiIn_disconnect), 0); rb_define_method(rb_rtMidiIn, "getData", RUBY_METHOD_FUNC(rtMidiIn_getData), 0); // later possibly support MidiOut //rb_rtMidiOut = rb_define_class_under(rb_rtMidiWrapper, "MidiOutDevice", rb_cObject); }
/* * call-seq: * each_child -> Enumerator * each_child { |child| } -> self * * iterates the children in this property. * ===Return value * self * */ DLL_LOCAL VALUE _each_child(VALUE self) { RETURN_SIZED_ENUMERATOR(self,0,NULL,RUBY_METHOD_FUNC(_each_child_size)); std::size_t count = _self->GetChildCount(); for(std::size_t i = 0; i < count; ++i) rb_yield(wrap(_self->Item(i))); return self; }
void Init_fast_containers() { FastContainers = rb_define_module("FastContainers"); PriorityQueue = rb_define_class_under(FastContainers, "PriorityQueue", rb_cObject); rb_global_variable(&FastContainers); rb_global_variable(&PriorityQueue); rb_define_singleton_method(PriorityQueue, "new", RUBY_METHOD_FUNC(pq_new), 1); rb_define_method(PriorityQueue, "size", RUBY_METHOD_FUNC(pq_size), 0); rb_define_method(PriorityQueue, "push", RUBY_METHOD_FUNC(pq_push), 2); rb_define_method(PriorityQueue, "top", RUBY_METHOD_FUNC(pq_top), 0); rb_define_method(PriorityQueue, "top_key", RUBY_METHOD_FUNC(pq_top_key), 0); rb_define_method(PriorityQueue, "second_best_key", RUBY_METHOD_FUNC(pq_second_best_key), 0); rb_define_method(PriorityQueue, "pop", RUBY_METHOD_FUNC(pq_pop), 0); rb_define_method(PriorityQueue, "empty?", RUBY_METHOD_FUNC(pq_empty), 0); rb_define_method(PriorityQueue, "each", RUBY_METHOD_FUNC(pq_each), 0); rb_define_method(PriorityQueue, "pop_each", RUBY_METHOD_FUNC(pq_pop_each), 0); }