Oracle Coherence for C++ API


boxing_map Class Template Reference

#include <coherence/stl/boxing_map.hpp>

Inherits adapter_map< coherence::lang::BoxHandle< K, K::BoxedType, false >, coherence::lang::BoxHandle< V, V::BoxedType, false > >.

List of all members.

Detailed Description

template<class K, class V>
class coherence::stl::boxing_map< K, V >

boxing_map provides an STL-like map adapter around a coherence::util::map, and additionally auto-boxes the keys and values to their corresponding non-managed types.

The key and value template parameters specify the managed class which will be stored in the Map. Other then the definition, the access to the keys and values may use either the managed view type or the corresponding unmanaged type. This also allows for easy copying of mapped entries from a std::map to coherence maps and caches.

 boxing_map<Managed<Foo>, Managed<Bar> > mycache
         (CacheFactory::getCache("mycache")); // declare boxing adapter

 Foo foo(...); // initialize non-managed object Foo
 Bar bar(...); // initialize non-managed object Bar

 mycache[foo] = bar;         // insert directly into cache via auto-boxing
 Bar barRead = mycache[foo]; // read from cache using auto-boxing

 std::map<Foo, Bar> mymap;
 mymap.insert(mycache.begin(), mycache.end()); // copy from coherence to STL
 mycache.insert(mymap.begin(), mymap.end());   // copy from STL to coherence

See also:
coherence::util::TypedCollections::TypedMap for an Object based equivalent
mf 2008.06.02

Public Types

typedef adapter_map
< BoxHandle< const K,
K::BoxedType, false >,
BoxHandle< const V,
V::BoxedType, false > > 
 Super type.

Public Member Functions

 boxing_map (Map::Holder ohMap=NULL)
 Create new boxing_map from the given Coherence Map.
 boxing_map (const boxing_map &that)
 Create a boxing_map copy.
boxing_mapoperator= (const boxing_map &that)
 Reassign this boxing_map to reference the same Map as another boxing_map.
boxing_mapoperator= (Map::Holder ohMap)
 Reassign this boxing_map to reference another Map.

Constructor & Destructor Documentation

boxing_map ( Map::Holder  ohMap = NULL  )  [inline]

Create new boxing_map from the given Coherence Map.

ohMap the Map to be delegated by the boxing_map.

boxing_map ( const boxing_map< K, V > &  that  )  [inline]

Create a boxing_map copy.

The new boxing_map will reference the same Map, as the original boxing_map.

The documentation for this class was generated from the following file:
Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.