Nuke binary plugins 15.0.5
 
Loading...
Searching...
No Matches
DD::Image::OrderedMap< Key, Value > Class Template Reference

#include <OrderedMap.h>

Public Types

typedef std::map< Key, Value > Map
 
typedef std::vector< Key > Order
 

Public Member Functions

 OrderedMap (const OrderedMap &that)
 
bool hasKey (const Key &key) const
 
const Value & get (const Key &key) const
 
Value & get (const Key &key)
 
void set (const Key &key, const Value &value)
 
size_t erase (const Key &key)
 
Value getAt (size_t index) const
 
Value & getAt (size_t index)
 
void setAt (size_t index, const Value &value)
 
void eraseAt (size_t index)
 
size_t size () const
 
bool empty () const
 
void clear ()
 
size_t indexOf (const Key &key) const
 
const Key & getKeyAt (size_t index) const
 
bool setKeyAt (size_t index, Key newKey)
 

Protected Attributes

Map _map
 
Order _order
 

Detailed Description

template<typename Key, typename Value>
class DD::Image::OrderedMap< Key, Value >

A map-equivalent which records the insertion order of keys.

Access to values is either through key lookup (via the get() method) or through position (via the getAt() method). The set() method will replace an existing item with the same key or, if that key isn't in use yet, will add a new item & record it as the last inserted item.

This class deliberately avoids overloading the [] operator, because it could be confusing as to whether you're looking up by key or by index when your keys have an integral type.

This implementation doesn't (yet!) provide any iterators. For now, if you want to iterate over the values, use a for loop and look up items by position. Sorry.



©2024 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.foundry.com