Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::IMap Class Referenceabstract

This interface represents maps, i.e., a key-value based data structure. More...

Inheritance diagram for mi::IMap:
mi::base::Interface_declare< 0xca097e3a, 0x2621, 0x41e7, 0x80, 0xa3, 0x97, 0x2f, 0x0d, 0x56, 0xf8, 0x47, IData_collection > mi::IData_collection mi::base::Interface_declare< 0x1bb2be0f, 0x0dc6, 0x44b2, 0x93, 0xb9, 0xd1, 0xba, 0x6a, 0x31, 0x88, 0x1c, IData > mi::IData mi::base::Interface_declare< 0x2e5f84bc, 0x783a, 0x4551, 0x9f, 0xca, 0x72, 0x2f, 0xb8, 0x38, 0xc4, 0x7c > mi::base::IInterface

Public Member Functions

virtual Size get_length () const =0
 Returns the size of the map. More...
 
virtual bool empty () const =0
 Checks whether the map is empty. More...
 
virtual void clear ()=0
 Removes all keys and their associated values from the map. More...
 
virtual Sint32 insert (const char *key, base::IInterface *value)=0
 Inserts a new key including its value into the map. More...
 
virtual Sint32 erase (const char *key)=0
 Removes a key and its value from the map. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xca097e3a, 0x2621, 0x41e7, 0x80, 0xa3, 0x97, 0x2f, 0x0d, 0x56, 0xf8, 0x47, IData_collection >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IData_collection
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xca097e3a, 0x2621, 0x41e7, 0x80, 0xa3, 0x97, 0x2f, 0x0d, 0x56, 0xf8, 0x47, IData_collection >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

This interface represents maps, i.e., a key-value based data structure.

Maps are either typed or untyped. Keys are always strings. Typed maps enforce all values to be of the same type. The values of typed maps have to be derived from mi::IData. The type name of a typed map is "Map<", followed by the type name the values, and finally ">", e.g., "Map<Sint32>" for a map with values of type mi::Sint32. Initially, a map is empty, i.e., no keys exist.

Untyped maps simply store pointers of type mi::base::IInterface. The type name of an untyped map is "Map<Interface>".

Most methods of mi::IData_collection come in two versions, an index-based and a key-based version. Since a map is a key-based data structure, the key-based variants of the methods of mi::IData_collection are more efficient (constant time). In general, the index-based methods require linear time to compute the key for a given index (in particular for random access patterns). As an exception, accessing the indices in sequence from 0 to get_length()-1 requires only constant time per access (provided the structure of the map is not changed, the values of the keys may change). The mapping of indices to keys is unspecified.

Member Function Documentation

virtual void mi::IMap::clear ( )
pure virtual

Removes all keys and their associated values from the map.

virtual bool mi::IMap::empty ( ) const
pure virtual

Checks whether the map is empty.

Equivalent to get_length() == 0.

virtual Sint32 mi::IMap::erase ( const char *  key)
pure virtual

Removes a key and its value from the map.

Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: key does not exist
virtual Size mi::IMap::get_length ( ) const
pure virtual

Returns the size of the map.

The size of a map is the number of keys in the map.

Implements mi::IData_collection.

virtual Sint32 mi::IMap::insert ( const char *  key,
base::IInterface value 
)
pure virtual

Inserts a new key including its value into the map.

Returns
  • 0: Success.
  • -1: Invalid parameters (NULL pointer).
  • -2: key exists already.
  • -3: value has the wrong type.