summaryrefslogtreecommitdiff
path: root/rb/src/IceRuby/Proxy.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2007-05-11 17:55:16 +0000
committerMark Spruiell <mes@zeroc.com>2007-05-11 17:55:16 +0000
commit2c2b45a1f2c74dccde8d85c30d672088e330358d (patch)
tree8fdcf58ba37d5836ed149e5a7e94217df02227e0 /rb/src/IceRuby/Proxy.cpp
parentminor fix (diff)
downloadice-2c2b45a1f2c74dccde8d85c30d672088e330358d.tar.bz2
ice-2c2b45a1f2c74dccde8d85c30d672088e330358d.tar.xz
ice-2c2b45a1f2c74dccde8d85c30d672088e330358d.zip
bug 2207; also fixing bug with connection comparison for binding test
Diffstat (limited to 'rb/src/IceRuby/Proxy.cpp')
-rw-r--r--rb/src/IceRuby/Proxy.cpp36
1 files changed, 25 insertions, 11 deletions
diff --git a/rb/src/IceRuby/Proxy.cpp b/rb/src/IceRuby/Proxy.cpp
index ccc0243f40a..1724bcd6e48 100644
--- a/rb/src/IceRuby/Proxy.cpp
+++ b/rb/src/IceRuby/Proxy.cpp
@@ -118,6 +118,28 @@ IceRuby_Connection_toString(VALUE self)
return Qnil;
}
+extern "C"
+VALUE
+IceRuby_Connection_equals(VALUE self, VALUE other)
+{
+ ICE_RUBY_TRY
+ {
+ if(NIL_P(other))
+ {
+ return Qfalse;
+ }
+ if(callRuby(rb_obj_is_kind_of, other, _connectionClass) != Qtrue)
+ {
+ throw RubyException(rb_eTypeError, "argument must be a connection");
+ }
+ Ice::ConnectionPtr* p1 = reinterpret_cast<Ice::ConnectionPtr*>(DATA_PTR(self));
+ Ice::ConnectionPtr* p2 = reinterpret_cast<Ice::ConnectionPtr*>(DATA_PTR(other));
+ return *p1 == *p2 ? Qtrue : Qfalse;
+ }
+ ICE_RUBY_CATCH
+ return Qnil;
+}
+
// **********************************************************************
// Endpoint
// **********************************************************************
@@ -594,17 +616,7 @@ IceRuby_ObjectPrx_ice_getEndpointSelection(VALUE self)
Ice::EndpointSelectionType type = p->ice_getEndpointSelection();
volatile VALUE cls = callRuby(rb_path2class, "Ice::EndpointSelectionType");
assert(!NIL_P(cls));
- ID name = 0;
- switch(type)
- {
- case Ice::Random:
- name = rb_intern("Random");
- break;
- case Ice::Ordered:
- name = rb_intern("Ordered");
- break;
- }
- return callRuby(rb_funcall, cls, name, 0);
+ return callRuby(rb_funcall, cls, rb_intern("from_int"), 1, INT2NUM(static_cast<int>(type)));
}
ICE_RUBY_CATCH
return Qnil;
@@ -1326,6 +1338,8 @@ IceRuby::initProxy(VALUE iceModule)
rb_define_method(_connectionClass, "toString", CAST_METHOD(IceRuby_Connection_toString), 0);
rb_define_method(_connectionClass, "to_s", CAST_METHOD(IceRuby_Connection_toString), 0);
rb_define_method(_connectionClass, "inspect", CAST_METHOD(IceRuby_Connection_toString), 0);
+ rb_define_method(_connectionClass, "==", CAST_METHOD(IceRuby_Connection_equals), 1);
+ rb_define_method(_connectionClass, "eql?", CAST_METHOD(IceRuby_Connection_equals), 1);
//
// Endpoint.