Module: Orocos::CORBA
- Extended by:
- Logger::Forward, Logger::Hierarchy
- Defined in:
- lib/orocos/corba.rb,
lib/orocos/name_service.rb,
ext/rorocos/rorocos.cc
Defined Under Namespace
Classes: ComError, NameService
Class Attribute Summary collapse
-
.call_timeout ⇒ Object
Returns the current timeout for method calls, in milliseconds Orocos.rb sets it to 20000 ms by default.
-
.connect_timeout ⇒ Object
Returns the timeout, in milliseconds, before a connection creation fails.
-
.max_message_size ⇒ Object
The maximum message size, in bytes, allowed by the omniORB.
Class Method Summary collapse
-
.cleanup ⇒ Object
Calls cleanup on the global Orocos::CORBA::NameService instance CORBA.name_service.
- .clear ⇒ Object
-
.deinit ⇒ Object
Deinitializes the CORBA layer.
- .do_call_timeout(duration) ⇒ Object
- .do_connect_timeout(duration) ⇒ Object
- .do_deinit ⇒ Object
-
.Orocos::CORBA.init ⇒ Boolean
Initializes the CORBA ORB and gets a reference to the local name server.
- .get(method, name) ⇒ Object
-
.initialize ⇒ Object
Initialize the CORBA layer.
-
.load_typekit(name) ⇒ Object
deprecated
Deprecated.
use load_typekit instead
-
.name_service ⇒ Orocos::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 name_service.
-
.name_service=(service) ⇒ Object
Sets the default CORBA name service and replaces the old instance stored in #name_service if there is one.
-
.refine_exceptions(obj0, obj1 = nil) ⇒ Object
Improves exception messages for exceptions that are raised from the C++ extension.
-
.Orocos::CORBA.transportable_type_names ⇒ Object
Returns an array of string that are the type names which can be transported over the CORBA layer.
Class Attribute Details
.call_timeout ⇒ Object
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_timeout ⇒ Object
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_size ⇒ Object
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 end |
Class Method Details
.cleanup ⇒ Object
Calls cleanup on the global Orocos::CORBA::NameService instance name_service
516 517 518 |
# File 'lib/orocos/name_service.rb', line 516 def cleanup name_service.cleanup end |
.clear ⇒ Object
109 110 111 |
# File 'lib/orocos/corba.rb', line 109 def self.clear @name_service = nil end |
.deinit ⇒ Object
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 |
.do_call_timeout(duration) ⇒ Object
88 89 90 91 92 |
# File 'ext/rorocos/corba.cc', line 88
static VALUE corba_set_call_timeout(VALUE mod, VALUE duration)
{
omniORB::setClientCallTimeout(NUM2INT(duration));
return Qnil;
}
|
.do_connect_timeout(duration) ⇒ Object
94 95 96 97 98 |
# File 'ext/rorocos/corba.cc', line 94
static VALUE corba_set_connect_timeout(VALUE mod, VALUE duration)
{
omniORB::setClientConnectTimeout(NUM2INT(duration));
return Qnil;
}
|
.do_deinit ⇒ Object
.Orocos::CORBA.init ⇒ Boolean
Initializes the CORBA ORB and gets a reference to the local name server. Returns true if a new connection has been made and false if the CORBA layer was already initialized.
It raises Orocos::CORBAError if either the ORB failed to initialize or the name server cannot be found.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'ext/rorocos/corba.cc', line 117
static VALUE corba_init(VALUE mod)
{
// Initialize only once ...
if (!NIL_P(corbaAccess))
return Qfalse;
try {
char const* argv[2] = { "bla", 0 };
CorbaAccess::init(1, const_cast<char**>(argv));
corbaAccess = Data_Wrap_Struct(rb_cObject, 0, corba_deinit, CorbaAccess::instance());
rb_iv_set(mCORBA, "@corba", corbaAccess);
} catch(CORBA::Exception& e) {
rb_raise(eCORBA, "failed to contact the name server");
}
return Qtrue;
}
|
.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 |
.initialize ⇒ Object
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
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_service ⇒ Orocos::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
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.
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 |
.Orocos::CORBA.transportable_type_names ⇒ Object
Returns an array of string that are the type names which can be transported over the CORBA layer
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'ext/rorocos/corba.cc', line 143
static VALUE corba_transportable_type_names(VALUE mod)
{
RTT::types::TypeInfoRepository::shared_ptr rtt_types =
RTT::types::TypeInfoRepository::Instance();
VALUE result = rb_ary_new();
vector<string> all_types = rtt_types->getTypes();
for (vector<string>::iterator it = all_types.begin(); it != all_types.end(); ++it)
{
RTT::types::TypeInfo* ti = rtt_types->type(*it);
vector<int> transports = ti->getTransportNames();
if (find(transports.begin(), transports.end(), ORO_CORBA_PROTOCOL_ID) != transports.end())
rb_ary_push(result, rb_str_new2(it->c_str()));
}
return result;
}
|