company logo

Property :: minus - Subtract collections

The result collection contains all instances that exist in the first but not in the second operand collection. The existence of an instance in a collection can be checked based on a access key (passing true for bSortKey) or on local identities (LOID). Using the LOID is save but comparing the key is much faster. Hence, the key check should be used whenever possible.

The function throws an exception, when operands passed are invalid or when keys are not comparable (bSortKey=true).

Return value:  Result property handle ( odaba::Property & )

Reference to the property handle that contains the result of an operation. Note that invalid properties may cause exceptions.

Implementation overview

Implementation details

  1. Create minus result in first collection
    odaba::Property & Property  :: minus ( odaba::Property &cProperty, bool bSortKey )

    The function creates the difference between the calling and the passed collection and stores the result in the calling collection, i.e. all instances in the current collection, which do exist in the operand property, will be removed.

    • cProperty - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • bSortKey - Sort key option

      The sort key option indicates whether the operation should be performed according to the sort key set for the collections (true). Otherwise (false) the operation is performed by comparing instances.

  2. to list
  3. Subtract two collections
    odaba::Property & Property  :: minus ( odaba::Property &cProperty1, odaba::Property &cProperty2, bool bSortKey )

    The function stores the difference between first and second operand in the collection handled by the current property handle.

    When the current property handle refers to a non empty collection, all instances are removed before performing the operation. When the calling property handle is not opened (invalid), the function creates a temporary extend for storing the result.

    • cProperty1 - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • cProperty2 - Property reference

      A property handle refers to a (usually) opened property. Invalid properties may cause an exception.

    • bSortKey - Sort key option

      The sort key option indicates whether the operation should be performed according to the sort key set for the collections (true). Otherwise (false) the operation is performed by comparing instances.

  4. to list