broker(client(M:F)) :-... corba_initialize_orb([], _), factory(F).
broker.pl gives a handle to the server object
broker(server(M:I)) :- ... corba_initialize_server([server,server(test), timeout(infinite)],Server), ...create server object
G =.. [_Create,_Server,Self], call(G), corba_object_to_string(Self,IOR), open(IORFile,write,Fd),write reference to file
format(Fd,'string',[IOR]), close(Fd), corba_main_loop(Server).enter main loop
:- use_module(universe).
client.pl see universe.pl
:- [broker].include broker
main :- broker(client(universe:F)),initialize the broker
assert(client(factory(F))), run. run :- h, ask('What is the state of Clinton s affairs?'), write('Type h to say hallo, x to quit.'),nl. ask(X) :- client(factory(F)), write(client(ask(X))),nl, world_ask(F,X), world_tell(F,R), write(client(ans(R))),nl. h :- client(factory(F)), world_hello(F). q :- client(factory(F)), world_halt(F), halt. x :- halt.
:- [broker].main :- broker(server(universe:world)).
server.pl
The implementation of the server object consists of a collection of predicate definitions (procedures), that have the interface or class name as a prefix.
:- module('universe',[]).world_hello(_Self) :- write('Hello World'),nl. world_ask(_Self, X) :- write(asking(X)), nl. world_tell(_Self,Y) :- Y = 'logically, ok', write(telling(Y)),nl. world_halt(_Self) :- halt.
universe.pl