• Nenhum resultado encontrado

Persistence Directives and ODA-Generated Functions

ODA persistence directives are implemented as C++ macros. A set of macros, shown in Figure 3.2, is used in the case in the case of IDL interfaces not encompassed by any module. Another set of macros, shown in Figure 3.3, is used in the case of interfaces defined within a module.

ODA def server(interf,impl) ODA def persistent(interf,impl) ODA def activated(interf,impl)

Figure 3.2: ODA macros used for interfaces not encompassed by any module.

ODA Def Server(module,interf,impl) ODA Def Persistent(module,interf,impl) ODA Def Activated(module,interf,impl)

Figure 3.3: ODA macros used for interfaces defined within a module.

Each of these directives declares/defines ODA-generated functions. In what fol-lows, ODA-generated functions are examined together with the corresponding persis-tence directive.

ODA persistence directives expand into declarations/definitions of ODA-generated classes and functions. While the declarations may appear in many source files, the definitions should appear just once in all source files. If the symbol ODA DEFS is

#defined by the time oda.h is included, these directives expand into declarations and definitions. Otherwise they expand into declarations only. A persistence directive may — and usually will — be visible to several source files, typically through the inclusion of a header file that contains the directive. One and only one of these source files must #define ODA DEFS before including oda.h.

3.2.1 ODA def server

ODA def server(interf,impl)

C++ macro that “ties together” the interface class and the implementation class of the top-level object in a server. Used for IDL interfaces not encompassed by any module. Its expansion generates the following “tie class”:

class oda interf impl server { public:

odainterf impl server(impl* p);

...

virtual void* deref();

private:

...

};

Application code should avoid any dependence on the name of the tie class above, the ODA-generated identifier oda interf impl server. The macro call

ODA server(interf,impl)

expands into this identifier, and should be used instead.

ODA def server-Generated Functions

ODA server(interf,impl)(impl* p);

Constructor of the tie class ODA server(interf,impl). Note that this con-structor is public. The server mainline should use it to create the top-level server object, an instance of this class, before it calls impl is ready.

void* deref();

Member function of the ODA-generated tie class. Returns the address of the corresponding implementation object.

3.2.2 ODA def persistent

ODA def persistent(interf,impl)

C++ macro that “ties together” the interface and implementation classes of persistent CORBA objects. Used for IDL interfaces not encompassed by any module. Its expansion generates the following “tie class”:

class oda persistentinterf { public:

...

virtual void* deref();

private:

...

};

interf ptr ODA persistentinterf(impl* p);

Application code should avoid any dependence on the name of the tie class above.

ODA def persistent-Generated Functions

void* deref();

Member function of the ODA-generated tie class. Returns the address of the corresponding implementation object.

interf ptr ODA persistent interf(impl* p);

Returns a reference to a persistent CORBA object (whose interface class is interf), given a pointer to its implementation object (of class impl).

The constructor of the ODA-generated tie class is not public. Instances of this class are managed by the ODA and cannot be created by the application code.

3.2.3 ODA def activated

ODA def activated(interf,impl)

C++ macro that “ties together” the interface and implementation classes of ODA-activated CORBA objects. Used for IDL interfaces not encompassed by any module.

Its expansion generates the following “tie class”:

class oda activatedinterf { public:

...

virtual void* deref();

private:

...

};

interf ptr ODA activatedinterf(impl* p);

interf ptr ODA activatedinterf(long keyval);

Application code should avoid any dependence on the name of the tie class above.

ODA-Activated Implementation Classes

An implementation class passed as the impl parameter to ODA def activated must haveODA::Activated as a public base class, and must redefine the following functions inherited from ODA::Activated:

CORBA::ULong _key();

char* _id();

static void* _activate(const char* id);

See details in pages 32–34.

Functions Generated by ODA def activated

void* deref();

Member function of the ODA-generated tie class. Returns the address of the corresponding implementation object.

interf ptr ODA activated interf(impl* p);

Returns a reference to an ODA-activated CORBA object (whose interface class is interf), given a pointer to its implementation object (of classimpl).

interf ptr ODA activated interf(long keyval);

Returns a reference to an ODA-activated CORBA object (whose interface class is interf), given the key to its implementation object (of class impl). Returns a null pointer if no active instance of the implementation class has this key value.

The constructor of the ODA-generated tie class is not public. Instances of this class are managed by the ODA and cannot be created by the application code.

3.2.4 ODA Def Server

ODA Def Server(module,interf,impl)

C++ macro that “ties together” the interface class and the implementation class of the top-level object in a server. Used for IDL interfaces defined within a module. Its expansion generates the following “tie class”:

class oda module interf impl server { public:

odamodule interf impl server(impl* p);

...

virtual void* deref();

private:

...

};

Application code should avoid any dependence on the name of the tie class above, the ODA-generated identifier oda module interf impl server. The macro call

ODA Server(module,interf,impl)

expands into this identifier, and should be used instead.

ODA Def Server-Generated Functions

ODA Server(module,interf,impl)(impl* p);

Constructor of the tie classODA Server(module,interf,impl). Note that this constructor is public. The server mainline should use it to create the top-level server object, an instance of this class, before it calls impl is ready.

void* deref();

Member function of the ODA-generated tie class. Returns the address of the corresponding implementation object.

3.2.5 ODA Def Persistent

ODA Def Persistent(module,interf,impl)

C++ macro that “ties together” the interface and implementation classes of persistent CORBA objects. Used for IDL interfaces defined within a module. Its expansion generates the following “tie class”:

class oda persistentmodule interf { public:

...

virtual void* deref();

private:

...

};

interf ptr ODA persistentmodule interf(impl* p);

Application code should avoid any dependence on the name of the tie class above.

ODA Def Persistent-Generated Functions

void* deref();

Member function of the ODA-generated tie class. Returns the address of the corresponding implementation object.

interf ptr ODA persistent module interf(impl* p);

Returns a reference to a persistent CORBA object (whose interface class is interf), given a pointer to its implementation object (of class impl).

The constructor of the ODA-generated tie class is not public. Instances of this class are managed by the ODA and cannot be created by the application code.

3.2.6 ODA Def Activated

ODA Def Activated(module,interf,impl)

C++ macro that “ties together” the interface and implementation classes of ODA-activated CORBA objects. Used for IDL interfaces defined within a module. Its expansion generates the following “tie class”:

class oda activatedmodule interf { public:

...

virtual void* deref();

private:

...

};

interf ptr ODA activatedmodule interf(impl* p);

interf ptr ODA activatedmodule interf(long keyval);

Application code should avoid any dependence on the name of the tie class above.

ODA-Activated Implementation Classes

An implementation class passed as the impl parameter to ODA Def Activated must haveODA::Activated as a public base class, and must redefine the following functions inherited from ODA::Activated:

CORBA::ULong _key();

char* _id();

static void* _activate(const char* id);

See details in pages 32–34.

Functions Generated by ODA Def Activated

void* deref();

Member function of the ODA-generated tie class. Returns the address of the corresponding implementation object.

interf ptr ODA activated module interf(impl* p);

Returns a reference to an ODA-activated CORBA object (whose interface class is interf), given a pointer to its implementation object (of classimpl).

interf ptr ODA activated module interf(long keyval);

Returns a reference to an ODA-activated CORBA object (whose interface class is interf), given the key to its implementation object (of class impl). Returns a null pointer if no active instance of the implementation class has this key value.

The constructor of the ODA-generated tie class is not public. Instances of this class are managed by the ODA and cannot be created by the application code.

Documentos relacionados