[Up: Implementation Overview]
[Previous: Implementation Overview] [Next: Interface Repository]
The ORB is implemented as a library (libmico2.3.6.a) that is linked into each MICO application.
Every MICO application has to call the ORB initialization function
ORB_init()
before using MICO functionality.
int main (int argc, char *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb"); ... }
That way the ORB has access to the applications command line arguments.
After evaluating them the ORB removes the command line options it understands
so the application doesn't have to care about them. You can also put
ORB command line arguments into a file called .micorc
in your home
directory. Arguments given on the command line override settings from
.micorc
. Here is a description of all ORB specific command line
arguments:
mico-local-orb
is currently the
only supported ORB identifier. This option is intended for programs
that needed access to different CORBA implementations in the same
process. In this case the option -ORBId
is used to select one
of the CORBA implementations.-ORBImplRepoAddr
nor -ORBImpRepoIOR
the ORB will run a local
implementation repository.-ORBImplRepoIOR
but for the interface repository.-ORBImplRepoAddr
but for the interface repository.-ORBImplRepoIOR
but for the naming service.-ORBImplRepoAddr
but for the naming service.identifer
to the given object reference. This mechanism can be used both for
custom and for standard initial references (see above).IOR-base
is an
iioploc-
or iiopname-
Style object reference. When
a previously unknown initial reference is searched for using
resolve_initial_references()
, the searched-for identifier
is concatenated to the IOR-base
string to produce the
service's location.<level>
is a non-negative integer
with greater values giving more debug output on cerr
.bind(const char *repoid)
should try to
bind to. This option can be used more than once to specify multiple
addresses.~/.micorc
).<pattern>
is a shell-like pattern that must match
the description
field of a code set in the OSF code set
registry4.2.
For example the pattern *8859-1*
will make the ORB use the
code set ISO-8859-1 (Latin 1) as the native char code set, which is
the default if you do not specify this option. The ORB uses this
information to automatically convert characters and strings when talking
to an application that uses a different code set.-ORBNativeWCS
, but specifies the code set the
application uses to wide characters and wide strings. Defaults
to UTF-16, a 16 bit encoding of Unicode.
The ORB offers two functions for obtaining object references for the
interface repository, the implementation repository, and the naming
service. Here is an example that shows how to obtain a reference for
the interface repository using resolve_initial_references()
:
int main (int argc, char *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb"); ... CORBA::Object_var obj = orb->resolve_initial_references ("InterfaceRepository"); CORBA::Repository_var repo = CORBA::Repository::_narrow (obj); ... }
If you specify the interface repository by using the ORB command line option
-ORBIfaceRepoAddr
or -ORBIfaceRepoIOR
, the reference returned
from resolve_initial_references()
will be the one you specified.
Otherwise the ORB will run a local interface repository and you will get
a reference to this one.
Obtaining a reference to the implementation repository
("ImplementationRepository"
) and the naming service
("NameService"
) works the same way as for the interface repository.
There is another method called list_initial_services()
that returns
a list of names which can be used as arguments for
resolve_initial_references()
. Here is how to use it:
int main (int argc, char *argv[]) { CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb"); ... CORBA::ORB::ObjectIdList_var ids = orb->list_initial_services (); for (int i = 0; i < ids->length(); ++i) cout << ids[i] << endl; ... }
Initial references can also be specified using the
-ORBInitRef
and -ORBDefaultInitRef
command line
options.
[Previous: Implementation Overview] [Next: Interface Repository]
[Up: Implementation Overview]