SC23-2680Bull DPX/20SOMobject Base ToolkitUser’s GuideAIX86 A2 27AQ 01ORDER REFERENCE
viiiSOMobjects Base Toolkit User’s Guide5.5 Initializing and Uninitializing Objects 5-25. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4-16SOMobjects Base Toolkit User’s GuideContext expression The optional context expression (“context-expr”) in a method declaration indicates whichel
4-17SOM IDL and the SOM CompilerAn unqualified modifier is associated with the interface it is defined in. An unqualified modifierstatement has the fo
4-18SOMobjects Base Toolkit User’s GuideFrom the preceding IDL file, modifiers are associated with the following definitions:TypeDef ”::newInt”
4-19SOM IDL and the SOM Compilerdirectinitclasses = “ancestor1, ancestor2, ...” — Specifies the ancestor class(es) whose initializers (anddestructo
4-20SOMobjects Base Toolkit User’s Guidemetaclass = class — Specifies the class’s metaclass. The specified metaclass(or one automatically derived
4-21SOM IDL and the SOM CompilerThe following paragraphs describe each qualified modifier.caller_owns_parameters = “p1, p2, ..., pn” — Specifies t
4-22SOMobjects Base Toolkit User’s Guidemethod or nonstatic or procedure — Indicates the category of method implementation. Refer tothe topic “T
4-23SOM IDL and the SOM CompilerNote: The “set” method procedure that the SOM Compilergenerates by default for an attribute in the .h/.xh binding file
4-24SOMobjects Base Toolkit User’s Guideoffset or namelookup — Indicates whether the SOM Compiler should generatebindings for invoking the metho
4-25SOM IDL and the SOM Compilerselect = parent — Used in conjunction with the override modifier, this indi-cates that an inherited static method
ixPrefaceRunning the application 6-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Starting the DSOM
4-26SOMobjects Base Toolkit User’s GuideEach “literal” is a string literal (enclosed in double quotes) to be placed verbatim into thespecified header
4-27SOM IDL and the SOM Compilerstatement then causes an appropriate #include statement to be emitted into the C/C++ bindingfile, so that the file def
4-28SOMobjects Base Toolkit User’s GuideAny number of methods and attributes can be designated as private, either within a single#ifdef or in separate
4-29SOM IDL and the SOM CompilerQualified names can also take the form:::identifierThese names are resolved by locating the definition of “identifier”
4-30SOMobjects Base Toolkit User’s GuideIf you want to verify that an IDL file contains only standard CORBA specifications, the SOMCompiler option –mc
4-31SOM IDL and the SOM Compiler4.3 The SOM Compiler The SOM Compiler translates the IDL definition of a SOM class into a set of “binding files”app
4-32SOMobjects Base Toolkit User’s Guide<filestem>.h — (produced by the h emitter)This is the header file to be included by C client programs(p
4-33SOM IDL and the SOM Compiler<filestem>.xh — (produced by the xh emitter)This is the header file to be included by C++ client programsthat us
4-34SOMobjects Base Toolkit User’s Guide<filestem>.exp (for AIX) — (produced by the exp emitter) This file is used by the linker to package a
4-35SOM IDL and the SOM CompilerBy default, all output files are placed in the same directoryas the input file. If the SMEMIT environment variable is
xSOMobjects Base Toolkit User’s GuideMapping objects to object references 6-36. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hint
4-36SOMobjects Base Toolkit User’s GuideSMKNOWNEXTS — Specifies additional emitters to which the SOM Compilershould add a header. For example, if y
4-37SOM IDL and the SOM Compiler–V Displays version information about the SOM Compiler.–c Turns off comment processing. This allows comments to appear
4-38SOMobjects Base Toolkit User’s Guide noint This option directs the SOM Compiler not to warn about the portabilityproblems of using int’s in
4-39SOM IDL and the SOM CompilerThe –s option is a convenient way to override the SMEMIT environmentvariable. In OS/2 for example, the command:> SC
4-40SOMobjects Base Toolkit User’s Guide4.4 The ‘pdl’ Facility As discussed earlier in this chapter, the SOM Compiler provides a pdl (Public Definit
5-1Implementing Classes in SOMChapter 5. Implementing Classes in SOMThis chapter begins with a more in-depth discussion of SOM concepts and the SOM r
5-2SOMobjects Base Toolkit User’s Guide5.1 The SOM Run-time Environment As discussed in Chapter 1, the SOMobjects Developer Toolkit providesS The SO
5-3Implementing Classes in SOMThe distinction between instance methods and class methods, as well as that between objects,classes, and metaclasses, is
5-4SOMobjects Base Toolkit User’s GuideRelationships among the four primitive SOM run-time objects are illustrated in Figure 2.Again, the primitive cl
5-5Implementing Classes in SOMParent class vs. metaclass There is a distinct difference between the notions of “parent” (or base) class and “metaclass
xiPrefaceInitiating a Request 6-73. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Example code 6-7
5-6SOMobjects Base Toolkit User’s GuideAny class “C” has both a metaclass and one or more parent class(es).SThe parent class(es) of “C” provide the
5-7Implementing Classes in SOMA metaclass has its own inheritance hierarchy (through its parent classes) that is independentof its instances’ inherita
5-8SOMobjects Base Toolkit User’s GuideSOM-derived metaclasses As previously discussed, a class object can perform any of the class methods that its
5-9Implementing Classes in SOMThere is only one way that “BMeta” can support this specific method — by inheriting it from“AMeta” (“BMeta” could introd
5-10SOMobjects Base Toolkit User’s GuideBMetaAMetaLegend:subclass–ofinstance–ofmetaclass class simple objectMultiple inheritance in SOM requir
5-11Implementing Classes in SOM5.2 Inheritance One of the defining aspects of an object model is its characterization of inheritance. This sectionde
5-12SOMobjects Base Toolkit User’s GuideClass “W”Class “X”Class “Y”Class “Z”Resolution of multiple-inheritance ambiguitiesfoo proc1fo
5-13Implementing Classes in SOMAnother conflict that may arise with the use of multiple inheritance is when two ancestors of aclass define different m
5-14SOMobjects Base Toolkit User’s Guide5.3 Method Resolution Method resolution is the step of determining which procedure to execute in response to
5-15Implementing Classes in SOMName-lookup resolution Name-lookup resolution is similar to the method resolution techniques employed by Objec-tive-C
xiiSOMobjects Base Toolkit User’s GuideExamples of using other events 9-5. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5-16SOMobjects Base Toolkit User’s GuideThe four kinds of SOM methods SOM supports four different kinds of methods: static methods, nonstatic method
5-17Implementing Classes in SOM5.4 Implementing SOM Classes The interface to a class of objects contains the information that a client must know t
5-18SOMobjects Base Toolkit User’s GuideFrom this IDL description, the SOM Compiler generates the following C implementation tem-plate, hello.c (a C++
5-19Implementing Classes in SOMUnless the IDL specification of the class included the callstyle=oidl modifier, then the formalparameter list will incl
5-20SOMobjects Base Toolkit User’s GuideS For overriding methods, the stub procedure ends by making a “parent method call” foreach of the class’s pare
5-21Implementing Classes in SOMThe SOM-generated implementation header file defines the following macros for makingparent-method calls from within an
5-22SOMobjects Base Toolkit User’s GuideS Similarly left intact are preprocessor directives, data declarations, constant declarations,non-method funct
5-23Implementing Classes in SOMConditional compilation (using #if and #ifdef directives) in the implementation file can beanother source of errors, be
5-24SOMobjects Base Toolkit User’s GuideWhen the client program and the implementation file are written in C++:> set LIB=%SOMBASE%\lib;%LIB%> ic
5-25Implementing Classes in SOM5.5 Initializing and Uninitializing Objects This section discusses the initialization and uninitialization of SOM obj
1-1Introduction to the SOMobjects ToolkitChapter 1. Introduction to the SOMobjects Toolkit
5-26SOMobjects Base Toolkit User’s GuideEvery SOM class has a list that defines (in sequential order) the ancestor classes whoseinitializer method pro
5-27Implementing Classes in SOMDeclaring new initializers in SOM IDL When defining SOMobjects classes, programmers can easily declare and implement
5-28SOMobjects Base Toolkit User’s GuideHere, interface “Example1” declares three new initializers. Notice the use of inout somInitCtrlas the first ar
5-29Implementing Classes in SOMFor a number of reasons, the somInit framework has been augmented by recognizing initializ-ers as a special kind of met
5-30SOMobjects Base Toolkit User’s Guide /* * second section –– local Example2 initialization code */}In this example, notice that the “Ex
5-31Implementing Classes in SOMUsage bindings hide the details associated with initializer use in various ways and make callsmore convenient for the c
5-32SOMobjects Base Toolkit User’s GuideOn the other hand, if an object is initially created by allocating memory in some special way andsubsequently
5-33Implementing Classes in SOMImplementation codeBased on the foregoing class definitions, the next example illustrates several important aspectsof i
5-34SOMobjects Base Toolkit User’s GuideSOM_Scope void SOMLINK BBwithInitialValue(B *somSelf, somInitCtrl* ctrl, long initialValue)
5-35Implementing Classes in SOMSOM_Scope void SOMLINK CCwithInitialString(C *somSelf, Environment *ev,
1-2SOMobjects Base Toolkit User’s Guide1.1 Background Object-oriented programming (or OOP) is an important new programming technologythat offers exp
5-36SOMobjects Base Toolkit User’s GuideSOM_Scope SOMObject* SOMLINK CsomPrintSelf(C *somSelf){ CData *somThis = CGetData(somSelf); CMethodDebu
5-37Implementing Classes in SOM c = new C((Environment*)0, ”66”); c–>somPrintSelf(); delete c;}The output from the preceding program is as
5-38SOMobjects Base Toolkit User’s GuideCustomizing the initialization of class objects As described previously, the somDefaultInit method can be ove
5-39Implementing Classes in SOM5.6 Creating a SOM Class Library One of the principal advantages of SOM is that it makes “black box” (or binary) reu
5-40SOMobjects Base Toolkit User’s GuideTypes of class librariesSince class libraries are not programs, users cannot execute them directly. To enable
5-41Implementing Classes in SOMAIX “exp” file: #! abc.dll ACClassData AClassData ANewClass BCClassData BClassData BNewClass CCClassDat
5-42SOMobjects Base Toolkit User’s GuideOne class in the affinity group has a privileged position — namely, the class that was specifical-ly requested
5-43Implementing Classes in SOM #include <windows.h> int CALLBACK LibMain (HINSTANCE inst, WORD ds, WORD Heapsize, LPSTR cmdLine) {
5-44SOMobjects Base Toolkit User’s GuideNote: The “–Ge” option is not used by all the compilers. It indicates that the object files will gointo a DLL.
5-45Implementing Classes in SOMFor Windows: link a.obj b.obj c.obj initfunc.obj, abc.dll, nul, \ ldllcew libw %SOMBASE%\somtk, abc.defNote:
1-3Introduction to the SOMobjects Toolkit1.2 Introducing SOM and the SOMobjects Toolkit The System Object Model (SOM) is a new object-oriented progr
5-46SOMobjects Base Toolkit User’s Guide5.7 Customizing Memory Management SOM is designed to be policy free and highly adaptable. Most of the SOM b
5-47Implementing Classes in SOM5.8 Customizing Class Loading and Unloading SOM uses three routines that manage the loading and unloading of class
5-48SOMobjects Base Toolkit User’s GuideminorVersion — The minor version number to be passed to the class initial-ization function in the DLL (specifi
5-49Implementing Classes in SOM5.9 Customizing Character Output The SOM character-output function is invoked by all of the SOM error-handling and
5-50SOMobjects Base Toolkit User’s Guide5.10 Customizing Error Handling When an error occurs within any of the SOM-supplied methods or functions,
5-51Implementing Classes in SOM5.11 Customizing Mutual Exclusion Services (Thread Safety) The SOM kernel and the other SOMobjects frameworks (DSOM, P
5-52SOMobjects Base Toolkit User’s GuideThe referenced function returns a small integer identifier for the calling thread. The IDcannot be associated
6-1Distributed SOM (DSOM)Chapter 6. Distributed SOM (DSOM)
6-2SOMobjects Base Toolkit User’s Guide6.1 IntroductionNotice: The SOMobjects Base Toolkit provides the capability for implementing WorkstationDSOM (
6-3Distributed SOM (DSOM)• Provides support for writing multi-threaded (on OS/2 and AIX) and event-driven programs.• Provides a default object server
1-4SOMobjects Base Toolkit User’s GuideS Name-lookup resolution: similar to that employed by Objective-C and Smalltalk.Name resolution supports untyp
6-4SOMobjects Base Toolkit User’s GuideAdvanced topicsThe section on “Advanced Topics” covers the following:• “Peer vs. client-server processes” demon
6-5Distributed SOM (DSOM)6.2 A Simple DSOM Example A sample “Stack” application is presented in this section as a tutorial introduction to DSOM. Itd
6-6SOMobjects Base Toolkit User’s GuideThe “Stack” class implementation#define Stack_Class_Source#include <stack.ih>SOM_Scope boolean SOMLINK f
6-7Distributed SOM (DSOM)SOM_Scope void SOMLINK push(Stack somSelf, Environment *ev, long el){ StackData *somThis = S
6-8SOMobjects Base Toolkit User’s Guide /* Verify successful object creation */ if ( stk != NULL ) { while ( !_full(stk, &ev) ) {_push(
6-9Distributed SOM (DSOM)Client program using a remote stackThe preceding program has been rewritten below to use DSOM to create and access a “Stack”o
6-10SOMobjects Base Toolkit User’s Guideboolean OperationOK(Environment *ev){ char *exID; switch (ev–>_major) { case SYSTEM_EXCEPTION:
6-11Distributed SOM (DSOM)From this point on, the client program treats the “Stack” proxy exactly as it would treat a local“Stack”. The “Stack” proxy
6-12SOMobjects Base Toolkit User’s Guide_pop(stk,&ev);if (!_empty(stk,&ev)) somPrintf(”Top: %d\n”, _top(stk,&ev));_somdDeleteObj(server, &
6-13Distributed SOM (DSOM)An application may require more functionality in the server program or the server object than thedefault implementations pro
1-5Introduction to the SOMobjects ToolkitBindings are language-specific macros and procedures that make implementing and usingSOM classes more conveni
6-14SOMobjects Base Toolkit User’s GuideSOMIR gives a list of files that together constitute the Interface Repository. The IR is used byDSOM to guide
6-15Distributed SOM (DSOM)Running the clientOnce the DSOM daemon is running, the application may be started. This is accomplished byrunning the client
6-16SOMobjects Base Toolkit User’s GuideThis scenario has introduced the key processes in a DSOM application: client, server, andsomdd. Also introduce
6-17Distributed SOM (DSOM)6.3 Basic Client Programming For the most part, client programming in DSOM is exactly the same as client programming inSO
6-18SOMobjects Base Toolkit User’s GuideNote: In non-distributed SOM programs, the <className>New macro (and the new operatorprovided for each c
6-19Distributed SOM (DSOM)• A server can create an object and register a reference to the object in some well-knowndirectory. (An object reference con
6-20SOMobjects Base Toolkit User’s GuideProxy objects inherit behavior from the SOMDClientProxy class.Servers and server objects In DSOM, the proces
6-21Distributed SOM (DSOM)Three other methods can be invoked on the DSOM Object Manager to find server implementa-tions: somdFindServer, somdFindServe
6-22SOMobjects Base Toolkit User’s GuideDestroying objects via a proxy DSOM provides means for deleting remote objects via their proxies. For exampl
6-23Distributed SOM (DSOM)Destroying objects via the server object, rather than asking the object itself (as in somFree orsomdTargetFree), allows the
1-6SOMobjects Base Toolkit User’s GuidePersistence Framework The Persistence Framework is a collection of SOM classes that provide methods forsaving
6-24SOMobjects Base Toolkit User’s Guide#include <stdio.h>#include <somd.h>#include <Car.h>main( ) { Environment ev; Car car;
6-25Distributed SOM (DSOM)Upon a lookup call, the directory server could find the corresponding proxy (or its string ID) in thedirectory, and return i
6-26SOMobjects Base Toolkit User’s GuideDetermining memory allocation and ownership When a method is invoked that returns a result of type string, se
6-27Distributed SOM (DSOM)For example, when a method is invoked that returns a result of type string, sequence, or array,DSOM will allocate memory for
6-28SOMobjects Base Toolkit User’s GuideAllocation responsibilitiesWhether the parameter or return result should be allocated by the caller or by the
6-29Distributed SOM (DSOM)For example, consider a client program repeatedly invoking a remote method “get_string”,which returns a string that is desig
6-30SOMobjects Base Toolkit User’s Guide6.4 Basic Server Programming Server programs execute and manage object implementations. That is, they are r
6-31Distributed SOM (DSOM)When a server is initialized, it must retrieve a copy of its ImplementationDef, and keep it in aglobal variable (SOMD_ImplDe
6-32SOMobjects Base Toolkit User’s GuideAIX users should be aware that, unless the SetUserID mode bit is set on the file containing theserver program,
6-33Distributed SOM (DSOM)The SOMOA will then set up a communications port for incoming messages, which it registerswith the DSOM daemon. Once the DSO
1-7Introduction to the SOMobjects Toolkit1.3 What’s New in SOMobjects Version 2.1 Version 2.1 of the SOMobjects Developer Toolkit provides enhanced
6-34SOMobjects Base Toolkit User’s GuideTo notify DSOM when the server program is exiting, the deactivate_impl method defined onSOMOA should be called
6-35Distributed SOM (DSOM)/* From the SOMOA interface */ sequence <octet,1024> Referencedata; SOMDObject create(in ReferenceData id, in Inte
6-36SOMobjects Base Toolkit User’s GuideFollowing are the IDL declarations of the SOMDServer operations:// methods called by a client SOMObject somd
6-37Distributed SOM (DSOM)Two calls to create with the same arguments do not return the same SOMDObject (per CORBA1.1 specifications). That is, if cre
6-38SOMobjects Base Toolkit User’s GuideDispatching a method After SOMOA (with the help of the local server object) has resolved all the SOMDObjects
6-39Distributed SOM (DSOM)The following two procedures override SOMDServer’s implementations of somdCreateObjand somdDeleteObj.SOM_Scope SOMObject SOM
6-40SOMobjects Base Toolkit User’s GuideMethod somdRefFromSOMObj is responsible for producing a SOMDObject (the “Ref” insomdRefFromSOMObj) from a SOMO
6-41Distributed SOM (DSOM)Currently, the value of the userName attribute is obtained from the USER environment variablein the calling process. Likewis
6-42SOMobjects Base Toolkit User’s Guide6.5 Implementing Classes DSOM has been designed to work with a wide range of object implementations, includi
6-43Distributed SOM (DSOM)Implementation constraints The generic server program (somdsvr), the SOMOA, and the SOMDServer make it easy touse SOM clas
1-8SOMobjects Base Toolkit User’s Guide• New SOM IDL modifiers for memory management of parameters:memory_management = corba, caller_owns_parameters,
6-44SOMobjects Base Toolkit User’s GuideSome applications may need to associate specific identification information with an object, tosupport applicat
6-45Distributed SOM (DSOM)Note that the “Printer” interface defines one attribute, “printerName”, that will be used to identifythe printer. It will be
6-46SOMobjects Base Toolkit User’s GuideSee the section entitled “Implementation Statements” in Chapter 4, “SOM IDL and the SOMCompiler,” for a comple
6-47Distributed SOM (DSOM)6.6 Configuring DSOM Applications Preparing the environment Some environment variables must be defined before running DSO
6-48SOMobjects Base Toolkit User’s GuideSOMDDEBUG=<integer> — SOMDDEBUG may optionally be set to enable DSOM run-time error messages. If set to
6-49Distributed SOM (DSOM)— Optionally, the server program can be run under control of a “shell” or debugger,by specifying the shell or debugger name
6-50SOMobjects Base Toolkit User’s GuideThis brings up the DSOM Implementation Registration Utility menu, shown below. To beginregistering the new imp
6-51Distributed SOM (DSOM)================================================================Implementation id...: 2befc82b–13a11e00–7f–00–10005ac9
6-52SOMobjects Base Toolkit User’s GuideTo add an implementation:regimpl –A –i <str> [–p <str>] [–v <str>] [–f <str>] [–b <
6-53Distributed SOM (DSOM)To work with an implementation definition, first click Implementations on the main menu (orpress Alt–I). The pulldown menu
1-9Introduction to the SOMobjects ToolkitIn addition, use of a number of (public) methods introduced by SOMClass is nowdeprecated because they are use
6-54SOMobjects Base Toolkit User’s GuideTo delete classes, select Delete from the Classes pulldown menu (or press D). When youhighlight an implementa
6-55Distributed SOM (DSOM)void add_class_to_impldef (in ImplId implid, in string classname);— Associates a class, identified by name, wi
6-56SOMobjects Base Toolkit User’s GuideInterpretation of ‘dsom’ messagesThe messages generated by the dsom utility have a one-to-one mapping on the D
6-57Distributed SOM (DSOM)On AIX or OS/2, the program is invoked from the command line using the syntax given below.The optional verbose setting can b
6-58SOMobjects Base Toolkit User’s Guide6.7 Running DSOM Applications Prior to starting the DSOM processes, the DSOM executables should be installe
6-59Distributed SOM (DSOM)6.8 DSOM as a CORBA-compliant Object Request Broker The Object Management Group (OMG) consortium defines the notion of an O
6-60SOMobjects Base Toolkit User’s GuideORB — (Object Request Broker) The ORB interface defines utilityroutines for building requests and saving
6-61Distributed SOM (DSOM)The Basic Object Adapter is intended to be a general-purpose Object Adapter available on all CORBA-compliantObject Request B
6-62SOMobjects Base Toolkit User’s Guide SOMDClientProxy SOMDObject “Stack”“Stack__Proxy”...abstract inheritance(interface only)Construction of a
6-63Distributed SOM (DSOM)SOMDObject methods:SOMDObject duplicate ( ); — Creates and returns a duplicate object reference.void release ( ); — De
1-10SOMobjects Base Toolkit User’s Guide1.4 Overview of this bookThis book is a subset of the SOMobjects Developer Toolkit Users Guide for thefull-ca
6-64SOMobjects Base Toolkit User’s GuideServers are processes that execute object implementations. CORBA 1.1 defines four activationpolicies for serv
6-65Distributed SOM (DSOM)DSOM provides a SOM Object Adapter, SOMOA, derived from the BOA interface, that usesSOM Compiler and run-time support to acc
6-66SOMobjects Base Toolkit User’s Guide• The SOMOA provides some specialized object reference types which, in certain situations,are more efficient o
6-67Distributed SOM (DSOM)6.9 Advanced Topics Peer vs. client-server processes The client-server model of distributed computing is appropriate when
6-68SOMobjects Base Toolkit User’s GuideDSOM server programs which use EMan must be very careful not to get into deadlock situa-tions. This is quite e
6-69Distributed SOM (DSOM)MyEMan = SOMEEManNew();SOM_InitEnvironment(&ev);SOM_InitEnvironment(&peerEv);SOMD_Init(&ev);somPrintf(”What is t
6-70SOMobjects Base Toolkit User’s Guide• Start the EMan event processing loop._someProcessEvents(MyEMan, &ev);Before the sample is run, two serve
6-71Distributed SOM (DSOM)len is the number of bytes that the argument value occupies. The following table gives thelength of data values for the C l
6-72SOMobjects Base Toolkit User’s Guide// get the contents of an element in an NVList ORBStatus get_item(in long item_number, /* element # to get *
6-73Distributed SOM (DSOM)The arg_list can be constructed using the procedures described above and is passed to theRequest object in the create_reques
2-1Tutorial for Implementing SOM ClassesChapter 2. Tutorial for Implementing SOM ClassesThis tutorial contains five examples showing how SOM classes
6-74SOMobjects Base Toolkit User’s Guidemain(){ ORBStatus rc; Environment ev; SOMDObject obj; NVList arglist; NamedValue result; Context c
6-75Distributed SOM (DSOM)To build a user-supplied proxy class, it is necessary to understand a bit about how dynamicproxy classes are constructed by
6-76SOMobjects Base Toolkit User’s GuideThe implementation of “method1”, which was added to the template produced by the SOMCompiler, simply calls the
6-77Distributed SOM (DSOM)Alternatively, it is possible to provide a customized base proxy class for use in the dynamicgeneration of DSOM proxy classe
6-78SOMobjects Base Toolkit User’s Guide6.10 Error Reporting and TroubleshootingError reporting When the DSOM run-time environment encounters an er
6-79Distributed SOM (DSOM)2. For all application classes, IDL must be compiled into the Interface Repository. Youcan verify that a class exists in the
6-80SOMobjects Base Toolkit User’s GuideSymptom: A remote method invocation fails and a “DISPATCH” exception is returned. TheDSOM error code is SOMDE
6-81Distributed SOM (DSOM)To correctly pass strings or array arguments, the appropriate CORBA type should be used(for example, “string” or “char foo[4
6-82SOMobjects Base Toolkit User’s Guide6.11 LimitationsThe following list indicates known limitations of Distributed SOM at the time of this release
7-1The Interface Repository FrameworkChapter 7. The Interface Repository Framework
2-2SOMobjects Base Toolkit User’s Guide2.1 Basic Concepts of the System Object Model (SOM)The System Object Model (SOM), provided by the SOMobjects D
7-2SOMobjects Base Toolkit User’s Guide7.1 IntroductionThe SOM Interface Repository (IR) is a database that the SOM Compiler optionally creates andma
7-3The Interface Repository Framework7.2 Using the SOM Compiler to Build an Interface Repository The SOMobjects Toolkit includes an Interface Reposi
7-4SOMobjects Base Toolkit User’s Guide7.3 Managing Interface Repository files Just as the number of interface definitions contained in a single IDL
7-5The Interface Repository FrameworkThe Interface Repository Framework only permits updates in the rightmost file of the SOMIRinterface repository li
7-6SOMobjects Base Toolkit User’s GuideThis command will place all of the information in the “myclass1.idl” file, including the privateportions, in th
7-7The Interface Repository Framework7.4 Programming with the Interface Repository Objects The SOM Interface Repository Framework provides an obje
7-8SOMobjects Base Toolkit User’s GuideRepository — One instance of this class exists for the entire SOM Inter-face Repository, to hold IDL elements t
7-9The Interface Repository FrameworkS AttributeDef class method:— Overrides describe.S OperationDef class method:— Overrides describe.S ParameterDef
7-10SOMobjects Base Toolkit User’s GuideFrom other languages (and for dynamic linkage in C/C++):1. Use the somEnvironmentNew function to obtain a poin
7-11The Interface Repository Framework for (i=0; i<everyObject._length; i++) { Contained aContained; (*next)++;aContained = (Conta
2-3Tutorial for Implementing SOM ClassesS A class that defines the implementation of class objects is called a metaclass. Just as aninstance of a clas
7-12SOMobjects Base Toolkit User’s GuideConceptually, every TypeCode contains a “kind” field (which classifies it), and one or moreparameters that car
7-13The Interface Repository Frameworkexception Bounds {}; // This exception is returned if an attempt is made// by the parameter() operation (descri
7-14SOMobjects Base Toolkit User’s GuideTo provide alignment information for the types and instances of types in your IDL source file, usethe “align=N
7-15The Interface Repository FrameworkThe implementation context string can be used to carry an arbitrarily long description thatidentifies the contex
7-16SOMobjects Base Toolkit User’s GuideIn many cases, the context in which an operation occurs makes the type of the datum apparent.If so, there is n
8-1The Metaclass FrameworkChapter 8. The Metaclass Framework In SOM, classes are objects. Metaclasses are classes and thus are objects, too. Figure 1
8-2SOMobjects Base Toolkit User’s GuideMetaclass Framework class organizationLegend:subclass–ofinstance–ofmetaclass class ordinary objectSOMC
8-3The Metaclass Framework8.1 Framework Metaclasses for “Before/After” Behavior The ‘SOMMBeforeAfter’ metaclassSOMMBeforeAfter is a metaclass that al
8-4SOMobjects Base Toolkit User’s GuideThe following example shows the IDL needed to create a Barking metaclass. Just run theappropriate emitter to ge
8-5The Metaclass FrameworkComposition of before/after metaclassesConsider Figure 4 in which there are two before/after metaclasses — “Barking” (as bef
2-4SOMobjects Base Toolkit User’s GuideSOM classes are designed to be language neutral. That is, SOM classes can be implementedin one programming lang
8-6SOMobjects Base Toolkit User’s GuideFigure 6 combines the diagrams for the techniques in Figure 5 and shows the actual classrelationships. Note tha
8-7The Metaclass Framework8.2 The ‘SOMMSingleInstance’ Metaclass Sometimes it is necessary to define a class for which only one instance can be cre
8-8SOMobjects Base Toolkit User’s Guide8.3 The ‘SOMMTraced’ Metaclass SOMMTraced is a metaclass that facilitates tracing of method invocati
8-9The Metaclass FrameworkThe example below shows the IDL needed to create a traced dog class: Just run the appropriateemitter to get an implementatio
8-10SOMobjects Base Toolkit User’s Guide8.4 Error Codes It is possible to receive the following messages from the Metaclass Framework while anapplic
9-1The Event Management FrameworkChapter 9. The Event Management Framework The Event Management Framework is a central facility for registering all
9-2SOMobjects Base Toolkit User’s Guide9.1 Event Management Basics The Event Management Framework consists of an Event Manager (EMan) class, a Regi
9-3The Event Management FrameworkThe Event Management Framework is extendible (that is, other event types can be added to it)through subclassing. The
9-4SOMobjects Base Toolkit User’s Guide#ifndef H_EVENTMASKDEF#define H_EVENTMASKDEF/* Event Types */#define EMTimerEvent 54#define
9-5The Event Management FrameworkUnregistering for events One can unregister interest in a given event type at any time. To unregister, you must pro
2-5Tutorial for Implementing SOM ClassesDevelopment of the Tutorial examplesS Example 1 — Implementing a simple class with one methodPrints a default
9-6SOMobjects Base Toolkit User’s GuideAn equivalent way to process events is to write a main loop and call someProcessEvent frominside the main loop,
9-7The Event Management Framework9.2 Event Manager Advanced Topics Threads and thread safety As indicated earlier, on OS/2, interactive programs
9-8SOMobjects Base Toolkit User’s GuideMaking EMan recognize the occurrence of the new event is primarily limited by the primitiveevents EMan can wait
9-9The Event Management Framework9.3 Limitations The present implementation of the Event Management framework has the limitations describedbelow. F
9-10SOMobjects Base Toolkit User’s Guide
A-1SOMobjects Error CodesAppendix A. SOMobjects Error Codes
A-2SOMobjects Base Toolkit User’s GuideSOM Kernel Error Codes Following are error codes with messages/explanations for the SOM kernel and the variou
A-3SOMobjects Error CodesDSOM Error Codes The following table lists the error codes that may be encountered when using DSOM. (Obsoletemessages have
A-4SOMobjects Base Toolkit User’s Guide30047 SOMDERROR_ClassNotFoundClass not found in implementation repository.30048 SOMDERROR_ServerNotFoundServer
A-5SOMobjects Error Codes30097 SOMDERROR_NamedMemoryTableError On Windows only, an error occurred while creating or deleting a (named) sh
Bull DPX/20SOMobject Base ToolkitUser’s GuideAIXSoftwareJune 1995BULL S.A. CEDOCAtelier de ReproductionFRAN–231331 Avenue Patton BP 42849005 ANGERS CE
2-6SOMobjects Base Toolkit User’s Guide2.2 Basic Steps for Implementing SOM Classes Implementing and using SOM classes in C or C++ involves the foll
A-6SOMobjects Base Toolkit User’s Guide
B-1SOM IDL Language GrammarAppendix B. SOM IDL Language Grammar specification : [comment] definition+definition : type_dcl ; [commen
B-2SOMobjects Base Toolkit User’s Guideunary_expr : unary_operator primary_expr | primary_exprunary_operator : –
B-3SOM IDL Language Grammarunsigned_int : unsigned signed_intchar_type : charboolean_type : booleanoctet_type : octet
B-4SOMobjects Base Toolkit User’s Guidecontext_expr : context ( context_string {, context_string}* )implementation_body : implementation [comme
C-1Implementing Sockets SubclassesAppendix C. Implementing Sockets Subclasses Distributed SOM (DSOM) requires basic message services for inter-proces
C-2SOMobjects Base Toolkit User’s Guide• Some of the method parameters and return values are expressed using pointer types, forexample:hostent *somsGe
C-3Implementing Sockets Subclassesunsigned long somsGethostid ();// Returns the unique identifier for the current host.long somsGethostname (in string
C-4SOMobjects Base Toolkit User’s Guideunsigned long somsNtohl (in unsigned long a);// Translates an unsigned long integer from network–byte order// t
C-5Implementing Sockets Subclasses#ifdef __SOMIDL__ implementation {releaseorder:somsAccept, somsBind, somsConnect, somsGethostbyaddr,somsGethos
2-7Tutorial for Implementing SOM ClassesExample 1 — Implementing a Simple Class with One Method Example 1 defines a class “Hello” which introduces o
C-6SOMobjects Base Toolkit User’s Guide//# Method modifierssomsAccept: override;somsBind: override;somsConnect: override;somsGethostbyaddr: override;s
C-7Implementing Sockets SubclassesExample code The following code fragment shows an example of the implementation of the somsBindmethod of the TCPIP
C-8SOMobjects Base Toolkit User’s GuideSOM_Scope long SOMLINK somsBind(TCPIPSockets somSelf, Environment *ev,
G–1GlossaryGlossaryNote: In the following definitions, words shown in italics are terms for which separate glossaryentries are also defined.abstract
G–2SOMobjects Base Toolkit User’s Guidebindings Language-specific macros and procedures that make implementing and usingSOM classes more convenient. T
G–3Glossaryclass method (Also known as factory method or constructor.) A class method is a methodthat a class object responds to (as opposed to an in
G–4SOMobjects Base Toolkit User’s Guidedispatch methodA method (such as somDispatch or somClassDispatch) that is invoked (andpassed an argument list a
G–5Glossaryevent manager (EMan) The chief component of the Event Management Framework that registersinterest in various events from calling modules a
G–6SOMobjects Base Toolkit User’s Guideinheritance The technique of defining one class (called a subclass, derived class, or childclass) as increment
G–7GlossaryInterface Repository FrameworkA set of classes that provide methods whereby executing programs canaccess the persistent objects of the In
2-8SOMobjects Base Toolkit User’s GuideUnder AIX or OS/2:#include <hello.ih>/* * This method outputs the string ”Hello, World!”. */SOM_Scope vo
G–8SOMobjects Base Toolkit User’s Guidemethod token A value that identifies a specific method introduced by a class. A method tokenis used during me
G–9Glossaryobject request broker (ORB) See ORB.offset method resolutionThe default mechanism for performing method resolution in SOM, because itis
G–10SOMobjects Base Toolkit User’s Guideprocedure A small section of code that executes a limited, well-understood task whencalled from another progra
G–11Glossaryserver object In DSOM, every server has an object that defines methods for managingobjects in that server. These methods include object
G–12SOMobjects Base Toolkit User’s GuidesomThis Within method procedures, a local variable that points to a data structurecontaining the instance vari
X-1IndexAabstract modifier, 4-18activate_impl_failed method, 6-33Activation policies, DSOM servers, 6-64add_arg method, 6-73add_class_to_impldef metho
X-2SOMobjects base Toolkit User’s Guidememory management, 6-26method invocation, 6-25failure, 6-80object lifecycle service, 6-17, 6-63object reference
X-3IndexSOM object adapter (SOMOA class), 6-31,6-32, 6-42, 6-62, 6-65‘somdchk’ program, 6-56troubleshooting hints, 6-78tutorial example, 6-5user-suppl
X-4SOMobjects base Toolkit User’s Guideevent typesclient events, 9-2sink events, 9-2timer events, 9-2work procedure events, 9-2‘eventmsk.h’ include fi
X-5Indexparent-method calls in, 5-20somSelf usage, 5-18somThis usage, 5-19syntax of SOM Compiler output, 5-17syntax of stub procedures for initializer
2-9Tutorial for Implementing SOM Classes4) Create a client program that uses the class.Write a program “main” that creates an instance (object) of th
X-6SOMobjects base Toolkit User’s GuideMemory management customization features, 5-46SOMCalloc global variable, 5-46SOMFree global variable, 5-46SOMMa
X-7Indexmigrate, 4-22namelookup, 4-24nocall, 4-22noenv, 4-22nonstatic, 4-22nooverride, 4-22noself, 4-22object_owns_parameters, 4-23, 6-27, 6-28object_
X-8SOMobjects base Toolkit User’s GuideQualified names for a naming scope, 4-28R‘raises’ expression in method declarations, 4-15Receiving object, 3-8R
X-9Indexparent class vs metaclass, 5-5primitive SOM class objects, 5-2using with DSOM, 6-42SOM classes, customizing loading/unloading, 5-47class initi
X-10SOMobjects base Toolkit User’s Guidenon-default initializer calls, 5-30somDefaultInit method, 5-25, 5-38somDestruct method, 5-31somFree method, 5-
X-11IndexSOMFree function, 3-33, 5-46use after SOMMalloc function, 3-5, 3-7, 5-46SOMFree global variable, 5-46somFree methodcalled by somDestruct meth
X-12SOMobjects base Toolkit User’s GuideTutorial for implementing SOM classes, 2-6attribute definition, 2-13attributes vs instance variables, 2-14<
Vos remarques sur ce document / Technical publication remark formTitre / Title :Bull DPX/20 SOMobject Base Toolkit User’s Guide Nº Reférence / Refere
2-10SOMobjects Base Toolkit User’s GuideNotice that the only argument passed to the “sayHello” method by a C++ client program is theEnvironment pointe
BULL S.A. CEDOCAtelier de ReproductionFRAN–231331 Avenue Patton BP 42849005 ANGERS CEDEXFRANCE86 A2 27AQ 01ORDER REFERENCEPLACE BAR CODE IN LOWERLEFT
Utiliser les marques de découpe pour obtenir les étiquettes.Use the cut marks to get the labels.AIX86 A2 27AQ 01SOMobject BaseToolkitUser’s GuideDPX/2
2-11Tutorial for Implementing SOM Classes case WM_DESTROY: _somFree(obj); PostQuitMessage (0) ; return 0 ; } return DefWindowP
2-12SOMobjects Base Toolkit User’s GuideFile extensions for SOM filesS IDL source file:.idl for all usersS Implementation template file:.c for C, all
2-13Tutorial for Implementing SOM ClassesExample 2 — Adding an Attribute to the Hello class Example 1 introduced a class “Hello” which has a method “
2-14SOMobjects Base Toolkit User’s Guide4) Update the client program. Modify the client program so that the “_set_msg” method is invoked to initializ
2-15Tutorial for Implementing SOM ClassesAs demonstrated in this example, one disadvantage to using an instance variable is that the“get_msg” and “set
The following copyright notice protects this book under the Copyright laws of the United States and othercountries which prohibit such actions as, but
2-16SOMobjects Base Toolkit User’s GuideExample 3 — Overriding an Inherited Method An important aspect of OOP programming is the ability of a subclas
2-17Tutorial for Implementing SOM Classes2) Re-run the SOM Compiler on the updated .idl file, as before. The SOM Compiler extends theexisting implemen
2-18SOMobjects Base Toolkit User’s Guide4) Update the client program to illustrate the change (also notice the new message text):For C programmers:#in
2-19Tutorial for Implementing SOM ClassesExample 4 — Initializing a SOM Object The previous example showed how to override the method somPrintSelf, i
2-20SOMobjects Base Toolkit User’s Guide3) Customize the implementation. Here, the “msg” instance variable is set in the implementation template (r
2-21Tutorial for Implementing SOM ClassesExample 5 — Using Multiple Inheritance The “Hello” class is useful for writing messages to the screen. So th
2-22SOMobjects Base Toolkit User’s Guide(that is, in “hello.h” or “hello.xh”). Declarations that appear outside of an interface body do notappear in t
2-23Tutorial for Implementing SOM ClassesThe “switch” statement invokes the appropriate method depending on the value of the “output”attribute. Notice
2-24SOMobjects Base Toolkit User’s Guide
3-1Using SOM Classes in Client ProgramsChapter 3. Using SOM Classes in Client Programs This chapter discusses how to use SOM classes that have alrea
iiiPrefaceAbout This BookThis book accompanies the SOMobjects Base Toolkit, which consists of the base (orcore) capabilities in the System Object Mode
3-2SOMobjects Base Toolkit User’s Guide3.1 An Example Client Program Following is a C program that uses the class “Hello” (as defined in the Tutoria
3-3Using SOM Classes in Client Programs3.2 Using SOM Classes — the BasicsThis section describes the basic information needed to use SOM classes in
3-4SOMobjects Base Toolkit User’s GuideCreating instances of a class For C programmers with usage bindings, SOM provides the <className>New and
3-5Using SOM Classes in Client ProgramsFor example, the following C code uses the function HelloNewClass to create the “Hello” classobject. The argume
3-6SOMobjects Base Toolkit User’s GuideFor C++ programmers with usage bindings, instances of a class <className> can becreated with a new operat
3-7Using SOM Classes in Client ProgramsThe somRenew method invoked on the class object creates a new instance of a class using thegiven space, rather
3-8SOMobjects Base Toolkit User’s Guide(that is, an underscore followed by the method name). Arguments to the macro are the receiverof the method foll
3-9Using SOM Classes in Client ProgramsFor example, method “foo” supported by class “Bar” can be invoked as:Bar_foo(obj, somGetGlobalEnvironment(), x,
3-10SOMobjects Base Toolkit User’s GuideFor non-C/C++ programmers: To invoke a static method (that is, a method declared whendefining an OIDL or IDL
3-11Using SOM Classes in Client ProgramsIf the programmer does not know at compile time which class introduces the method to beinvoked, or if the prog
ivSOMobjects Base Toolkit User’s Guide• The appendices describe customer support-procedures and error codes, and provide thegrammar for SOM IDL. The f
3-12SOMobjects Base Toolkit User’s GuideFor C++:aVector–>setMany(somGetGlobalEnvironment(), 2, 4, 20, 12, 32, 41);C programmers must be aware that
3-13Using SOM Classes in Client ProgramsName-lookup resolution is also used to invoke dynamic methods (that is, methods that havebeen added to a class
3-14SOMobjects Base Toolkit User’s GuideSOM method procedures on OS/2 must be called with “system” linkage. On Windows, methodprocedures use the C lin
3-15Using SOM Classes in Client ProgramsDenotes “is a subclass of” classXSOMObjectclassY Following is a C++ generic procedure that uses name-lookup me
3-16SOMobjects Base Toolkit User’s Guide#include <classX.xh> // use classX’s name–lookup support// this procedure can be invoked on a target of
3-17Using SOM Classes in Client ProgramsObtaining a pointer to a method’s procedure is achieved in one of two ways, depending onwhether the method is
3-18SOMobjects Base Toolkit User’s GuideSOM_Resolve and SOM_ResolveNoCheck can only be used to obtain method proceduresfor static methods (methods th
3-19Using SOM Classes in Client ProgramsThe somGetClass method can be overridden by a class to provide enhanced or alternativesemantics for its object
3-20SOMobjects Base Toolkit User’s GuideWhen using SOM bindings for a class, these bindings define constants representing the majorand minor version n
3-21Using SOM Classes in Client ProgramsThe somFindClass method uses somLocateClassFile to get the name of the library filecontaining the class. If th
vPrefaceContentsChapter 1. Introduction to the SOMobjects Toolkit 1-1. . . . . . . . . . . . . . . . . . . . . . . . 1.1 Background 1-2. . . . . . .
3-22SOMobjects Base Toolkit User’s GuideIf the class is not packaged as a library (that is, the client program has the implementationsource code for t
3-23Using SOM Classes in Client Programs3.3 Language-neutral Methods and Functions This section describes methods, functions, and macros that client
3-24SOMobjects Base Toolkit User’s GuidesomDescendedFrom — Tests whether one class is derived from another. The re-ceiver of the method is the class t
3-25Using SOM Classes in Client ProgramssomSupportsMethod — Indicates whether instances of a given class support agiven method. The receiver of the so
3-26SOMobjects Base Toolkit User’s GuideDebugging The following macros are used to conditionally generate output for debugging. All outputgenerated
3-27Using SOM Classes in Client ProgramsSOM_Expect — The SOM_Expect macro takes as an argument a booleanexpression. If the boolean expression is FALS
3-28SOMobjects Base Toolkit User’s GuideWhen errors are encountered in client programs or user defined-classes, the following twomacros can be used to
3-29Using SOM Classes in Client ProgramsWhen an exception is detected, the “checkFlag” method must call SOMMalloc to allocate a“BAD_FLAG” structure, i
3-30SOMobjects Base Toolkit User’s GuideSetting an exception value To set an exception value in the caller’s Environment structure, a method implem
3-31Using SOM Classes in Client ProgramsExampleThe following IDL interface for a “MyObject” object (in a file called “myobject.idl”) declares a“BAD_FL
viSOMobjects Base Toolkit User’s GuideObtaining a method’s procedure pointer 3-16. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Offse
3-32SOMobjects Base Toolkit User’s Guide/* error checking procedure */boolean ErrorCheck(Environment *ev){ switch (ev._major) { case SYSTEM_EXCE
3-33Using SOM Classes in Client ProgramsThe implementation of the “checkFlag” method might contain the following error-handling code:#include ”som.h”#
3-34SOMobjects Base Toolkit User’s GuideClearing memory for the EnvironmentAny memory associated with an exception in an Environment structure is typi
3-35Using SOM Classes in Client ProgramssomTotalRegIds — Finds the total number of somIds that have been regis-tered, as an unsigned long. This func
3-36SOMobjects Base Toolkit User’s Guide
4-1SOM IDL and the SOM CompilerChapter 4. SOM IDL and the SOM CompilerThis chapter first discusses how to define SOM classes and then describes the S
4-2SOMobjects Base Toolkit User’s Guide4.1 Interface vs Implementation The interface to a class of objects contains the information that a client m
4-3SOM IDL and the SOM Compiler4.2 SOM Interface Definition Language This section describes the syntax of SOM’s Interface Definition Language (SOM I
4-4SOMobjects Base Toolkit User’s GuideTable 1. KEYWORDS FOR SOM IDLanyattributebooleancasecharclassconstcontextdefaultdoubleenumexceptionFALSEfloati
4-5SOM IDL and the SOM CompilerCharacter type IDL supports a char type, which represents an 8-bit quantity. The ISO Latin-1 (8859.1) charac-ter set d
viiPrefaceMethod (operation) declarations 4-14. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Oneway keyword 4-14. .
4-6SOMobjects Base Toolkit User’s GuideThe valid IDL struct and enum definitions shown above are translated by the SOM Compilerinto the following defi
4-7SOM IDL and the SOM CompilerIn the SOM documentation and samples, both long and short forms are illustrated, for both typenames and method calls. I
4-8SOMobjects Base Toolkit User’s GuideTemplate types (sequences and strings) IDL defines two template types not found in C and C++: sequences and st
4-9SOM IDL and the SOM CompilerIf the typedef is for a pointer type, then the effective type is the name of the pointer type. Forexample, the followin
4-10SOMobjects Base Toolkit User’s GuideHowever, in a C++ program, the following declaration is required:Foo *myobj;If a C programmer uses the SOM Com
4-11SOM IDL and the SOM CompilerThus, the ex_BAD_FLAG symbol can be used as a shorthand for naming the exception.An exception declaration within an in
4-12SOMobjects Base Toolkit User’s GuideTable 2. STANDARD EXCEPTIONS DEFINED BY CORBA module StExcep {#define ex_body { unsigned long minor; complet
4-13SOM IDL and the SOM CompilerConstant, type, and exception declarations The form of a constant, type, or exception declaration within the body of
4-14SOMobjects Base Toolkit User’s GuideNote: Although the preceding attribute declarations are equivalent to the explicit methoddeclarations above, t
4-15SOM IDL and the SOM CompilerClasses derived from SOMObject can declare methods that take a pointer to a block ofmemory containing a variable numbe
Comentarios a estos manuales