当前位置: 首页>>代码示例>>C++>>正文


C++ rb_define_alloc_func函数代码示例

本文整理汇总了C++中rb_define_alloc_func函数的典型用法代码示例。如果您正苦于以下问题:C++ rb_define_alloc_func函数的具体用法?C++ rb_define_alloc_func怎么用?C++ rb_define_alloc_func使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了rb_define_alloc_func函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Init_ossl_ssl_session

void Init_ossl_ssl_session(void)
{
#if 0
	mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
	mSSL = rb_define_module_under(mOSSL, "SSL");
#endif
	cSSLSession = rb_define_class_under(mSSL, "Session", rb_cObject);
	eSSLSession = rb_define_class_under(cSSLSession, "SessionError", eOSSLError);

	rb_define_alloc_func(cSSLSession, ossl_ssl_session_alloc);
	rb_define_method(cSSLSession, "initialize", ossl_ssl_session_initialize, 1);

	rb_define_method(cSSLSession, "==", ossl_ssl_session_eq, 1);

	rb_define_method(cSSLSession, "time", ossl_ssl_session_get_time, 0);
	rb_define_method(cSSLSession, "time=", ossl_ssl_session_set_time, 1);
	rb_define_method(cSSLSession, "timeout", ossl_ssl_session_get_timeout, 0);
	rb_define_method(cSSLSession, "timeout=", ossl_ssl_session_set_timeout, 1);
	rb_define_method(cSSLSession, "id", ossl_ssl_session_get_id, 0);
	rb_define_method(cSSLSession, "to_der", ossl_ssl_session_to_der, 0);
	rb_define_method(cSSLSession, "to_pem", ossl_ssl_session_to_pem, 0);
	rb_define_method(cSSLSession, "to_text", ossl_ssl_session_to_text, 0);
}
开发者ID:brettgoulder,项目名称:openssl,代码行数:23,代码来源:ossl_ssl_session.c

示例2: Init_figure_set

/**
 * define class
**/
void
Init_figure_set(void) {
    rb_cFigureSet = rb_define_class("FigureSet", rb_cObject);
    rb_define_alloc_func(rb_cFigureSet, t_allocate);
    rb_define_private_method(rb_cFigureSet, "initialize", t_initialize, -1);
    rb_define_method(rb_cFigureSet, "initialize_copy", t_initialize_copy, 1);
    rb_define_method(rb_cFigureSet, "add", t_add, 1);
    rb_define_method(rb_cFigureSet, "delete", t_delete, 1);
    rb_define_method(rb_cFigureSet, "intersection", t_intersection, 1);
    rb_define_method(rb_cFigureSet, "union", t_union, 1);
    rb_define_method(rb_cFigureSet, "to_a", t_to_a, 0);
    rb_define_method(rb_cFigureSet, "sample", t_sample, -1);
    rb_define_method(rb_cFigureSet, "size", t_size, 0);
    rb_define_method(rb_cFigureSet, "empty?", t_empty, 0);
    rb_define_method(rb_cFigureSet, "clear", t_clear, 0);
    rb_define_alias(rb_cFigureSet, "<<", "add");
    rb_define_alias(rb_cFigureSet, "&", "intersection");
    rb_define_alias(rb_cFigureSet, "|", "union");
    rb_define_alias(rb_cFigureSet, "length", "size");

    // for sample method
    srand((unsigned) time(NULL));
}
开发者ID:tsukasaoishi,项目名称:figure_set,代码行数:26,代码来源:methods.c

示例3: rgeo_init_proj4

static void rgeo_init_proj4()
{
  VALUE rgeo_module;
  VALUE coordsys_module;
  VALUE proj4_class;

  rgeo_module = rb_define_module("RGeo");
  coordsys_module = rb_define_module_under(rgeo_module, "CoordSys");
  proj4_class = rb_define_class_under(coordsys_module, "Proj4", rb_cObject);

  rb_define_alloc_func(proj4_class, alloc_proj4);
  rb_define_module_function(proj4_class, "_create", cmethod_proj4_create, 2);
  rb_define_method(proj4_class, "initialize_copy", method_proj4_initialize_copy, 1);
  rb_define_method(proj4_class, "_set_value", method_proj4_set_value, 2);
  rb_define_method(proj4_class, "_original_str", method_proj4_original_str, 0);
  rb_define_method(proj4_class, "_canonical_str", method_proj4_canonical_str, 0);
  rb_define_method(proj4_class, "_valid?", method_proj4_is_valid, 0);
  rb_define_method(proj4_class, "_geographic?", method_proj4_is_geographic, 0);
  rb_define_method(proj4_class, "_geocentric?", method_proj4_is_geocentric, 0);
  rb_define_method(proj4_class, "_radians?", method_proj4_uses_radians, 0);
  rb_define_method(proj4_class, "_get_geographic", method_proj4_get_geographic, 0);
  rb_define_module_function(proj4_class, "_transform_coords", cmethod_proj4_transform, 5);
}
开发者ID:Cythnk,项目名称:territory_mapper,代码行数:23,代码来源:main.c

示例4: Init_geoip2_compat

void Init_geoip2_compat()
{
  cgeoip2_compat = rb_define_class("GeoIP2Compat", rb_cObject);
  egeoip2_compat_Exception = rb_define_class_under(cgeoip2_compat, "Error", rb_eStandardError);

  rb_global_variable(&cgeoip2_compat);
  rb_global_variable(&egeoip2_compat_Exception);

  rb_define_alloc_func(cgeoip2_compat, geoip2_compat_allocate);
  rb_define_method(cgeoip2_compat, "initialize", geoip2_compat_initialize, 1);
  rb_define_method(cgeoip2_compat, "path", geoip2_compat_path, 0);
  rb_define_method(cgeoip2_compat, "close", geoip2_compat_close, 0);
  rb_define_method(cgeoip2_compat, "lookup", geoip2_compat_lookup, 1);

  geoip2_compat_COUNTRY_CODE  = rb_intern("country_code");
  geoip2_compat_COUNTRY_NAME  = rb_intern("country_name");
  geoip2_compat_REGION        = rb_intern("region");
  geoip2_compat_REGION_NAME   = rb_intern("region_name");
  geoip2_compat_CITY          = rb_intern("city");
  geoip2_compat_POSTAL_CODE   = rb_intern("postal_code");
  geoip2_compat_LATITUDE      = rb_intern("latitude");
  geoip2_compat_LONGITUDE     = rb_intern("longitude");
}
开发者ID:almsrafi,项目名称:geoip2_compat,代码行数:23,代码来源:geoip2_compat.c

示例5: Init_ossl_ns_spki

/*
 * NETSCAPE_SPKI init
 */
void
Init_ossl_ns_spki()
{
    mNetscape = rb_define_module_under(mOSSL, "Netscape");
	
    eSPKIError = rb_define_class_under(mNetscape, "SPKIError", eOSSLError);
	
    cSPKI = rb_define_class_under(mNetscape, "SPKI", rb_cObject);
	
    rb_define_alloc_func(cSPKI, ossl_spki_alloc);
    rb_define_method(cSPKI, "initialize", ossl_spki_initialize, -1);
	
    rb_define_method(cSPKI, "to_der", ossl_spki_to_der, 0);
    rb_define_method(cSPKI, "to_pem", ossl_spki_to_pem, 0);
    rb_define_alias(cSPKI, "to_s", "to_pem");
    rb_define_method(cSPKI, "to_text", ossl_spki_print, 0);
    rb_define_method(cSPKI, "public_key", ossl_spki_get_public_key, 0);
    rb_define_method(cSPKI, "public_key=", ossl_spki_set_public_key, 1);
    rb_define_method(cSPKI, "sign", ossl_spki_sign, 2);
    rb_define_method(cSPKI, "verify", ossl_spki_verify, 1);
    rb_define_method(cSPKI, "challenge", ossl_spki_get_challenge, 0);
    rb_define_method(cSPKI, "challenge=", ossl_spki_set_challenge, 1);
}
开发者ID:AdamDotCom,项目名称:my-rvm,代码行数:26,代码来源:ossl_ns_spki.c

示例6: Map_register

void Map_register(VALUE module) {
  VALUE klass = rb_define_class_under(module, "Map", rb_cObject);
  rb_define_alloc_func(klass, Map_alloc);
  cMap = klass;
  rb_gc_register_address(&cMap);

  rb_define_method(klass, "initialize", Map_init, -1);
  rb_define_method(klass, "each", Map_each, 0);
  rb_define_method(klass, "keys", Map_keys, 0);
  rb_define_method(klass, "values", Map_values, 0);
  rb_define_method(klass, "[]", Map_index, 1);
  rb_define_method(klass, "[]=", Map_index_set, 2);
  rb_define_method(klass, "has_key?", Map_has_key, 1);
  rb_define_method(klass, "delete", Map_delete, 1);
  rb_define_method(klass, "clear", Map_clear, 0);
  rb_define_method(klass, "length", Map_length, 0);
  rb_define_method(klass, "dup", Map_dup, 0);
  rb_define_method(klass, "==", Map_eq, 1);
  rb_define_method(klass, "hash", Map_hash, 0);
  rb_define_method(klass, "inspect", Map_inspect, 0);
  rb_define_method(klass, "merge", Map_merge, 1);
  rb_include_module(klass, rb_mEnumerable);
}
开发者ID:2007750219,项目名称:protobuf,代码行数:23,代码来源:map.c

示例7: define_ruby_class

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, "IplConvKernel", 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, "size", RUBY_METHOD_FUNC(rb_size), 0);
  rb_define_method(rb_klass, "cols", RUBY_METHOD_FUNC(rb_cols), 0);
  rb_define_alias(rb_klass, "columns", "cols");
  rb_define_method(rb_klass, "rows", RUBY_METHOD_FUNC(rb_rows), 0);
  rb_define_method(rb_klass, "anchor", RUBY_METHOD_FUNC(rb_anchor), 0);
  rb_define_method(rb_klass, "anchor_x", RUBY_METHOD_FUNC(rb_anchor_x), 0);
  rb_define_method(rb_klass, "anchor_y", RUBY_METHOD_FUNC(rb_anchor_y), 0);
}
开发者ID:Wenackles,项目名称:ruby-opencv,代码行数:23,代码来源:iplconvkernel.cpp

示例8: Init_Oni_Animation

void Init_Oni_Animation(VALUE outer){
	VALUE klass = rb_define_class_under(outer, "Animation", rb_cObject);
	
	rb_define_alloc_func(klass, alloc);
	rb_define_method(klass, "initialize", initialize, 1);
	rb_define_method(klass, "update", update, 1);
	
	rb_define_method(klass, "share_skeleton_with", shareSkeletonWith, -1);
	rb_define_method(klass, "bone", getBone, 1);
	
	rb_define_method(klass, "animations", animation_names, 0);
	
	rb_define_method(klass, "[]", getAnimationTrack, 1);
	
	// Add easing equations
	Init_Oni_AnimationEasing(klass);
	
	
	// Nested class
	Init_Oni_Animation_Track(klass);
	Init_Oni_Animation_Bone(klass);
	Init_Oni_AnimationEasing(klass);
}
开发者ID:Avant-Flux,项目名称:oni,代码行数:23,代码来源:animation.c

示例9: Init_grpc_server

void Init_grpc_server() {
  grpc_rb_cServer =
      rb_define_class_under(grpc_rb_mGrpcCore, "Server", rb_cObject);

  /* Allocates an object managed by the ruby runtime */
  rb_define_alloc_func(grpc_rb_cServer, grpc_rb_server_alloc);

  /* Provides a ruby constructor and support for dup/clone. */
  rb_define_method(grpc_rb_cServer, "initialize", grpc_rb_server_init, 1);
  rb_define_method(grpc_rb_cServer, "initialize_copy", grpc_rb_cannot_init_copy,
                   1);

  /* Add the server methods. */
  rb_define_method(grpc_rb_cServer, "request_call", grpc_rb_server_request_call,
                   0);
  rb_define_method(grpc_rb_cServer, "start", grpc_rb_server_start, 0);
  rb_define_method(grpc_rb_cServer, "destroy", grpc_rb_server_destroy, -1);
  rb_define_alias(grpc_rb_cServer, "close", "destroy");
  rb_define_method(grpc_rb_cServer, "add_http2_port",
                   grpc_rb_server_add_http2_port, 2);
  id_at = rb_intern("at");
  id_insecure_server = rb_intern("this_port_is_insecure");
}
开发者ID:deepaklukose,项目名称:grpc,代码行数:23,代码来源:rb_server.c

示例10: Init_bitmapper

void Init_bitmapper() {
    rb_cBitmapper = rb_define_class("Bitmapper", rb_cObject);
    rb_define_alloc_func(rb_cBitmapper, bm_alloc);
    rb_define_method(rb_cBitmapper, "initialize", bm_init, 1);
    rb_define_method(rb_cBitmapper, "reset", bm_reset, 0);
    rb_define_method(rb_cBitmapper, "get_indexes", bm_get_indexes, 0);
    rb_define_method(rb_cBitmapper, "add", bm_add_from_file, 1);
    rb_define_method(rb_cBitmapper, "remove", bm_remove_from_file, 1);
    rb_define_method(rb_cBitmapper, "dump_to", bm_dump_to_file, 1);

    rb_define_method(rb_cBitmapper, "enable_filter", bm_enable_filter, 0);
    rb_define_method(rb_cBitmapper, "disable_filter", bm_disable_filter, 0);
    rb_define_method(rb_cBitmapper, "set_filters", bm_set_filters, 1);
    rb_define_method(rb_cBitmapper, "clear_filters", bm_clear_filters, 1);

    rb_define_method(rb_cBitmapper, "load_from_str", bm_load_str_to_bkt, 2);
    rb_define_method(rb_cBitmapper, "dump_range_to_str", bm_dump_range_bkt_str, 3);
    rb_define_method(rb_cBitmapper, "dump_to_str", bm_dump_bkt_str, 2);

    rb_define_method(rb_cBitmapper, "status?", bm_num_status, 1);
    rb_define_method(rb_cBitmapper, "set", bm_set, 1);
    rb_define_method(rb_cBitmapper, "clear", bm_clear, 1);
}
开发者ID:gouthamvel,项目名称:bitmapper,代码行数:23,代码来源:bitmapper.c

示例11: Init_packet_in

void
Init_packet_in() {
    rb_require( "trema/mac" );
    cPacketIn = rb_define_class_under( mTrema, "PacketIn", rb_cObject );
    rb_define_alloc_func( cPacketIn, packet_in_alloc );
#if 0
    /*
     * Do not remote this is to fake yard to create a constructor for
     * PacketIn object.
     */
    rb_define_method( cPacketIn, "initialize", packet_in_init, 0 );
#endif
    rb_define_method( cPacketIn, "datapath_id", packet_in_datapath_id, 0 );
    rb_define_method( cPacketIn, "transaction_id", packet_in_transaction_id, 0 );
    rb_define_method( cPacketIn, "buffer_id", packet_in_buffer_id, 0 );
    rb_define_method( cPacketIn, "buffered?", packet_in_is_buffered, 0 );
    rb_define_method( cPacketIn, "in_port", packet_in_in_port, 0 );
    rb_define_method( cPacketIn, "total_len", packet_in_total_len, 0 );
    rb_define_method( cPacketIn, "reason", packet_in_reason, 0 );
    rb_define_method( cPacketIn, "data", packet_in_data, 0 );
    rb_define_method( cPacketIn, "macsa", packet_in_macsa, 0 );
    rb_define_method( cPacketIn, "macda", packet_in_macda, 0 );
}
开发者ID:nickkaranatsios,项目名称:trema,代码行数:23,代码来源:packet_in.c

示例12: strb_InitializeFont

VALUE
strb_InitializeFont(VALUE rb_mStarRuby)
{
  VALUE rb_cFont = rb_define_class_under(rb_mStarRuby, "Font", rb_cObject);
  rb_define_singleton_method(rb_cFont, "exist?", Font_s_exist, 1);
  rb_define_singleton_method(rb_cFont, "new",    Font_s_new,   -1);
  rb_define_alloc_func(rb_cFont, Font_alloc);
  rb_define_private_method(rb_cFont, "initialize", Font_initialize, 5);
  rb_define_method(rb_cFont, "bold?",     Font_bold,     0);
  rb_define_method(rb_cFont, "get_size",  Font_get_size, 1);
  rb_define_method(rb_cFont, "italic?",   Font_italic,   0);
  rb_define_method(rb_cFont, "name",      Font_name,     0);
  rb_define_method(rb_cFont, "size",      Font_size,     0);

  symbol_bold      = ID2SYM(rb_intern("bold"));
  symbol_italic    = ID2SYM(rb_intern("italic"));
  symbol_ttc_index = ID2SYM(rb_intern("ttc_index"));

  rbFontCache = rb_hash_new();
  rb_gc_register_address(&rbFontCache);

  return rb_cFont;
}
开发者ID:GunioRobot,项目名称:starruby,代码行数:23,代码来源:font.c

示例13: init_swf_text_field

void init_swf_text_field()
{
  VALUE kedama  = rb_define_module("Kedama");
  VALUE swf     = rb_define_module_under(kedama, "SWF");
  VALUE klass   = rb_define_class_under(swf, "TextField", rb_cObject);

  rb_define_alloc_func(klass, allocate);
  rb_define_method(klass, "height=", set_height, 1);
  rb_define_method(klass, "append", append, 1);
  rb_define_method(klass, "bounds", bounds, 2);
  rb_define_method(klass, "variable_name=", set_variable_name, 1);
  rb_define_method(klass, "field_height=", set_field_height, 1);
  rb_define_method(klass, "left_margin=", set_left_margin, 1);
  rb_define_method(klass, "right_margin=", set_right_margin, 1);
  rb_define_method(klass, "indentation=", set_indentation, 1);
  rb_define_method(klass, "line_spacing=", set_line_spacing, 1);
  rb_define_method(klass, "padding=", set_padding, 1);
  rb_define_method(klass, "length=", set_length, 1);
  rb_define_private_method(klass, "native_set_font", native_set_font, 1);
  rb_define_private_method(klass, "native_set_color", native_set_color, 4);
  rb_define_private_method(klass, "native_set_flags", native_set_flags, 1);
  rb_define_private_method(klass, "native_set_alignment", native_set_alignment, 1);
}
开发者ID:tenderlove,项目名称:kedama,代码行数:23,代码来源:swf_text_field.c

示例14: init_ruby_class

void
init_ruby_class()
{
#if 0
  // For documentation using YARD
  VALUE opencv = rb_define_module("OpenCV");
  VALUE alghorithm = rb_define_class_under(opencv, "Algorithm", rb_cObject);
  VALUE face_recognizer = rb_define_class_under(opencv, "FaceRecognizer", alghorithm);
#endif

  if (rb_klass)
    return;
  /* 
   * opencv = rb_define_module("OpenCV");
   * 
   * note: this comment is used by rdoc.
   */
  VALUE opencv = rb_module_opencv();
  VALUE face_recognizer = cFaceRecognizer::rb_class();
  rb_klass = rb_define_class_under(opencv, "EigenFaces", face_recognizer);
  rb_define_alloc_func(rb_klass, cFaceRecognizer::allocate_facerecognizer);
  rb_define_private_method(rb_klass, "initialize", RUBY_METHOD_FUNC(rb_initialize), -1);
}
开发者ID:HaiTo,项目名称:ruby-opencv,代码行数:23,代码来源:eigenfaces.cpp

示例15: Init_ora_number

void Init_ora_number(void)
{
#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
  /* ruby 1.8 */
  rb_define_alloc_func(cOraNumber, RUBY_METHOD_FUNC(ora_number_s_allocate));
  rb_define_method(cOraNumber, "initialize", ora_number_initialize, -1);
  rb_define_method(cOraNumber, "initialize_copy", ora_number_initialize_copy, 1);
#else
  /* ruby 1.6 */
  rb_define_singleton_method(cOraNumber, "new", ora_number_s_new, -1);
  rb_define_method(cOraNumber, "initialize", ora_number_initialize, -1);
  rb_define_method(cOraNumber, "clone", ora_number_clone, 0);
  rb_define_method(cOraNumber, "dup", ora_number_clone, 0);
#endif

  rb_define_method(cOraNumber, "to_i", ora_number_to_i, 0);
  rb_define_method(cOraNumber, "to_f", ora_number_to_f, 0);
  rb_define_method(cOraNumber, "to_s", ora_number_to_s, 0);
  rb_define_method(cOraNumber, "[email protected]", ora_number_uminus, 0);

  rb_define_method(cOraNumber, "_dump", ora_number_dump, -1);
  rb_define_singleton_method(cOraNumber, "_load", ora_number_s_load, 1);
}
开发者ID:kevincolyar,项目名称:ruby_oracle_libs,代码行数:23,代码来源:oranumber.c


注:本文中的rb_define_alloc_func函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。