Module: R2CORBA::CORBA::Portable::Stub

Included in:
Stub
Defined in:
lib/corba/common/Stub.rb

Constant Summary collapse

Id =
"IDL:omg.org/CORBA/Object:1.0".freeze
Ids =
[ Id ].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/corba/common/Stub.rb', line 18

def self.included(klass)
  klass.class_eval do

    def init()
      init_corba_portable_stub()
    end

    def self.create_stub(obj)
      raise CORBA::INV_OBJREF.new unless obj.is_a?(CORBA::Object)
      obj.extend(self) unless obj.is_a?(self)
      obj.init()
      return obj
    end

  end
end

Instance Method Details

#_is_a?(str) ⇒ Boolean

Returns:

  • (Boolean)


66
67
68
# File 'lib/corba/common/Stub.rb', line 66

def _is_a?(str)
  _ids.include?(str) || super(str)
end

#_narrow!(klass) ⇒ Object

Raises:

  • (CORBA::OBJECT_NOT_EXIST)


50
51
52
53
54
55
56
# File 'lib/corba/common/Stub.rb', line 50

def _narrow!(klass)
  raise CORBA::OBJECT_NOT_EXIST.new("Nil object narrowed!") if self._is_nil?
  raise(TypeError, "invalid object narrowed: #{self.class}") unless self.is_a?(CORBA::Stub) && self._is_a?(klass::Id)
  self.extend klass
  _append_ids(*klass::Ids)
  return self
end

#_unchecked_narrow!(klass) ⇒ Object

Raises:

  • (CORBA::OBJECT_NOT_EXIST)


58
59
60
61
62
63
64
# File 'lib/corba/common/Stub.rb', line 58

def _unchecked_narrow!(klass)
  raise CORBA::OBJECT_NOT_EXIST.new("Nil object narrowed!") if self._is_nil?
  raise(TypeError, "invalid object narrowed: #{self.class}") unless self.is_a?(CORBA::Stub)
  self.extend klass
  _append_ids(*klass::Ids)
  return self
end

#inspectObject



70
71
72
73
74
75
# File 'lib/corba/common/Stub.rb', line 70

def inspect()
  s = ""
  s << self.class.name.to_s << "\n" <<
       "type_id: \n" <<
       "  " <<  @ids.join("\n  ") << "\n"
end