libvdo
VdoMap Class Reference

A class representing a dictionary mapping keys to values. More...

#include <vdo-map.h>

Detailed Description

A class representing a dictionary mapping keys to values.

A VdoMap object supports getting/settings properties in the form of key/value pairs with values of the following types.

  • boolean
  • byte
  • uint16, uint32, uint64
  • uint32x2, uint32x4
  • int16, int32, int64
  • double
  • doublex4
  • string

The key is always the name of the property as a string. A VdoMap object does not support duplicate keys. NULL or the empty string "" are not valid keys.

A VdoMap supports different operations to test if maps contains a specific key or set of keys, for example:

gboolean contains = FALSE;
contains = vdo_map_contains(map, "key");
contains = vdo_map_contains_va(map, "key1", "key2", "key3", NULL);
const gchar *keys[] = { "key1", "key2", "key3", };
contains = vdo_map_contains_strv(map, keys);
gboolean vdo_map_contains_strv(const VdoMap *self, const gchar *const *names)
Checks if this map contains the specified set of keys.
gboolean vdo_map_contains_va(const VdoMap *self,...)
Checks if this map contains the specified set of keys.
gboolean vdo_map_contains(const VdoMap *self, const gchar *name)
Checks if this map contains the specified key.

A VdoMap also supports different operations to test two maps, or a subset of two maps for equality, for example:

gboolean equals = FALSE;
equals = vdo_map_equals(map1, map2);
equals = vdo_map_equals_va(map1, map2, "key1", "key2", "key3", NULL);
const gchar *keys[] = { "key1", "key2", "key3", };
equals = vdo_map_equals_strv(map1, map2, keys);
gboolean vdo_map_equals(const VdoMap *self, const VdoMap *map)
Checks if all entries in this map and the specified map are equal.
gboolean vdo_map_equals_strv(const VdoMap *self, const VdoMap *map, const gchar *const *names)
Checks if all of the specified entries in this map and the specified map are equal.
gboolean vdo_map_equals_va(const VdoMap *self, const VdoMap *map,...)
Checks if all of the specified entries in this map and the specified map are equal.
Examples
vdo-example-blocking.cc, vdo-example-channel-filter.cc, and vdo-example.cc.