ObjectStore Collections C++ API Reference

Chapter 4

Macros and User-Defined Functions

Dictionary macros
Index and query macros
Relationship macros

OS_MARK_DICTIONARY()

If you use persistent dictionaries, or any combination of persistent and transient dictionaries, you must call the macro OS_MARK_DICTIONARY() for each key-type/element-type pair that you use.

Form of the call
OS_MARK_DICTIONARY( key_type,  element_type)
Put these calls in the same function with your calls to OS_MARK_SCHEMA_TYPE(). For example:

/*** schema.cc ***/
#include <ostore/ostore.hh>
#include <ostore/coll.hh>
#include <ostore/coll/dict_pt.hh>
#include <ostore/manschem.hh>
#include "dnary.hh"
      OS_MARK_DICTIONARY(void*,Course*);
      OS_MARK_DICTIONARY(int,Employee**);
      OS_MARK_SCHEMA_TYPE(Course);
      OS_MARK_SCHEMA_TYPE(Employee);
      OS_MARK_SCHEMA_TYPE(Department);
For pointer keys, specify void* as the key_type.

For class keys, the class must have a destructor, and you must register rank and hash functions for the class.

If you use transient dictionaries, you must call the macro OS_TRANSIENT_DICTIONARY(). The arguments are the same as for OS_MARK_DICTIONARY(), but you call OS_TRANSIENT_DICTIONARY() at file scope in an application source file, rather than at function scope in a schema source file.

OS_MARK_QUERY_FUNCTION()

Applications that use a member function in a query or path string must call this macro.

Form of the call
      OS_MARK_QUERY_FUNCTION( class, func)
class is the name of the class that defines the member function.

func is the name of the member function itself.

The OS_MARK_QUERY_FUNCTION() macro should be invoked along with the OS_MARK_SCHEMA_TYPE() macros for an application's schema, that is, in the schema source file. No white space should appear in the argument list of OS_MARK_QUERY_FUNCTION().

OS_MARK_RDICTIONARY()

If you use reference-based persistent dictionaries, or any combination of persistent and transient dictionaries, you must call the macro OS_MARK_RDICTIONARY() for each key-type/element-type/reference-type triplet that you use.

Form of the call
OS_MARK_RDICTIONARY( key_type,  element_type,  reference_type)
Put these calls in the same function with your calls to OS_MARK_SCHEMA_TYPE(). For example:

/*** schema.cc ***/
#include <ostore/ostore.hh>
#include <ostore/coll.hh>
#include <ostore/coll/rdict_pt.hh>
#include <ostore/manschem.hh>
#include "dnary.hh"
      OS_MARK_RDICTIONARY(void*,Course*,os_reference);
      OS_MARK_RDICTIONARY(int,Employee**,os_reference);
      OS_MARK_SCHEMA_TYPE(Course);
      OS_MARK_SCHEMA_TYPE(Employee);
      OS_MARK_SCHEMA_TYPE(Department);
For pointer keys, specify void* as the key_type.

For class keys, the class must have a destructor, and you must register rank and hash functions for the class.

For reference_type, specify os_reference.

OS_TRANSIENT_DICTIONARY()

If you use only transient dictionaries, you must call the macro OS_TRANSIENT_DICTIONARY() for each key-type/element-type pair that you use. This is true unless there are ObjectStore dictionaries with the same key marked persistently. In this case the macro is not needed and its use produces error messages at link time.

Form of the call
OS_TRANSIENT_DICTIONARY( key_type,  element_type)
Here are some examples:

OS_TRANSIENT_DICTIONARY(void*,Course*);
OS_TRANSIENT_DICTIONARY(int,Employee**);
Put these calls at file scope in an application source file.

For pointer keys, specify void* as the key_type.

For class keys, the class must have an operator= and a destructor that zeroes out any pointers in the key object.

If a transient os_Dictionary is instantiated and OS_TRANSIENT_DICTIONARY is missing, _Rhash_pt<KEYTYPE>::get_os_typespec() and _Dict_pt_slot<KEYTYPE>::get_os_typespec() are undefined at link time.

Using user-defined classes
In order to use a user-defined class as a key you must have get_os_typespec() declared and defined as follows, where KEYTYPE is the name of the user-defined class:

      { return new os_typespec("KEYTYPE"); }

OS_TRANSIENT_DICTIONARY_NOKEY()

If you use only transient dictionaries, you must call the macro OS_TRANSIENT_DICTIONARY_NOKEY() in certain cases where you have more than one dictionary defined with the same key type.

Form of the call
OS_TRANSIENT_DICTIONARY_NOKEY( element_type)
OS_TRANSIENT_DICTIONARY defines stubs for get_os_typespec() member functions of internal data structures parameterized by either the key type and the value type, or by just the key type. If you have in your application more than one dictionary with the same key type, specifying OS_TRANSIENT_DICTIONARY multiple times will result in multiply defined symbols at link time. Instead, use OS_TRANSIENT_DICTIONARY_NOKEY, which defines just the get_os_typespec() functions for internal data structures parameterized by both the key and value type.

For example, if you had

      os_Dictionary<int, Object1*> d1;
      os_Dictionary<int, Object2*> d2;
You would use

OS_TRANSIENT_DICTIONARY(int, Object1*);
OS_TRANSIENT_DICTIONARY_NOKEY(int, Object2*); 
Put these calls at file scope in an application source file.

For pointer keys, specify void* as the key_type.

For class keys, the class must have a destructor.

If the user-defined class being used as a key does not have get_os_typespec() declared, then the internal function os_dk_wrapper<KEYTYPE>::_type() (defined in dkey.hh) will complain about KEYTYPE::get_os_typespec()'s not being declared. If get_os_typespec() is declared but undefined, an unresolved reference link error will occur. Therefore, get_os_typespec() should be defined as the following, where KEYTYPE is the name of the user-defined class:

      { return new os_typespec("KEYTYPE") ; }

OS_TRANSIENT_RDICTIONARY()

If you use reference-based transient dictionaries (the os_rDdictionaries class), you must call the macro OS_TRANSIENT_RDICTIONARY() for each key-type/element-type/reference-type triplet that you use.

Form of the call
OS_TRANSIENT_RDICTIONARY( key_type,  element_type,  reference_
type)
Here are some examples:

OS_TRANSIENT_RDICTIONARY(void*,Course*,os_reference);
OS_TRANSIENT_RDICTIONARY(int,Employee**,os_reference);
Put these calls at file scope in an application source file.

For pointer keys, specify void* as the key_type.

For class keys, the class must have a destructor.

os_index()

This macro is used to designate a class's os_backptr-valued member when calling make_link() and break_link() or when defining indexable members. The os_backptr member is used to establish other members of the class as indexable. Bit-field members cannot be indexable.

To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.

Form of the call
os_index( class, member)
class is the class defining the os_backptr data member.

member is the name of the os_backptr member.

Caution
The macro arguments are used (among other things) to concatenate unique names. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_index_key()

This macro is used to register user-defined rank and hash functions with ObjectStore.

To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.

Form of the call
os_index_key( class, rank_function, hash_function)
This macro must be within the scope of any query or cursor that might need the rank or hash functions.

class is the class whose instances are ranked or hashed by the specified functions.

rank_function is a user-defined function that, for any pair of instances of class, provides an ordering indicator for the instances, much as strcmp does for arrays of characters. You must supply this function. The rank function should return one of os_collection::LT, os_collection::GT, or os_collection::EQ. In ObjectStore Advanced C++ API User Guide see Rank and Hash Function Requirements.

hash_function is a user-defined function that, for each instance of class, returns a value, an os_unsigned_int32, that can be used as a key in a hash table. Supplying this function is optional. If you do not supplying a hash function for the class, specify 0 as the hash function argument.

Caution
The macro arguments are used (among other things) to concatenate unique names. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_index_key_hash_function()

This macro is used to register user-defined hash functions with ObjectStore. Use it only to replace a hash function registered previously.

To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.

Form of the call
os_index_key_hash_function( class, hash_function)
This macro must be within the scope of any query or cursor that might need the rank or hash functions.

class is the class whose instances are hashed by the specified function.

hash_function is a user-defined function that, for each instance of class, returns a value, an os_unsigned_int32, that can be used as a key in a hash table.

Caution
The macro arguments are used (among other things) to concatenate unique names. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_index_key_rank_function()

This macro is used to register user-defined rank functions with ObjectStore. Use it only to replace a rank function registered previously.

To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.

Form of the call
os_index_key_rank_function( class, rank_function)
This macro must be within the scope of any query or cursor that might need the rank or hash functions.

class is the class whose instances are ranked by the specified function. class can also be char* when registering os_strcoll_for_char_pointer(), and char[] when registering os_strcoll_for_char_array(). These versions of strcoll(), provided by ObjectStore, will be used, if registered, instead of strcmp() to support indexes keyed by char* or char[].

rank_function is a user-defined function that, for any pair of instances of class, provides an ordering indicator for the instances, much as strcmp does for arrays of characters. The rank function should return one of os_collection::LT, os_collection::GT, or os_collection::EQ. In ObjectStore Advanced C++ API User Guide see Rank and Hash Function Requirements.

Caution
The macro arguments are used (among other things) to concatenate unique names. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_indexable_body()

This macro is used to instantiate accessor functions for an indexable data member. Calls to this macro should appear at top level in the source file associated with the class defining the member.

To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh>.

The actual value type of an indexable data member is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value) and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the indexable member's apparent value explicitly.

Form of the call
os_indexable_body( class, member, value_type, index)
class is the class defining the data member being declared.

member is the name of the member being declared.

value_type is the (apparent) value type of the indexable member.

index is a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

Caution
The first three macro arguments are used (among other things) to concatenate unique names for the encapsulating class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_indexable_member()

This macro is used to establish a data member as indexable in order to perform automatic index maintenance. Field members cannot be indexable.

To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.

The macro call is used instead of the value type in the member declaration.

class  class-name 
{
      ...
       macro-call member-name; 
      ...
};
The actual value type of an indexable data member is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value) and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the indexable member's apparent value explicitly.

Form of the call
os_indexable_member( class, member, value_type)
class is the class defining the data member being declared.

member is the name of the member being declared.

value_type is the (apparent) value type of the member being declared.

Caution
The first two macro arguments are used (among other things) to concatenate unique names for the encapsulating class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_query_function()

Applications that use a member function (which does or does not return a reference) in a query or path string must call this macro.

Form of the call
os_query_function( class, func, return_type)
class is the name of the class defining the member function.

func is the name of the member function itself.

return_type names the type of value returned by the member function.

The os_query_function() macro should be invoked at module level in a header file (for example, the file containing the definition of the class that declares the member function). No white space should appear in the argument list.

os_query_function_body()

Applications that use a member function in a query or path string must call this macro.

Form of the call
os_query_function_body( class, func, return_type, bpname)
class is the name of the class that defines the member function.

func is the name of the member function itself.

return_type names the type of value returned by the member function.

bpname is the name of the os_backptr-valued member of class.

The os_query_function_body() macro should be invoked at module level in a source file (for example, the file containing the definition of the member function). No white space should appear in the argument list.

os_query_function_body_returning_ref()

This macro enables users to register a query function that returns a reference. The application that uses this member function in a query must call os_query_function_body_returning_ref().

Form of the call
os_query_function_body_returning_ref( class, func, return_
type, bpname)
where

os_query_function_returning_ref()

The application that uses this member function, returning a reference, in a query must call os_query_function_returning_ref(). A call to this macro has the form

Form of the call
os_query_function_returning_ref( class, func, return_type)
where

os_rel_1_1_body()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh>. If you also include <ostore/coll.hh>, include <ostore/relat.hh> after both <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a single-valued data member with a single-valued inverse data member. Calls to this macro should appear at top level in a source file associated with the class defining the member.

Form of the call
os_rel_1_1_body( class, member, inv_class, inv_mem)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

Caution
The macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_rel_1_m_body()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a single-valued data member with a many-valued inverse data member. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_1_m_body( class, member, inv_class, inv_mem)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

Caution
The macro arguments are used (among other things) to concatenate unique names for the embedded relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_rel_m_1_body()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a many-valued data member with a single-valued inverse data member. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_m_1_body( class, member, inv_class, inv_mem)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

Caution
The macro arguments are used (among other things) to concatenate unique names for the embedded relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_rel_m_m_body()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a many-valued data member with a many-valued inverse data member. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_m_m_body( class, member, inv_class, inv_mem)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

Caution
The macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly.

os_rel_1_1_body_options()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh>. If you also include <ostore/coll.hh>, include <ostore/relat.hh> after both <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a single-valued data member with a single-valued inverse data member, when deletion propagation is desired or when either member is indexable. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_1_1_body_options( class, member, inv_class, inv_mem, 
       deletion,  index,  inv_index)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

deletion is either os_rel_propagate_delete or os_rel_dont_propagate_delete. By default, deleting an object that participates in a relationship automatically updates the other side of the relationship, so that there are no dangling pointers to the deleted object. In some cases, however, the desired behavior is actually to delete the object on the other side of the relationship (for example, for subsidiary component objects). This behavior is specified with os_rel_propagate_delete.

index specifies whether the current member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

inv_index specifies whether the inverse member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

os_rel_1_m_body_options()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a single-valued data member with a many-valued inverse data member, when deletion propagation is desired or when either member is indexable. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_1_m_body_options( class, member, inv_class, inv_mem,
       deletion,  index,  inv_index)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

deletion is either os_rel_propagate_delete or os_rel_dont_propagate_delete. By default, deleting an object that participates in a relationship automatically updates the other side of the relationship so that there are no dangling pointers to the deleted object. In some cases, however, the desired behavior is actually to delete the object on the other side of the relationship (for example, for subsidiary component objects). This behavior is specified with os_rel_propagate_delete.

index specifies whether the current member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

inv_index specifies whether the inverse member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

os_rel_m_1_body_options()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a many-valued data member with a single-valued inverse data member, when deletion propagation is desired or when either member is indexable. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_m_1_body_options( class, member, inv_class, inv_mem,
       deletion,  index,  inv_index)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

deletion is either os_rel_propagate_delete or os_rel_dont_propagate_delete. By default, deleting an object that participates in a relationship automatically updates the other side of the relationship so that there are no dangling pointers to the deleted object. In some cases, however, the desired behavior is actually to delete the object on the other side of the relationship (for example, for subsidiary component objects). This behavior is specified with os_rel_propagate_delete.

index specifies whether the current member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

inv_index specifies whether the inverse member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

os_rel_m_m_body_options()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to instantiate accessor functions for a many-valued data member with a many-valued inverse data member, when deletion propagation is desired or when either member is indexable. Calls to this macro should appear at top level in the source file associated with the class defining the member.

Form of the call
os_rel_m_m_body_options( class, member, inv_class, inv_mem,
       deletion,  index,  inv_index)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

deletion is either os_rel_propagate_delete or os_rel_dont_propagate_delete. By default, deleting an object that participates in a relationship automatically updates the other side of the relationship so that there are no dangling pointers to the deleted object. In some cases, however, the desired behavior is actually to delete the object on the other side of the relationship (for example, for subsidiary component objects). This behavior is specified with os_rel_propagate_delete.

index specifies whether the current member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member, or use os_auto_index.

inv_index specifies whether the inverse member is indexable. For nonindexable members, use os_no_index. For indexable members, use a call to the macro os_index(), indicating the name of the defining class's os_backptr member, or use os_auto_index.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

os_relationship_1_1()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh>. If you also include <ostore/coll.hh>, include <ostore/relat.hh> after both <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to declare a single-valued data member with a single-valued inverse data member. The macro call is used instead of the value type in the member declaration.

class  class-name 
{
      ...
       macro-call member-name;
      ...
};
Form of the call
os_relationship_1_1( class, member, inv_class, inv_mem, value_type)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

value_type is the value type of the member being declared.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

os_relationship_1_m()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to declare a single-valued data member with a many-valued inverse data member. The macro call is used instead of the value type in the member declaration.

class  class-name 
{
      ...
       macro-call member-name;
      ...
};
Form of the call
os_relationship_1_m( class, member, inv_class, inv_mem, value_type)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

value_type is the value type of the member being declared.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

OS_RELATIONSHIP_LINKAGE()

Windows platforms
Specifies the linkage for classes generated by the os_relationship_xxx macros. This macro can be used with component schema on Windows platforms. For example, you could define the macro as Microsoft's __declspec(dllexport), which allows one DLL to create a subclass of a class defined in another DLL when there are relationship members.

You must define OS_RELATIONSHIP_LINKAGE before including <ostore/relat.hh>. For example:

...
#define OS_RELATIONSHIP_MACRO __declspec(dllexport)
#include <ostore/relat.hh>
If not defined, the default is blank.

os_relationship_m_1()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to declare a many-valued data member with a single-valued inverse data member. The macro call is used instead of the value type in the member declaration.

class  class-name 
{
      ...
       macro-call member-name;
      ...
};
Form of the call
os_relationship_m_1( class, member, inv_class, inv_mem, value_type)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

value_type is the value type of the member being declared.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.

os_relationship_m_m()

ObjectStore allows the user to model binary relationships with pointer-valued (or collection-of-pointer-valued) data members that maintain the referential integrity of their inverse data members. You implement this inverse maintenance by defining an embedded relationship class, which encapsulates the pointer (or collection-of-pointer) so that it can intercept updates to the encapsulated value and perform the necessary inverse maintenance tasks.

Required include files
To use this macro, you must include the file <ostore/relat.hh> after including <ostore/ostore.hh> and <ostore/coll.hh>.

The actual value type of a data member with an inverse is a special class whose instances encapsulate the member's apparent value. This implicitly defined class defines operator =() (for setting the apparent value), as well as operator ->(), operator *(), and a conversion operator for converting its instances to instances of the apparent value type (for getting the apparent value). Under most circumstances these operators make the encapsulating objects transparent.

The implicitly defined class also defines the member functions getvalue(), which returns the apparent value, and setvalue(), which takes an instance of the apparent value type as argument. These functions can always be used to set and get the member's apparent value explicitly.

This macro is used to declare a many-valued data member with a many-valued inverse data member. The macro call is used instead of the value type in the member declaration.

class  class-name 
{
      ...
       macro-call member-name;
      ...
};
Form of the call
os_relationship_m_m( class, member, inv_class, inv_mem, value_type)
class is the class defining the data member being declared.

member is the name of the member being declared.

inv_class is the name of the class that defines the inverse member.

inv_mem is the name of the inverse member.

value_type is the value type of the member being declared.

Caution
The first four macro arguments are used (among other things) to concatenate unique names for the encapsulating relationship class and its accessor functions. The details of macro preprocessing differ from compiler to compiler, and in some cases it is necessary to enter these macro arguments without white space to ensure that the argument concatenation will work correctly. There should be no white space in the argument list between the opening parenthesis and the comma separating the fourth and fifth arguments.



[previous] [next]

Copyright © 1997 Object Design, Inc. All rights reserved.

Updated: 03/31/98 15:57:54