Open CASCADE Technology 7.9.0
NCollection_MapAlgo Namespace Reference

This namespace contains algorithms and utilities for managing NCollection_Map. More...

Functions

template<class MapType>
void Union (MapType &theMap, const MapType &theLeftMap, const MapType &theRightMap)
 Sets this Map to be the result of union (aka addition, fuse, merge, boolean OR) operation between two given Maps. The new Map contains the values that are contained either in the first map or in the second map or in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be passed as one of operands.
 
template<class MapType>
bool Unite (MapType &theMap, const MapType &theOtherMap)
 Apply to this Map the boolean operation union (aka addition, fuse, merge, boolean OR) with another (given) Map. The result contains the values that were previously contained in this map or contained in the given (operand) map. This algorithm is similar to method Union(). Returns True if contents of this map is changed.
 
template<class MapType>
bool HasIntersection (const MapType &theMap, const MapType &theOtherMap)
 Returns true if this and theMap have common elements.
 
template<class MapType>
void Intersection (MapType &theMap, const MapType &theLeftMap, const MapType &theRightMap)
 Sets this Map to be the result of intersection (aka multiplication, common, boolean AND) operation between two given Maps. The new Map contains only the values that are contained in both map operands. All previous content of this Map is cleared. This same map (result of the boolean operation) can also be used as one of operands.
 
template<class MapType>
bool Intersect (MapType &theMap, const MapType &theOtherMap)
 Apply to this Map the intersection operation (aka multiplication, common, boolean AND) with another (given) Map. The result contains only the values that are contained in both this and the given maps. This algorithm is similar to method Intersection(). Returns True if contents of this map is changed.
 
template<class MapType>
bool Subtract (MapType &theMap, const MapType &theOtherMap)
 Apply to this Map the subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation with another (given) Map. The result contains only the values that were previously contained in this map and not contained in this map. This algorithm is similar to method Subtract() with two operands. Returns True if contents of this map is changed.
 
template<class MapType>
void Subtraction (MapType &theMap, const MapType &theLeftMap, const MapType &theRightMap)
 Sets this Map to be the result of subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation between two given Maps. The new Map contains only the values that are contained in the first map operands and not contained in the second one. All previous content of this Map is cleared.
 
template<class MapType>
void Difference (MapType &theMap, const MapType &theLeftMap, const MapType &theRightMap)
 Sets this Map to be the result of symmetric difference (aka exclusive disjunction, boolean XOR) operation between two given Maps. The new Map contains the values that are contained only in the first or the second operand maps but not in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be used as one of operands.
 
template<class MapType>
bool Differ (MapType &theMap, const MapType &theOtherMap)
 Apply to this Map the symmetric difference (aka exclusive disjunction, boolean XOR) operation with another (given) Map. The result contains the values that are contained only in this or the operand map, but not in both. This algorithm is similar to method Difference(). Returns True if contents of this map is changed.
 
template<class MapType>
bool Contains (const MapType &theMap, const MapType &theOtherMap)
 Checks if this map contains all keys of another map. This function checks if theMap contains all keys of theOtherMap. It first checks if the two maps are the same instance or if theOtherMap is empty, in which case it returns true. Then it compares the number of elements in both maps. If theMap has fewer elements than theOtherMap, it returns false. Finally, it iterates through all keys in theOtherMap and checks if each key is present in theMap.
 
template<class MapType>
bool IsEqual (const MapType &theMap, const MapType &theOtherMap)
 Checks if two maps contain exactly the same keys. This function compares the keys of two maps and returns true if they contain exactly the same keys. It first checks if the two maps are the same instance, in which case it returns true. Then it compares the number of elements in both maps. If they are equal, it calls the Contains function to check if all keys in theOtherMap are present in theMap.
 

Detailed Description

This namespace contains algorithms and utilities for managing NCollection_Map.

The NCollection_MapAlgo namespace provides a set of template functions that facilitate the manipulation and management of NCollection_Map instances. These algorithms are designed to be efficient and easy to use, providing common operations such as union, intersection, subtraction, and symmetric difference on map collections.

Function Documentation

◆ Contains()

template<class MapType>
bool NCollection_MapAlgo::Contains ( const MapType & theMap,
const MapType & theOtherMap )

Checks if this map contains all keys of another map. This function checks if theMap contains all keys of theOtherMap. It first checks if the two maps are the same instance or if theOtherMap is empty, in which case it returns true. Then it compares the number of elements in both maps. If theMap has fewer elements than theOtherMap, it returns false. Finally, it iterates through all keys in theOtherMap and checks if each key is present in theMap.

◆ Differ()

template<class MapType>
bool NCollection_MapAlgo::Differ ( MapType & theMap,
const MapType & theOtherMap )

Apply to this Map the symmetric difference (aka exclusive disjunction, boolean XOR) operation with another (given) Map. The result contains the values that are contained only in this or the operand map, but not in both. This algorithm is similar to method Difference(). Returns True if contents of this map is changed.

◆ Difference()

template<class MapType>
void NCollection_MapAlgo::Difference ( MapType & theMap,
const MapType & theLeftMap,
const MapType & theRightMap )

Sets this Map to be the result of symmetric difference (aka exclusive disjunction, boolean XOR) operation between two given Maps. The new Map contains the values that are contained only in the first or the second operand maps but not in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be used as one of operands.

◆ HasIntersection()

template<class MapType>
bool NCollection_MapAlgo::HasIntersection ( const MapType & theMap,
const MapType & theOtherMap )

Returns true if this and theMap have common elements.

◆ Intersect()

template<class MapType>
bool NCollection_MapAlgo::Intersect ( MapType & theMap,
const MapType & theOtherMap )

Apply to this Map the intersection operation (aka multiplication, common, boolean AND) with another (given) Map. The result contains only the values that are contained in both this and the given maps. This algorithm is similar to method Intersection(). Returns True if contents of this map is changed.

◆ Intersection()

template<class MapType>
void NCollection_MapAlgo::Intersection ( MapType & theMap,
const MapType & theLeftMap,
const MapType & theRightMap )

Sets this Map to be the result of intersection (aka multiplication, common, boolean AND) operation between two given Maps. The new Map contains only the values that are contained in both map operands. All previous content of this Map is cleared. This same map (result of the boolean operation) can also be used as one of operands.

◆ IsEqual()

template<class MapType>
bool NCollection_MapAlgo::IsEqual ( const MapType & theMap,
const MapType & theOtherMap )

Checks if two maps contain exactly the same keys. This function compares the keys of two maps and returns true if they contain exactly the same keys. It first checks if the two maps are the same instance, in which case it returns true. Then it compares the number of elements in both maps. If they are equal, it calls the Contains function to check if all keys in theOtherMap are present in theMap.

◆ Subtract()

template<class MapType>
bool NCollection_MapAlgo::Subtract ( MapType & theMap,
const MapType & theOtherMap )

Apply to this Map the subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation with another (given) Map. The result contains only the values that were previously contained in this map and not contained in this map. This algorithm is similar to method Subtract() with two operands. Returns True if contents of this map is changed.

◆ Subtraction()

template<class MapType>
void NCollection_MapAlgo::Subtraction ( MapType & theMap,
const MapType & theLeftMap,
const MapType & theRightMap )

Sets this Map to be the result of subtraction (aka set-theoretic difference, relative complement, exclude, cut, boolean NOT) operation between two given Maps. The new Map contains only the values that are contained in the first map operands and not contained in the second one. All previous content of this Map is cleared.

◆ Union()

template<class MapType>
void NCollection_MapAlgo::Union ( MapType & theMap,
const MapType & theLeftMap,
const MapType & theRightMap )

Sets this Map to be the result of union (aka addition, fuse, merge, boolean OR) operation between two given Maps. The new Map contains the values that are contained either in the first map or in the second map or in both. All previous content of this Map is cleared. This map (result of the boolean operation) can also be passed as one of operands.

◆ Unite()

template<class MapType>
bool NCollection_MapAlgo::Unite ( MapType & theMap,
const MapType & theOtherMap )

Apply to this Map the boolean operation union (aka addition, fuse, merge, boolean OR) with another (given) Map. The result contains the values that were previously contained in this map or contained in the given (operand) map. This algorithm is similar to method Union(). Returns True if contents of this map is changed.