Module: R2CORBA::CORBA::IDL

Defined in:
lib/corba/common/IDL.rb

Constant Summary collapse

CLIENT_STUB =
1.freeze
SERVANT_INTF =
2.freeze
@@loaded_idls =
{}

Class Method Summary collapse

Class Method Details

.implement(idlfile, params = {}, genbits = CLIENT_STUB) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/corba/common/IDL.rb', line 37

def IDL.implement(idlfile, params = {}, genbits = CLIENT_STUB)
  idlreg = @@loaded_idls[idlfile]
  if idlreg.nil? || ((idlreg & genbits) != genbits)
    idlreg ||= 0
    if block_given?
      @@loaded_idls[idlfile] = idlreg | genbits
      yield
    else
      params[:includepaths] ||= $:
      fp = find_include(idlfile, params[:includepaths])
      begin
        f = File.open(fp, 'r')
        params.store(:stubs_only, !gen_servant_intf?(idlreg, genbits))
        params.store(:client_stubs, gen_client_stubs?(idlreg, genbits))
        ## check for forced stub generation
        genbits |= CLIENT_STUB if params[:client_stubs]
        @@loaded_idls[idlfile] = (idlreg | genbits)
        ::IDL::RIDL.eval(f, params)
      ensure
        f.close
      end
    end
  end
end