Module: Orocos::CORBA

Extended by:
Logger::Forward, Logger::Hierarchy
Defined in:
lib/orocos/corba.rb,
lib/orocos/name_service.rb

Defined Under Namespace

Classes: NameService

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.call_timeoutObject

Returns the current timeout for method calls, in milliseconds Orocos.rb sets it to 20000 ms by default

See #call_timeout= for a complete description


42
43
44
# File 'lib/orocos/corba.rb', line 42

def call_timeout
  @call_timeout
end

.connect_timeoutObject

Returns the timeout, in milliseconds, before a connection creation fails. Orocos.rb sets it to 2000 ms by default

See #connect_timeout=


57
58
59
# File 'lib/orocos/corba.rb', line 57

def connect_timeout
  @connect_timeout
end

.max_message_sizeObject

The maximum message size, in bytes, allowed by the omniORB. It can only be set before Orocos.initialize is called

orocos.rb sets the default to 4GB (the maximum)


16
17
18
# File 'lib/orocos/corba.rb', line 16

def max_message_size
  @max_message_size
end

Class Method Details

.cleanupObject

Calls cleanup on the global Orocos::CORBA::NameService instance name_service

See Also:

  • Orocos::CORBA::NameService.cleanup

516
517
518
# File 'lib/orocos/name_service.rb', line 516

def cleanup
    name_service.cleanup
end

.clearObject


109
110
111
# File 'lib/orocos/corba.rb', line 109

def self.clear
    @name_service = nil
end

.deinitObject

Deinitializes the CORBA layer

It shuts down the CORBA access and deregisters the Ruby process from the server


105
106
107
# File 'lib/orocos/corba.rb', line 105

def self.deinit
    do_deinit
end

.get(method, name) ⇒ Object


90
91
92
93
94
95
96
97
98
99
# File 'lib/orocos/corba.rb', line 90

def self.get(method, name)
           if !Orocos::CORBA.initialized?
               raise NotInitialized, "the CORBA layer is not initialized, call Orocos.initialize first"
           end

           result = ::Orocos::CORBA.refine_exceptions("naming service") do
               ::Orocos::TaskContext.send(method, name)
           end
    result
end

.initializeObject

Initialize the CORBA layer

It does not need to be called explicitely, as it is called by Orocos.initialize


76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/orocos/corba.rb', line 76

def self.initialize
           #setup environment which is used by the orocos.rb
    if !CORBA.name_service.ip.empty?
        ENV['ORBInitRef'] = "NameService=corbaname::#{CORBA.name_service.ip}"
    end

           self.call_timeout    ||= 20000
           self.connect_timeout ||= 2000
           do_init

           #check if name service is reachable
           CORBA.name_service.validate
end

.load_typekit(name) ⇒ Object

Deprecated.

use Orocos.load_typekit instead


68
69
70
# File 'lib/orocos/corba.rb', line 68

def self.load_typekit(name)
    Orocos.load_typekit(name)
end

.name_serviceOrocos::CORBA::NameService

Returns the global CORBA name service which is used to register all Orocos Tasks started by the ruby instance and is by default added to the global Orocos::NameService instance Orocos.name_service

Returns:


486
487
488
# File 'lib/orocos/name_service.rb', line 486

def name_service
    @name_service ||= NameService.new
end

.name_service=(service) ⇒ Object

Sets the default CORBA name service and replaces the old instance stored in Orocos#name_service if there is one.

Parameters:


494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/orocos/name_service.rb', line 494

def name_service=(service)
    if service.respond_to? :to_str
        # To support deprecated way of setting the host name
        CORBA.warn "Orocos::CORBA.name_service = 'host_name' is deprecated."
        CORBA.warn "Use Orocos::CORBA.name_service.ip = 'host_name' instead."
        name_service.ip = service
    else
        #check if the old name service is added to the global Orocos.name_service
        #and replace it with the new one
        Orocos.name_service.name_services.each_with_index do |i,val|
            if val == @name_service
                Orocos.name_service.name_services[i] = service
                break
            end
        end
        @name_service = service
    end
end

.refine_exceptions(obj0, obj1 = nil) ⇒ Object

Improves exception messages for exceptions that are raised from the C++ extension


115
116
117
118
119
120
121
122
123
124
# File 'lib/orocos/corba.rb', line 115

def self.refine_exceptions(obj0, obj1 = nil) # :nodoc:
    yield

rescue ComError => e
    if !obj1
        raise ComError, "communication failed with #{obj0}", e.backtrace
    else
        raise ComError, "communication failed with either #{obj0} or #{obj1}", e.backtrace
    end
end