<< Global_map_iterator_sorted_t
 Top   Types   Functions   Classes   Options   Index   Sources 

struct Map / Map_t

Concrete Class


Description

The Map Class

This class implements hash tables.

Throughout the documentation, the following prefixes will be used:

Global_

The library prefix: for applications, this is typically empty, for an xyz-Library, this is either XYZ_, xyz_ or Xyz, depending on the identifier in occurs in.

TemplateInstantiation
Global_MAP_OKXYZ_MAP_OK
Global_map_newxyz_map_new
Map_

This is equivalent to Global_map_iType_oType, or the name that was set with -name=... for this data structure. The case and underbar convention is adjusted, too.

Assuming a library prefix xyz and iType=int *, oType == int, you get:

TemplateInstantiation
Map_txyz_map_int_p_int_t
Map_ALLOW_NULLXYZ_MAP_INT_P_INT_ALLOW_NULL
Map_class

This is the name of the data structure type in C++: capitalised and with underbars removed:

Map_tMap_class
map_int_p_int_tMapIntPInt

In the following, for many functions, the error code values are given. There are two kinds, those for success and those for failure. The error codes (if set at all) are always stored in the global variable Global_map_errno, no mattern whether the function returns its success or not. Note that the error value MAP_ERR_ASSERTIONFAILED is never explicitly given, because it

Successful operation is indicated by Global_MAP_OK, Global_MAP_WARN_*, and Global_MAP_REHASH*.

Failure is indicated by Global_MAP_ERR_*. If a functions does not return the error code, its result value in case of an error is always the zero element of the result type. I.e. NULL for pointers, 0 for integers, the user specified zero element for iType or oType, Global_ERWIN_FALSE for Global_ERWIN_BOOL, etc.

Functions that only set map_errno to Global_MAP_REHASH_* or Global_MAP_OK will return void if they do not have a natural result.

Note

The term `success' means that the function could perform its operation according to the specification. E.g. if you call _insert and the key exists, the functions does not insert it. However, this is no error. It is defined that it should not be inserted in this case. Accordingly, you get a warning, not an error.

Type Aliases

typedefiType KeyType
typedefoType ValueType

Members

voidclear_errno()
voiddelete_entries(Map_pair_t * k)
voiddelete_entries_ptr(Map_pair_ptr_t * k)
voiddelete_keys(iType * k)
voiddelete_values(oType * k)
intget_errno()
Map_t const &static_zero()
voidoperator delete(void *, size_t)
voidoperator delete[](void *, size_t)
void *operator new(size_t)
void *operator new[](size_t)
Map()
Map(int initial_size)
Map(oTypeTouched zero_element)
Map(oTypeTouched zero_element, int initial_size)
Map(Map_t const * a)
Map(Map_t const & a)
~Map()
operator Map_t *()
operator Map_t const *() const
booloperator!=(Map_t const & b) const
booloperator!=(Map_t const * b) const
iTypeResultoperator()(iTypeTouched k)
booloperator<(Map_t const & b) const
booloperator<(Map_t const * b) const
booloperator<=(Map_t const & b) const
booloperator<=(Map_t const * b) const
Map_t &operator=(Map_t const &)
Map_t &operator=(Map_t const *)
booloperator==(Map_t const & b) const
booloperator==(Map_t const * b) const
booloperator>(Map_t const & b) const
booloperator>(Map_t const * b) const
booloperator>=(Map_t const & b) const
booloperator>=(Map_t const * b) const
oTypeResultoperator[](iTypeParam i) const
oType &operator[](iTypeTouched i)
oTypeIndex &operator[](iTypeTouched i)
void_constructor()
void_destructor()
doubleaverage_line_length() const
Map_t &clear()
Map_t &clear(bool k, bool v)
voidclear_errno() const
Map_t &clear_no_resize()
intcmp(Map_t const * other) const
intcmp(Map_t const & other) const
Map_t *copy() const
Map_t *copy_err(int * err) const
doubledeviation_line_length() const
voiddump(FILE * f) const
boolempty() const
iTypeResultensure(iTypeTouched k)
iTypeResultensure_no_icopy(iTypeVarParam k)
boolequal(Map_t const * other) const
boolequal(Map_t const & other) const
Map_t &erase(iTypeTouched i)
Map_t &erase(Map_t const & other)
Map_t &erase(Map_t const * other)
interase_if(Map_feature_t f, bool value = true)
Map_t &erase_map(Map_t const & other)
Map_t &erase_map(Map_t const * other)
oTypeResultfind(iTypeParam i) const
oTypeResultfind_any() const
iTypeResultfind_any_key() const
intfind_any_pair(Map_key_result_t & kp, Map_element_ptr_t & vp) const
Map_element_ptr_tfind_any_ptr() const
oTypeResultfind_ensure(iTypeTouched i)
iTypeResultfind_key(iTypeParam i) const
oType *find_ptr(iTypeParam i) const
oType const *find_ptr(iTypeParam i) const
oType *find_ptr_ensure(iTypeTouched i)
oType const *find_ptr_ensure(iTypeTouched i)
Map_pair_t *get_entries() const
Map_pair_ptr_t *get_entries_ptr() const
intget_errno() const
iType *get_keys() const
oType *get_values() const
Global_hashval_thash() const
Global_hashval_thash_raw() const
inthash_size() const
Map_t &insert(iTypeTouched k)
Map_t &insert(iTypeTouched k, oTypeTouched v)
Map_t &insert(Map_t const & other)
Map_t &insert(Map_t const * other)
Map_t &insert_map(Map_t const & other)
Map_t &insert_map(Map_t const * other)
Map_t &intersect(Map_t const & other)
Map_t &intersect(Map_t const * other)
Map_t &intersect_no_resize(Map_t const & other)
Map_t &intersect_no_resize(Map_t const * other)
intmax_line_length() const
intmin_line_length() const
oTypeVarmodify(iTypeParam i, oTypeTouched v)
Map_t &modify(Map_t const & other)
Map_t &modify(Map_t const * other)
Map_t &modify_map(Map_t const & other)
Map_t &modify_map(Map_t const * other)
intnentries() const
intnfind() const
intninsert() const
boolnon_empty() const
intnops() const
intnrehash() const
intnrehash_ops() const
intnremove() const
Map_t &poke(iType * kp, iTypeTouched k, bool aintroduce = true)
Map_t &poke(iType * kp, oTypeVar * vo, iTypeTouched k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)
Map_t &poke_no_icopy(iType * kp, iTypeVarParam k, bool aintroduce = true)
Map_t &poke_no_icopy(iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)
Map_t &poke_no_icopy_no_ocopy(iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)
Map_t &poke_no_ocopy(iType * kp, oTypeVar * vo, iTypeTouched k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)
Map_t &rehash(int n)
oTypeVarremove(iTypeTouched i)
intremove_if(Map_feature_t f, bool value = true)
Map_t &remove_map(Map_t const & other)
Map_t &remove_map(Map_t const * other)
Map_t &set(iTypeTouched i, oTypeTouched v)
Map_t &set(Map_t const & other)
Map_t &set(Map_t const * other)
Map_t &set_map(Map_t const & other)
Map_t &set_map(Map_t const * other)
doublevariance_line_length() const
Map_t &xchg(Map_t * other)
Map_t &xchg(Map_t & other)
oTypeResultzero() const


Detailed Descriptions


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void * operator new (size_t)

C++: void * Map_t::operator new (size_t)
#endif
Declaration  ]


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void operator delete (void *, size_t)

C++: void Map_t::operator delete (void *, size_t)
#endif
Declaration  ]


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void * operator new[] (size_t)

C++: void * Map_t::operator new[] (size_t)
#endif
Declaration  ]


#if !Global_ERWIN_DEFAULT_NEW_DELETE

static void operator delete[] (void *, size_t)

C++: void Map_t::operator delete[] (void *, size_t)
#endif
Declaration  ]


[constructor] Map ()

C++: Map_t::Map ()
Declaration  ]


static Map_t const & static_zero ()

C++: Map_t const & Map_t::static_zero ()
Declaration  ]


#if Map_HAVE_INT_CONSTRUCTOR

[constructor] Map (int initial_size)

C++: Map_t::Map (int initial_size)
#endif
Declaration  ]


#if Map_DYN_ZERO

[constructor] Map (oTypeTouched zero_element)

C++: Map_t::Map (oTypeTouched zero_element)
#endif
Declaration  ]


#if Map_DYN_ZERO

[constructor] Map (oTypeTouched zero_element, int initial_size)

C++: Map_t::Map (oTypeTouched zero_element, int initial_size)
#endif
Declaration  ]


#if !Global_ERWIN_GLOBAL_ERRNO

int get_errno () const

C++: int Map_t::get_errno () const
#endif
Declaration & Source  ]


#if !Global_ERWIN_GLOBAL_ERRNO

void clear_errno () const

C++: void Map_t::clear_errno () const
C: void Map_clear_errno (Map_t const *)

Resets the status code to MAP_OK.

If you do not have a thread-safe Erwin library, there is a macro with the same name as this function.

Error Codes (Global_map_errno)

#endif
C Declaration  | C++ Declaration & Source  ]


#if Global_ERWIN_GLOBAL_ERRNO

static int get_errno ()

C++: int Map_t::get_errno ()
#endif
Declaration & Source  ]


#if Global_ERWIN_GLOBAL_ERRNO

static void clear_errno ()

C++: void Map_t::clear_errno ()
#endif
Declaration & Source  ]


[constructor] Map (Map_t const * a)

C++: Map_t::Map (Map_t const * a)
Declaration  ]


[constructor] Map (Map_t const & a)

C++: Map_t::Map (Map_t const & a)
Declaration  ]


Map_t * copy () const

C++: Map_t * Map_t::copy () const
Declaration & Source  ]


Map_t * copy_err (int * err) const

C++: Map_t * Map_t::copy_err (int * err) const
Declaration & Source  ]


Map_t & xchg (Map_t * other)

C++: Map_t & Map_t::xchg (Map_t * other)
C: void Map_xchg (Map_t * self, Map_t * other)

Exchanges the two maps' contents. No memory allocation is performed; this is a fast O(1) operation for swapping two values.

C Declaration  | C++ Declaration & Source  ]


Map_t & xchg (Map_t & other)

C++: Map_t & Map_t::xchg (Map_t & other)
C: void Map_xchg (Map_t * self, Map_t * other)

Exchanges the two maps' contents. No memory allocation is performed; this is a fast O(1) operation for swapping two values.

C Declaration  | C++ Declaration & Source  ]


Map_t & operator= (Map_t const &)

C++: Map_t & Map_t::operator= (Map_t const &)
Declaration  ]


Map_t & operator= (Map_t const *)

C++: Map_t & Map_t::operator= (Map_t const *)

without this, it would be copied twice

Declaration  ]


void _constructor ()

C++: void Map_t::_constructor ()

Quite private: do not use unless you know what you're doing:

This constructs the map for a given preallocated memory location.

FIXME: There should be an operator new() for this.

Declaration  ]


void _destructor ()

C++: void Map_t::_destructor ()

Quite private: do not use unless you know what you're doing:

Needed if you want to use maps without a pointer in vectors. vectors use C-style memory allocation because they need realloc. The constructor/destructors are invoked via these two functions.

Declaration  ]


[destructor] ~Map ()

C++: Map_t::~Map ()

There is no delete_flags here in C++, but you can clear_flags() before deletion.

Declaration  ]


operator Map_t * ()

C++: Map_t::operator Map_t * ()
Declaration & Source  ]


operator Map_t const * () const

C++: Map_t::operator Map_t const * () const
Declaration & Source  ]


oTypeResult operator[] (iTypeParam i) const

C++: oTypeResult Map_t::operator[] (iTypeParam i) const
C: oTypeResult Map_find (Map_t const * self, iTypeParam index)

Returns the found element or the zero element if not found.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oType & operator[] (iTypeTouched i)

C++: oType & Map_t::operator[] (iTypeTouched i)
C: Map_element_ptr_t Map_find_ptr_ensure (Map_t * self, iTypeTouched index)

Returns a pointer to the found element or one to a newly allocated one. In the case when it was not possible to allocate space for a new element, the result NULL. Otherwise, it is not NULL.

If a new element was introduced, errno will be set to MAP_WARN_KEYNOTFOUND, otherwise to MAP_OK. Note again that in both cases, the result is non-NULL!

Note

If oType == oTypeVar, you may not use the pointer to directly write into the hash table because this circumvents copying and that is prohibited. Use poke_no_ocopy for things like that to make it explicit.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oTypeIndex & operator[] (iTypeTouched i)

C++: oTypeIndex & Map_t::operator[] (iTypeTouched i)
C: oTypeResult Map_find_ensure (Map_t * self, iTypeTouched index)

Returns the found element or introduces an empty element into the map and returns that (use Map_ENSURE_VALUE to determine the value that is introduced).

Also consider find_ptr_ensure if you want to modify the (newly introduced) value. Also see Map_ensure if you need the key, not the value after the operation.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oType * find_ptr (iTypeParam i) const

C++: oType * Map_t::find_ptr (iTypeParam i) const
C: Map_element_ptr_t Map_find_ptr (Map_t const * self, iTypeParam index)

Returns a pointer to the found element or NULL on failure.

Note

If oType == oTypeVar, you may not use the pointer to directly write into the hash table because this circumvents copying and that is prohibited. Use poke_no_ocopy for things like that to make it explicit.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oType * find_ptr_ensure (iTypeTouched i)

C++: oType * Map_t::find_ptr_ensure (iTypeTouched i)
C: Map_element_ptr_t Map_find_ptr_ensure (Map_t * self, iTypeTouched index)

Returns a pointer to the found element or one to a newly allocated one. In the case when it was not possible to allocate space for a new element, the result NULL. Otherwise, it is not NULL.

If a new element was introduced, errno will be set to MAP_WARN_KEYNOTFOUND, otherwise to MAP_OK. Note again that in both cases, the result is non-NULL!

Note

If oType == oTypeVar, you may not use the pointer to directly write into the hash table because this circumvents copying and that is prohibited. Use poke_no_ocopy for things like that to make it explicit.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oType const * find_ptr (iTypeParam i) const

C++: oType const * Map_t::find_ptr (iTypeParam i) const
C: Map_element_ptr_t Map_find_ptr (Map_t const * self, iTypeParam index)

Returns a pointer to the found element or NULL on failure.

Note

If oType == oTypeVar, you may not use the pointer to directly write into the hash table because this circumvents copying and that is prohibited. Use poke_no_ocopy for things like that to make it explicit.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oType const * find_ptr_ensure (iTypeTouched i)

C++: oType const * Map_t::find_ptr_ensure (iTypeTouched i)
C: Map_element_ptr_t Map_find_ptr_ensure (Map_t * self, iTypeTouched index)

Returns a pointer to the found element or one to a newly allocated one. In the case when it was not possible to allocate space for a new element, the result NULL. Otherwise, it is not NULL.

If a new element was introduced, errno will be set to MAP_WARN_KEYNOTFOUND, otherwise to MAP_OK. Note again that in both cases, the result is non-NULL!

Note

If oType == oTypeVar, you may not use the pointer to directly write into the hash table because this circumvents copying and that is prohibited. Use poke_no_ocopy for things like that to make it explicit.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oTypeResult find (iTypeParam i) const

C++: oTypeResult Map_t::find (iTypeParam i) const
C: oTypeResult Map_find (Map_t const * self, iTypeParam index)

All other members map to the C equivalent directly.

Returns the found element or the zero element if not found.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oTypeResult find_ensure (iTypeTouched i)

C++: oTypeResult Map_t::find_ensure (iTypeTouched i)
C: oTypeResult Map_find_ensure (Map_t * self, iTypeTouched index)

Returns the found element or introduces an empty element into the map and returns that (use Map_ENSURE_VALUE to determine the value that is introduced).

Also consider find_ptr_ensure if you want to modify the (newly introduced) value. Also see Map_ensure if you need the key, not the value after the operation.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


iTypeResult find_any_key () const

C++: iTypeResult Map_t::find_any_key () const
C: iTypeResult Map_find_any_key (Map_t const * self)

Returns some key that is stored in the table.

See Map_find_any() for docu.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oTypeResult find_any () const

C++: oTypeResult Map_t::find_any () const
C: oTypeResult Map_find_any (Map_t const * self)

Returns the found element or the zero element if not found.

For maps with 0 or 1 elements and in the non-deterministic case, this is very fast. In the deterministic mode, this is O(n). In weak determinism, it is typically O(1) as in the non-deterministic mode. (The very unlikely worst case is always O(n)).

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


Map_element_ptr_t find_any_ptr () const

C++: Map_element_ptr_t Map_t::find_any_ptr () const
C: Map_element_ptr_t Map_find_any_ptr (Map_t const * self)

Returns a pointer to some element or NULL on failure.

Note

If oType == oTypeVar, you may not use the pointer to directly write into the hash table because this circumvents copying and that is prohibited. Use poke_no_ocopy for things like that to make it explicit.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


int find_any_pair (Map_key_result_t & kp, Map_element_ptr_t & vp) const

C++: int Map_t::find_any_pair (iType & kp, Map_element_ptr_t & vp) const
C: int Map_find_any_pair (iType *, Map_element_ptr_t *, Map_t const * self)
C Declaration  | C++ Declaration & Source  ]


Map_t & insert (iTypeTouched k)

C++: Map_t & Map_t::insert (iTypeTouched k)
C: int Map_insert (Map_t * self, iTypeTouched key, oTypeTouched value)
C Declaration  | C++ Declaration & Source  ]


Map_t & insert (iTypeTouched k, oTypeTouched v)

C++: Map_t & Map_t::insert (iTypeTouched k, oTypeTouched v)
C: int Map_insert (Map_t * self, iTypeTouched key, oTypeTouched value)
C Declaration  | C++ Declaration & Source  ]


Map_t & insert_map (Map_t const & other)

C++: Map_t & Map_t::insert_map (Map_t const & other)
C: int Map_insert_map (Map_t * self, Map_t const * other)

Inserts all keys from other into self. If any key is not inserted, returns WARN_EXISTINGKEY.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & insert_map (Map_t const * other)

C++: Map_t & Map_t::insert_map (Map_t const * other)
C: int Map_insert_map (Map_t * self, Map_t const * other)

Inserts all keys from other into self. If any key is not inserted, returns WARN_EXISTINGKEY.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & insert (Map_t const & other)

C++: Map_t & Map_t::insert (Map_t const & other)
C: int Map_insert_map (Map_t * self, Map_t const * other)

Inserts all keys from other into self. If any key is not inserted, returns WARN_EXISTINGKEY.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & insert (Map_t const * other)

C++: Map_t & Map_t::insert (Map_t const * other)
C: int Map_insert_map (Map_t * self, Map_t const * other)

Inserts all keys from other into self. If any key is not inserted, returns WARN_EXISTINGKEY.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


oTypeVar modify (iTypeParam i, oTypeTouched v)

C++: oTypeVar Map_t::modify (iTypeParam i, oTypeTouched v)
C: oTypeVar Map_modify (Map_t * self, iTypeParam index, oTypeTouched value)

modify

Change an existing value for the given index (errno=OK). If the index does not exist, do not modify the map nothing (errno=WARN_KETNOTFOUND).

Returns the old value or Global_oType_ZERO if it is new in which case the map is not changed. Nothing is freed, value is copied.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & modify_map (Map_t const & other)

C++: Map_t & Map_t::modify_map (Map_t const & other)
C: int Map_modify_map (Map_t * self, Map_t const * other)

like Map_modify on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & modify_map (Map_t const * other)

C++: Map_t & Map_t::modify_map (Map_t const * other)
C: int Map_modify_map (Map_t * self, Map_t const * other)

like Map_modify on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & modify (Map_t const & other)

C++: Map_t & Map_t::modify (Map_t const & other)
C: int Map_modify_map (Map_t * self, Map_t const * other)

like Map_modify on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & modify (Map_t const * other)

C++: Map_t & Map_t::modify (Map_t const * other)
C: int Map_modify_map (Map_t * self, Map_t const * other)

like Map_modify on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


Map_t & set (iTypeTouched i, oTypeTouched v)

C++: Map_t & Map_t::set (iTypeTouched i, oTypeTouched v)
C: int Map_set (Map_t * self, iTypeTouched index, oTypeTouched value)

Insert or modify a value: introduce value for given index if it does not exist (errno=OK) or change value if index does exist (errno=WARN_EXISTINGKEY).

Similar to Map_modify, but value is freed and the status instead of the value is returned. Furthermore, of course, it is different in that if the value does not exist, it will be inserted.

Note

If you don't care whether to use Map_set or Map_insert, use Map_insert. Map_insert might be a little faster.

Result: The error code, same as Global_map_errno.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & set_map (Map_t const & other)

C++: Map_t & Map_t::set_map (Map_t const & other)
C: int Map_set_map (Map_t * self, Map_t const * other)

like Map_set on all entries in other

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & set_map (Map_t const * other)

C++: Map_t & Map_t::set_map (Map_t const * other)
C: int Map_set_map (Map_t * self, Map_t const * other)

like Map_set on all entries in other

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & set (Map_t const & other)

C++: Map_t & Map_t::set (Map_t const & other)
C: int Map_set_map (Map_t * self, Map_t const * other)

like Map_set on all entries in other

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & set (Map_t const * other)

C++: Map_t & Map_t::set (Map_t const * other)
C: int Map_set_map (Map_t * self, Map_t const * other)

like Map_set on all entries in other

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


oTypeVar remove (iTypeTouched i)

C++: oTypeVar Map_t::remove (iTypeTouched i)
C: oTypeVar Map_remove (Map_t * self, iTypeTouched index)

remove

Returns the old value or Global_oType_ZERO. Does not free the value (which is returned), but only the key. A more appropriate name for this function might be `steal', because the value is kept.

In error-free operation, returns errno=OK if the index was found and erased, and WARN_KEYNOTFOUND if the index was not found.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & remove_map (Map_t const & other)

C++: Map_t & Map_t::remove_map (Map_t const & other)
C: int Map_remove_map (Map_t * self, Map_t const * other)

like Map_remove on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & remove_map (Map_t const * other)

C++: Map_t & Map_t::remove_map (Map_t const * other)
C: int Map_remove_map (Map_t * self, Map_t const * other)

like Map_remove on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


int remove_if (Map_feature_t f, bool value = true)

C++: int Map_t::remove_if (Map_feature_t f, bool value = true)
C: int Map_remove_if (Map_t * self, Map_feature_t feature, Global_ERWIN_BOOL value)

Remove some entries from the map according to a given feature. This is much faster than repeated deletions and maximally requires one rehash operation only.

Note

Even if the library is compiled with determinism, the order of the invocations of the feature callback is non-deterministic!

\errno (OK, REHASH_*)

C Declaration  | C++ Declaration & Source  ]


Map_t & erase (iTypeTouched i)

C++: Map_t & Map_t::erase (iTypeTouched i)
C: int Map_erase (Map_t * self, iTypeTouched index)

erase

Same as Map_remove, but value is freed. In error-free operation, returns errno=OK if the index was found and erased, and WARN_KEYNOTFOUND if the index was not found.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & erase_map (Map_t const & other)

C++: Map_t & Map_t::erase_map (Map_t const & other)
C: int Map_erase_map (Map_t * self, Map_t const * other)

like Map_erase on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & erase_map (Map_t const * other)

C++: Map_t & Map_t::erase_map (Map_t const * other)
C: int Map_erase_map (Map_t * self, Map_t const * other)

like Map_erase on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & erase (Map_t const & other)

C++: Map_t & Map_t::erase (Map_t const & other)
C: int Map_erase_map (Map_t * self, Map_t const * other)

like Map_erase on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


#if Map_DIRECT_RECURSION == 0

Map_t & erase (Map_t const * other)

C++: Map_t & Map_t::erase (Map_t const * other)
C: int Map_erase_map (Map_t * self, Map_t const * other)

like Map_erase on all entries in other. If any key was not found, WARN_KEYNOTFOUND is returned.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

#endif
C Declaration  | C++ Declaration & Source  ]


int erase_if (Map_feature_t f, bool value = true)

C++: int Map_t::erase_if (Map_feature_t f, bool value = true)
C: int Map_erase_if (Map_t * self, Map_feature_t feature, Global_ERWIN_BOOL value)

Erase some entries from the map according to a given feature. This is much faster than repeated deletions and maximally requires one rehash operation only.

Note

Even if the library is compiled with determinism, the order of the invocations of the feature callback is non-deterministic!

\errno (OK, REHASH_*)

C Declaration  | C++ Declaration & Source  ]


Map_t & intersect (Map_t const & other)

C++: Map_t & Map_t::intersect (Map_t const & other)
C: int Map_intersect (Map_t * self, Map_t const * other)

Implements set intersection: this invokes Map_erase on all entries in self that are not in other. Returns the number of erased elements (quite like Map_erase_if).

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & intersect (Map_t const * other)

C++: Map_t & Map_t::intersect (Map_t const * other)
C: int Map_intersect (Map_t * self, Map_t const * other)

Implements set intersection: this invokes Map_erase on all entries in self that are not in other. Returns the number of erased elements (quite like Map_erase_if).

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & intersect_no_resize (Map_t const & other)

C++: Map_t & Map_t::intersect_no_resize (Map_t const & other)
C: int Map_intersect_no_resize (Map_t * self, Map_t const * other)

Like Map_intersect, but does not shrink the internal hash table.

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & intersect_no_resize (Map_t const * other)

C++: Map_t & Map_t::intersect_no_resize (Map_t const * other)
C: int Map_intersect_no_resize (Map_t * self, Map_t const * other)

Like Map_intersect, but does not shrink the internal hash table.

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


iTypeResult find_key (iTypeParam i) const

C++: iTypeResult Map_t::find_key (iTypeParam i) const
C: iTypeResult Map_find_key (Map_t const * self, iTypeParam index)

others

Returns the key as stored in the table. For copied pointer types, this might be different from index.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

C Declaration  | C++ Declaration & Source  ]


oTypeResult zero () const

C++: oTypeResult Map_t::zero () const
C: oTypeResult Map_zero (Map_t const * self)

Returns the zero element of oType

Error Codes

The operation is always successful (not thinking of assertion failures).

C Declaration  | C++ Declaration & Source  ]


iTypeResult ensure (iTypeTouched k)

C++: iTypeResult Map_t::ensure (iTypeTouched k)
C: iTypeResult Map_ensure (Map_t * self, iTypeTouched key)

This ensures that key is inserted in the table, i.e., it allocates a cell for it. The inserted value will be Global_oType_ZERO. If you want to change this, re-define Map_ENSURE_VALUE. The result is the key as inserted in the hash table, so if you defined Global_iType_ICOPY, you will get a copy of your key.

Note

This function implements symbol tables.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


iTypeResult ensure_no_icopy (iTypeVarParam k)

C++: iTypeResult Map_t::ensure_no_icopy (iTypeVarParam k)
C: iTypeResult Map_ensure_no_icopy (Map_t * self, iTypeVarParam key)

This is like Map_ensure(), but the input key will be stolen or freed, i.e., it will be used as a copy inside the hash table, instead of being copied as in Map_ensure. If the key already exists, the key passed will be freed.

Note

This function implements symbol tables.

This could be called Map_ensure_steal(), but we already have poke_no_icopy().

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


iTypeResult operator() (iTypeTouched k)

C++: iTypeResult Map_t::operator() (iTypeTouched k)
C: iTypeResult Map_ensure (Map_t * self, iTypeTouched key)

This ensures that key is inserted in the table, i.e., it allocates a cell for it. The inserted value will be Global_oType_ZERO. If you want to change this, re-define Map_ENSURE_VALUE. The result is the key as inserted in the hash table, so if you defined Global_iType_ICOPY, you will get a copy of your key.

Note

This function implements symbol tables.

Error Codes (Global_map_errno)

Note that a warning means that the operation was successfully completed.

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


Map_t & poke (iType * kp, iTypeTouched k, bool aintroduce = true)

C++: Map_t & Map_t::poke (iType * kp, iTypeTouched k, bool aintroduce = true)
C: int Map_poke (iType * key_out, oTypeVar * value_out, Map_t * self, iTypeTouched key, oTypeTouched value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
C Declaration  | C++ Declaration & Source  ]


Map_t & poke (iType * kp, oTypeVar * vo, iTypeTouched k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)

C++: Map_t & Map_t::poke (iType * kp, oTypeVar * vo, iTypeTouched k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)
C: int Map_poke (iType * key_out, oTypeVar * value_out, Map_t * self, iTypeTouched key, oTypeTouched value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
C Declaration  | C++ Declaration & Source  ]


Map_t & poke_no_icopy (iType * kp, iTypeVarParam k, bool aintroduce = true)

C++: Map_t & Map_t::poke_no_icopy (iType * kp, iTypeVarParam k, bool aintroduce = true)
C: int Map_poke_no_icopy (iType * key_out, oTypeVar * value_out, Map_t * self, iTypeVarParam key, oTypeParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
C Declaration  | C++ Declaration & Source  ]


Map_t & poke_no_icopy (iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)

C++: Map_t & Map_t::poke_no_icopy (iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)
C: int Map_poke_no_icopy (iType * key_out, oTypeVar * value_out, Map_t * self, iTypeVarParam key, oTypeParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
C Declaration  | C++ Declaration & Source  ]


Map_t & poke_no_ocopy (iType * kp, oTypeVar * vo, iTypeTouched k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)

C++: Map_t & Map_t::poke_no_ocopy (iType * kp, oTypeVar * vo, iTypeTouched k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)
C: int Map_poke_no_ocopy (iType * key_out, oTypeVar * value_out, Map_t * self, iTypeTouched key, oTypeVarParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)

Like Map_poke, but the value is not copied. However, value may be freed if value_out is NULL. The rules for copying and freeing values are the same as for key with Map_poke_no_icopy.

C Declaration  | C++ Declaration & Source  ]


Map_t & poke_no_icopy_no_ocopy (iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)

C++: Map_t & Map_t::poke_no_icopy_no_ocopy (iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)
C: int Map_poke_no_icopy_no_ocopy (iType * key_out, oTypeVar * value_out, Map_t * self, iTypeVarParam key, oTypeVarParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)

Like Map_poke, but neither the key nor the value are copied. Both, key and value may be freed. The rules for copying and freeing keys and values are the same as for Map_poke_no_icopy and Map_poke_no_ocopy.

C Declaration  | C++ Declaration & Source  ]


Map_t & clear ()

C++: Map_t & Map_t::clear ()
C: void Map_clear (Map_t * self)

clear

Like Map_erase for all elements

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


Map_t & clear_no_resize ()

C++: Map_t & Map_t::clear_no_resize ()
C: void Map_clear_no_resize (Map_t * self)

Like Map_erase for all elements, but does not shrink the internal hash table.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


Map_t & clear (bool k, bool v)

C++: Map_t & Map_t::clear (bool k, bool v)
C: void Map_clear_flags (Map_t * self, Global_ERWIN_BOOL destroy_keys, Global_ERWIN_BOOL destroy_values)

Clear and selectively free the map

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


int nentries () const

C++: int Map_t::nentries () const
C: int Map_nentries (Map_t const * self)

Returns the number of entries (pairs of keys and values)

Error Codes

The operation is always successful (not thinking of assertion failures).

C Declaration  | C++ Declaration & Source  ]


bool empty () const

C++: bool Map_t::empty () const
C: Global_ERWIN_BOOL Map_empty (Map_t const * self)

Returns whether map has 0 entries

Error Codes

The operation is always successful (not thinking of assertion failures).

C Declaration  | C++ Declaration & Source  ]


bool non_empty () const

C++: bool Map_t::non_empty () const
C: Global_ERWIN_BOOL Map_empty (Map_t const * self)

Returns whether map has 0 entries

Error Codes

The operation is always successful (not thinking of assertion failures).

C Declaration  | C++ Declaration & Source  ]


iType * get_keys () const

C++: iType * Map_t::get_keys () const
C: iType * Map_get_keys (Map_t const * self)

Get all keys, values, or key/value pairs as a normal standard C array. The elements and keys are not copied. The array will be terminated with the zero value.

Note

The returned maps are newly allocated and must eventually be freed by the user using Map_delete_keys(). In earlier versions of Erwin, free() was recommended for freeing, but due to more sophisticated memory management, Map_delete_keys() is the primary choice now. It old code, no adjustment should be necessary, since this is only different if you customise Global_ERWIN_TMALLOC etc.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


static void delete_keys (iType * k)

C++: void Map_t::delete_keys (iType * k)
C: void Map_delete_keys (iType * keys)

Deallocate keys obtained by Map_get_keys().

C Declaration  | C++ Declaration & Source  ]


Map_pair_t * get_entries () const

C++: Map_pair_t * Map_t::get_entries () const
C: Map_pair_t * Map_get_entries (Map_t const * self)

Use Map_delete_entries to deallocate the returned array.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


Map_pair_ptr_t * get_entries_ptr () const

C++: Map_pair_ptr_t * Map_t::get_entries_ptr () const
C: Map_pair_ptr_t * Map_get_entries_ptr (Map_t const * self)

Usp Map_delete_entries_ptr to deallocate the returned array.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


oType * get_values () const

C++: oType * Map_t::get_values () const
C: oType * Map_get_values (Map_t const * self)

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


static void delete_entries_ptr (Map_pair_ptr_t * k)

C++: void Map_t::delete_entries_ptr (Map_pair_ptr_t * k)
C: void Map_delete_entries_ptr (Map_pair_ptr_t * entries_ptr)

Deallocate keys obtained by Map_get_entries_ptr().

C Declaration  | C++ Declaration & Source  ]


static void delete_entries (Map_pair_t * k)

C++: void Map_t::delete_entries (Map_pair_t * k)
C: void Map_delete_entries (Map_pair_t * entries)

Deallocate keys obtained by Map_get_entries().

C Declaration  | C++ Declaration & Source  ]


static void delete_values (oType * k)

C++: void Map_t::delete_values (oType * k)
C: void Map_delete_values (oType * values)

Deallocate keys obtained by Map_get_values().

C Declaration  | C++ Declaration & Source  ]


int hash_size () const

C++: int Map_t::hash_size () const
C: int Map_hash_size (Map_t const * self)

Returns the size of the internal array of list pointers used to implement the hash table.

Error Codes

The operation is always successful (not thinking of assertion failures).

C Declaration  | C++ Declaration & Source  ]


Map_t & rehash (int n)

C++: Map_t & Map_t::rehash (int n)
C: void Map_rehash (Map_t * self, int newsize)

Do a manual rehash. If Global_map_errno holds anything other than MAP_OK, the map operation did not succeed. However, the map is guaranteed to be usable after the function call; either rehashed or original. The return type is set to void because the function should not be considered failed if anything bad has happened.

Error Codes (Global_map_errno)

Note that a rehash warning means that the operation was successfully completed. However, there may be serious problems like heap corruption, so handling this as an error is not a bad idea.

C Declaration  | C++ Declaration & Source  ]


double average_line_length () const

C++: double Map_t::average_line_length () const
C: double Map_average_line_length (Map_t const * self)
C Declaration  | C++ Declaration & Source  ]


double variance_line_length () const

C++: double Map_t::variance_line_length () const
C: double Map_variance_line_length (Map_t const * self)
C Declaration  | C++ Declaration & Source  ]


#if defined(HAVE_SQRT)

double deviation_line_length () const

C++: double Map_t::deviation_line_length () const
C: double Map_deviation_line_length (Map_t const * self)
#endif
C Declaration  | C++ Declaration & Source  ]


int max_line_length () const

C++: int Map_t::max_line_length () const
C: int Map_max_line_length (Map_t const * self)
C Declaration  | C++ Declaration & Source  ]


int min_line_length () const

C++: int Map_t::min_line_length () const
C: int Map_min_line_length (Map_t const * self)
C Declaration  | C++ Declaration & Source  ]


void dump (FILE * f) const

C++: void Map_t::dump (FILE * f) const
C: void Map_dump (FILE *, Map_t const * self)

Dumps the internal structure of the map to the given file.

C Declaration  | C++ Declaration & Source  ]


#if defined(Global_ERWIN_PROFILE)

int nrehash_ops () const

C++: int Map_t::nrehash_ops () const
C: int Map_nrehash_ops (Map_t const * self)
#endif
C Declaration  | C++ Declaration & Source  ]


#if defined(Global_ERWIN_PROFILE)

int nrehash () const

C++: int Map_t::nrehash () const
C: int Map_nrehash (Map_t const * self)

rehash_ops is the number of pure rehash operations and rehash is the number of elements moved around during rehashes

#endif
C Declaration  | C++ Declaration & Source  ]


#if defined(Global_ERWIN_PROFILE)

int ninsert () const

C++: int Map_t::ninsert () const
C: int Map_ninsert (Map_t const * self)
#endif
C Declaration  | C++ Declaration & Source  ]


#if defined(Global_ERWIN_PROFILE)

int nremove () const

C++: int Map_t::nremove () const
C: int Map_nremove (Map_t const * self)
#endif
C Declaration  | C++ Declaration & Source  ]


#if defined(Global_ERWIN_PROFILE)

int nfind () const

C++: int Map_t::nfind () const
C: int Map_nfind (Map_t const * self)
#endif
C Declaration  | C++ Declaration & Source  ]


#if defined(Global_ERWIN_PROFILE)

int nops () const

C++: int Map_t::nops () const
C: int Map_nops (Map_t const * self)

Sum of inserts, deletions, and searches

#endif
C Declaration  | C++ Declaration & Source  ]


Global_hashval_t hash_raw () const

C++: Global_hashval_t Map_t::hash_raw () const
C: Global_hashval_t Map_hash_raw (Map_t const * self)

Calculates a hash value for this hash table. In earlier versions of Erwin, the result was inferior to that of Map_hash, but they are now the same and no additional hashing of the result needs to be done.

Note

Calling this results in a runtime error if Global_oType_HASH is not defined.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


Global_hashval_t hash () const

C++: Global_hashval_t Map_t::hash () const
C: Global_hashval_t Map_hash (Map_t const * x)
C Declaration & Source  | C++ Declaration & Source  ]


bool equal (Map_t const * other) const

C++: bool Map_t::equal (Map_t const * other) const
C: Global_ERWIN_BOOL Map_equal (Map_t const * self, Map_t const * other)

Returns whether two maps are equal. (Of course, maps are invariant in the actual storage order in the hash table.)

Note

This operation is quite expensive but much less expensive than Map_cmp!

Further Note

Calling this results in a runtime error if Global_oType_EQUAL is not defined.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


bool equal (Map_t const & other) const

C++: bool Map_t::equal (Map_t const & other) const
Declaration & Source  ]


int cmp (Map_t const * other) const

C++: int Map_t::cmp (Map_t const * other) const
C: int Map_cmp (Map_t const * self, Map_t const * other)

Returns a comparison value for the two maps. The keys must be sortable for this to work. Maps are invariant in the actual storage order in the hash table.

Note

This operation is expensive and needs additional space for copying the keys of self for sorting!

For equality tests, use Map_equal instead, which is faster.

The comparison value is as follows:

  1. the map that contains most elements is assumed largest.

  2. for equally sized maps, a lexical order is used by sorting the keys and comparing the values of the two maps. 'Not contained' is assumed smallest.

Further Note

Calling this results in a runtime error if either Global_iType_CMP or Global_oType_CMP is not defined.

Error Codes (Global_map_errno)

C Declaration  | C++ Declaration & Source  ]


int cmp (Map_t const & other) const

C++: int Map_t::cmp (Map_t const & other) const
Declaration & Source  ]


bool operator== (Map_t const & b) const

C++: bool Map_t::operator== (Map_t const & b) const

see equal()

Declaration & Source  ]


bool operator== (Map_t const * b) const

C++: bool Map_t::operator== (Map_t const * b) const

see equal()

Declaration & Source  ]


bool operator!= (Map_t const & b) const

C++: bool Map_t::operator!= (Map_t const & b) const

see equal()

Declaration & Source  ]


bool operator!= (Map_t const * b) const

C++: bool Map_t::operator!= (Map_t const * b) const

see equal()

Declaration & Source  ]


bool operator<= (Map_t const & b) const

C++: bool Map_t::operator<= (Map_t const & b) const

see cmp()

Declaration & Source  ]


bool operator<= (Map_t const * b) const

C++: bool Map_t::operator<= (Map_t const * b) const

see cmp()

Declaration & Source  ]


bool operator>= (Map_t const & b) const

C++: bool Map_t::operator>= (Map_t const & b) const

see cmp()

Declaration & Source  ]


bool operator>= (Map_t const * b) const

C++: bool Map_t::operator>= (Map_t const * b) const

see cmp()

Declaration & Source  ]


bool operator< (Map_t const & b) const

C++: bool Map_t::operator< (Map_t const & b) const

see cmp()

Declaration & Source  ]


bool operator< (Map_t const * b) const

C++: bool Map_t::operator< (Map_t const * b) const

see cmp()

Declaration & Source  ]


bool operator> (Map_t const & b) const

C++: bool Map_t::operator> (Map_t const & b) const

see cmp()

Declaration & Source  ]


bool operator> (Map_t const * b) const

C++: bool Map_t::operator> (Map_t const * b) const

see cmp()

Declaration & Source  ]


Occurrences of Map_t

Map_t const *Global_erwin_ptr_const_of(Map_t const * x)
Map_t const *Global_erwin_ptr_const_of(Map_t const & x)
Map_t *Global_erwin_ptr_of(Map_t * x)
Map_t *Global_erwin_ptr_of(Map_t & x)
doubleMap_average_line_length(Map_t const * self)
voidMap_clear(Map_t * self)
voidMap_clear_errno(Map_t const *)
voidMap_clear_flags(Map_t * self, Global_ERWIN_BOOL destroy_keys, Global_ERWIN_BOOL destroy_values)
voidMap_clear_flags_no_resize(Map_t * self, Global_ERWIN_BOOL destroy_keys, Global_ERWIN_BOOL destroy_values)
voidMap_clear_no_resize(Map_t * self)
intMap_cmp(Map_t const * self, Map_t const * other)
intMap_cmp_keys(Map_t const * self, Map_t const * other)
Map_t *Map_copy(Map_t const * self)
Map_t *Map_copy_err(Map_t const * self, int * err)
voidMap_delete(Map_t * self)
voidMap_delete_flags(Map_t * self, Global_ERWIN_BOOL destroy_keys, Global_ERWIN_BOOL destroy_values)
voidMap_destroy(Map_t * self)
voidMap_destroy_flags(Map_t * self, Global_ERWIN_BOOL destroy_keys, Global_ERWIN_BOOL destroy_values)
doubleMap_deviation_line_length(Map_t const * self)
voidMap_dump(FILE *, Map_t const * self)
Global_ERWIN_BOOLMap_empty(Map_t const * self)
iTypeResultMap_ensure(Map_t * self, iTypeTouched key)
iTypeResultMap_ensure_no_icopy(Map_t * self, iTypeVarParam key)
Global_ERWIN_BOOLMap_equal(Map_t const * self, Map_t const * other)
Global_ERWIN_BOOLMap_equal_keys(Map_t const * self, Map_t const * other)
intMap_erase(Map_t * self, iTypeTouched index)
intMap_erase_if(Map_t * self, Map_feature_t feature, Global_ERWIN_BOOL value)
intMap_erase_map(Map_t * self, Map_t const * other)
intMap_erase_map_no_resize(Map_t * self, Map_t const * other)
intMap_erase_no_resize(Map_t * self, iTypeTouched index)
intMap_errno(Map_t const *)
Global_ERWIN_BOOLMap_expect_size(Map_t * self, int newsize)
oTypeResultMap_find(Map_t const * self, iTypeParam index)
oTypeResultMap_find_any(Map_t const * self)
iTypeResultMap_find_any_key(Map_t const * self)
intMap_find_any_pair(Map_key_result_t *, Map_t const * self)
intMap_find_any_pair(Map_key_result_t *, Map_element_ptr_t *, Map_t const * self)
Map_element_ptr_tMap_find_any_ptr(Map_t const * self)
oTypeResultMap_find_ensure(Map_t * self, iTypeTouched index)
iTypeResultMap_find_key(Map_t const * self, iTypeParam index)
Map_element_ptr_tMap_find_ptr(Map_t const * self, iTypeParam index)
Map_element_ptr_tMap_find_ptr_ensure(Map_t * self, iTypeTouched index)
Map_pair_t *Map_get_entries(Map_t const * self)
Map_pair_ptr_t *Map_get_entries_ptr(Map_t const * self)
iType *Map_get_keys(Map_t const * self)
oType *Map_get_values(Map_t const * self)
Global_hashval_tMap_hash(Map_t const *)
Global_hashval_tMap_hash(Map_t const * x)
Global_hashval_tMap_hash_raw(Map_t const * self)
intMap_hash_size(Map_t const * self)
intMap_init(Map_t * self)
intMap_init_with_initial_size(Map_t * self, int initial_size)
intMap_init_with_zero_and_initial_size(Map_t * self, oTypeTouched zero, int initial_size)
intMap_insert(Map_t * self, iTypeTouched key)
intMap_insert(Map_t * self, iTypeTouched key, oTypeTouched value)
intMap_insert_map(Map_t * self, Map_t const * other)
intMap_intersect(Map_t * self, Map_t const * other)
intMap_intersect_no_resize(Map_t * self, Map_t const * other)
intMap_max_line_length(Map_t const * self)
intMap_min_line_length(Map_t const * self)
oTypeVarMap_modify(Map_t * self, iTypeParam index, oTypeTouched value)
intMap_modify_map(Map_t * self, Map_t const * other)
intMap_nentries(Map_t const * self)
Map_t *Map_new()
Map_t *Map_new_with_initial_size(int initial_size)
Map_t *Map_new_with_zero(oTypeTouched zero)
Map_t *Map_new_with_zero_and_initial_size(oTypeTouched zero, int initial_size)
intMap_nfind(Map_t const * self)
intMap_ninsert(Map_t const * self)
intMap_nops(Map_t const * self)
intMap_nrehash(Map_t const * self)
intMap_nrehash_ops(Map_t const * self)
intMap_nremove(Map_t const * self)
intMap_poke(iType * key_out, Map_t * self, iTypeTouched key, Global_ERWIN_BOOL introduce)
intMap_poke(iType * key_out, oTypeVar * value_out, Map_t * self, iTypeTouched key, oTypeTouched value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
intMap_poke_no_icopy(iType * key_out, Map_t * self, iTypeVarParam key, Global_ERWIN_BOOL introduce)
intMap_poke_no_icopy(iType * key_out, oTypeVar * value_out, Map_t * self, iTypeVarParam key, oTypeParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
intMap_poke_no_icopy_no_ocopy(iType * key_out, oTypeVar * value_out, Map_t * self, iTypeVarParam key, oTypeVarParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
intMap_poke_no_ocopy(iType * key_out, oTypeVar * value_out, Map_t * self, iTypeTouched key, oTypeVarParam value, Global_ERWIN_BOOL introduce, Global_ERWIN_BOOL overwrite)
voidMap_rehash(Map_t * self, int newsize)
oTypeVarMap_remove(Map_t * self, iTypeTouched index)
intMap_remove_if(Map_t * self, Map_feature_t feature, Global_ERWIN_BOOL value)
intMap_remove_map(Map_t * self, Map_t const * other)
oTypeVarMap_remove_no_resize(Map_t * self, iTypeTouched index)
intMap_set(Map_t * self, iTypeTouched index, oTypeTouched value)
intMap_set_map(Map_t * self, Map_t const * other)
doubleMap_variance_line_length(Map_t const * self)
voidMap_xchg(Map_t * self, Map_t * other)
oTypeResultMap_zero(Map_t const * self)
Map_t const &Map_t::static_zero()
Map_t::Map()
Map_t::Map(int initial_size)
Map_t::Map(oTypeTouched zero_element)
Map_t::Map(oTypeTouched zero_element, int initial_size)
Map_t::Map(Map_t const * a)
Map_t::Map(Map_t const & a)
Map_t::operator Map_t *()
Map_t::operator Map_t const *() const
boolMap_t::operator!=(Map_t const & b) const
boolMap_t::operator!=(Map_t const * b) const
boolMap_t::operator<(Map_t const & b) const
boolMap_t::operator<(Map_t const * b) const
boolMap_t::operator<=(Map_t const & b) const
boolMap_t::operator<=(Map_t const * b) const
Map_t &Map_t::operator=(Map_t const &)
Map_t &Map_t::operator=(Map_t const *)
boolMap_t::operator==(Map_t const & b) const
boolMap_t::operator==(Map_t const * b) const
boolMap_t::operator>(Map_t const & b) const
boolMap_t::operator>(Map_t const * b) const
boolMap_t::operator>=(Map_t const & b) const
boolMap_t::operator>=(Map_t const * b) const
Map_t &Map_t::clear()
Map_t &Map_t::clear(bool k, bool v)
Map_t &Map_t::clear_no_resize()
intMap_t::cmp(Map_t const * other) const
intMap_t::cmp(Map_t const & other) const
Map_t *Map_t::copy() const
Map_t *Map_t::copy_err(int * err) const
boolMap_t::equal(Map_t const * other) const
boolMap_t::equal(Map_t const & other) const
Map_t &Map_t::erase(iTypeTouched i)
Map_t &Map_t::erase(Map_t const & other)
Map_t &Map_t::erase(Map_t const * other)
Map_t &Map_t::erase_map(Map_t const & other)
Map_t &Map_t::erase_map(Map_t const * other)
Map_t &Map_t::insert(iTypeTouched k)
Map_t &Map_t::insert(iTypeTouched k, oTypeTouched v)
Map_t &Map_t::insert(Map_t const & other)
Map_t &Map_t::insert(Map_t const * other)
Map_t &Map_t::insert_map(Map_t const & other)
Map_t &Map_t::insert_map(Map_t const * other)
Map_t &Map_t::intersect(Map_t const & other)
Map_t &Map_t::intersect(Map_t const * other)
Map_t &Map_t::intersect_no_resize(Map_t const & other)
Map_t &Map_t::intersect_no_resize(Map_t const * other)
Map_t &Map_t::modify(Map_t const & other)
Map_t &Map_t::modify(Map_t const * other)
Map_t &Map_t::modify_map(Map_t const & other)
Map_t &Map_t::modify_map(Map_t const * other)
Map_t &Map_t::poke(iType * kp, iTypeTouched k, bool aintroduce = true)
Map_t &Map_t::poke(iType * kp, oTypeVar * vo, iTypeTouched k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)
Map_t &Map_t::poke_no_icopy(iType * kp, iTypeVarParam k, bool aintroduce = true)
Map_t &Map_t::poke_no_icopy(iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeTouched v, bool aintroduce = true, bool aoverwrite = true)
Map_t &Map_t::poke_no_icopy_no_ocopy(iType * kp, oTypeVar * vo, iTypeVarParam k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)
Map_t &Map_t::poke_no_ocopy(iType * kp, oTypeVar * vo, iTypeTouched k, oTypeVarParam v, bool aintroduce = true, bool aoverwrite = true)
Map_t &Map_t::rehash(int n)
Map_t &Map_t::remove_map(Map_t const & other)
Map_t &Map_t::remove_map(Map_t const * other)
Map_t &Map_t::set(iTypeTouched i, oTypeTouched v)
Map_t &Map_t::set(Map_t const & other)
Map_t &Map_t::set(Map_t const * other)
Map_t &Map_t::set_map(Map_t const & other)
Map_t &Map_t::set_map(Map_t const * other)
Map_t &Map_t::xchg(Map_t * other)
Map_t &Map_t::xchg(Map_t & other)

Index

Stoppt die Vorratsdatenspeicherung
November 26th, 2007
Comments? Suggestions? Corrections? You can drop me a line.
zpentrabvagiktu@theiling.de
Schwerpunktpraxis