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( 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( 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( 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.
{ return new os_typespec("KEYTYPE"); }
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( 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.
To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.
os_index( class, member)class is the class defining the os_backptr data member.
member is the name of the os_backptr member.
To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.
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. 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.
To use ObjectStore's collection facility, you must include the file <ostore/coll.hh> after including <ostore/ostore.hh>.
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. 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.
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.
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.
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( 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( class, func, return_ type, bpname)where
os_query_function_returning_ref( class, func, return_type)where
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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; ... };
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.
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; ... };
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.
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.
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; ... };
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.
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; ... };
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.
Updated: 03/31/98 15:57:54