32 #include <boost/shared_ptr.hpp>
45 template <
class KeyT,
class ValT>
55 typedef typename StorageType::iterator
iterator;
69 virtual bool IsNull()
const {
return false;}
76 iterator
begin() {
return m_values.begin();}
77 const_iterator
begin()
const {
return m_values.begin();}
79 iterator
end() {
return m_values.end();}
80 const_iterator
end()
const {
return m_values.end();}
82 iterator
find(
const KeyType& key) {
return m_values.find(key);}
83 const_iterator
find(
const KeyType& key)
const {
return m_values.find(key);}
85 size_t size()
const {
return m_values.size();}
87 bool empty()
const {
return m_values.empty();}
89 size_t count(
const KeyType& key)
const {
return m_values.count(key);}
93 iterator it=m_values.find(key);
94 if (it!=m_values.end())
101 ValueContainerType& ct=m_values[key];
118 for (const_iterator it=m_values.begin(); it!=m_values.end(); ++it)
120 if (it->second.IsChanged())
134 for (iterator it=m_values.begin(); it!=m_values.end(); ++it)
136 it->second.SetChanged(changed);
151 void Insert(
const KeyType& key,
const ContainedType& val)
154 ValueContainerType container;
155 InsertHelper<ContainedType, ValueContainerType>::SetVal(val, container);
156 container.SetChanged(
true);
162 size_t count=m_values.erase(key);
179 if (
typeid(*
this) !=
typeid(that))
189 for (const_iterator it=other.
begin(); it!=other.
end(); ++it)
191 ValueContainerType val;
192 val.Copy(it->second);
193 m_values.insert(std::make_pair(it->first, val));
199 std::map<KeyT, ValT> m_values;
201 template <
class V,
class C>
struct InsertHelper
203 static void SetVal(
const V& v, C& c) {c.SetVal(v);}
206 template <
class V,
class C>
struct InsertHelper< boost::shared_ptr<V>, C >
208 static void SetVal(
const boost::shared_ptr<V>& v, C& c) {c.SetPtr(v);}
Container class for dictionaries of key value pairs.
Definition: DictionaryContainer.h:46
virtual void SetNull()
Set the container to null.
Definition: DictionaryContainer.h:71
Meant to be used when something goes very wrong.
Definition: Exceptions.h:360
StorageType::iterator iterator
Definition: DictionaryContainer.h:55
#define __WFILE__
Definition: Exceptions.h:31
bool m_bIsChanged
The variable containing the change flag.
Definition: ContainerBase.h:122
This namespace contains all the functionality and definitions of the SAFIR SDK.
Definition: Backdoor.h:30
void Insert(const KeyType &key, const ContainedType &val)
Definition: DictionaryContainer.h:151
StorageType::value_type value_type
Definition: DictionaryContainer.h:56
iterator begin()
Definition: DictionaryContainer.h:76
std::map< KeyType, ValueContainerType > StorageType
Definition: DictionaryContainer.h:53
StorageType::const_iterator const_iterator
Definition: DictionaryContainer.h:54
virtual void Copy(const ContainerBase &that)
Copy - Copy all the members from "that" into "this".
Definition: DictionaryContainer.h:175
virtual void SetChanged(const bool changed)
SetChanged - Set the change state of the sequence.
Definition: DictionaryContainer.h:131
iterator find(const KeyType &key)
Definition: DictionaryContainer.h:82
Base class for all Containers.
Definition: ContainerBase.h:43
iterator end()
Definition: DictionaryContainer.h:79
KeyT KeyType
Definition: DictionaryContainer.h:50
DictionaryContainer()
Default Constructor.
Definition: DictionaryContainer.h:63
ValueContainerType::ContainedType ContainedType
Definition: DictionaryContainer.h:52
ValueContainerType & operator[](const KeyType &key)
Definition: DictionaryContainer.h:91
virtual bool IsNull() const
Is the container set to null?
Definition: DictionaryContainer.h:69
const_iterator find(const KeyType &key) const
Definition: DictionaryContainer.h:83
size_t erase(const KeyType &key)
Definition: DictionaryContainer.h:160
const_iterator begin() const
Definition: DictionaryContainer.h:77
bool empty() const
Definition: DictionaryContainer.h:87
const_iterator end() const
Definition: DictionaryContainer.h:80
size_t count(const KeyType &key) const
Definition: DictionaryContainer.h:89
void clear()
clear - Clear the sequence, i.e remove all values.
Definition: DictionaryContainer.h:144
size_t size() const
Definition: DictionaryContainer.h:85
virtual bool IsChanged() const
IsChanged - Check if the sequence has changed.
Definition: DictionaryContainer.h:111
ValT ValueContainerType
Definition: DictionaryContainer.h:51