Atoms Crowd  7.0.0
MapMetadata.impl.h
1 namespace AtomsCore
2 {
3  template<class T>
4  AtomsPtr<T> MapMetadata::getTypedEntry(const MapMetadata::Key& key)
5  {
6  valueType::iterator it = m_value.find(key);
7  if ((it != m_value.end()) && it->second.get() && (it->second->typeId() == T::staticTypeId()))
8  return std::static_pointer_cast<T>(it->second);
9  else
10  return AtomsPtr<T>();
11  }
12 
13  template<class T>
14  T* MapMetadata::getTypedEntryRaw(const MapMetadata::Key& key)
15  {
16  valueType::iterator it = m_value.find(key);
17  if ((it != m_value.end()) && it->second.get() && (it->second->typeId() == T::staticTypeId()))
18  return static_cast<T*>(it->second.get());
19  return nullptr;
20  }
21 
22  template<class T>
23  AtomsPtr<const T> MapMetadata::getTypedEntry(const MapMetadata::Key& key) const
24  {
25  valueType::const_iterator it = m_value.find(key);
26  if ((it != m_value.end()) && it->second.get() && (it->second->typeId() == T::staticTypeId()))
27  return std::static_pointer_cast<const T>(it->second);
28  else
29  return AtomsPtr<const T>();
30  }
31 
32  MapMetadata::valueType::iterator MapMetadata::begin()
33  {
34  return m_value.begin();
35  }
36 
37  MapMetadata::valueType::iterator MapMetadata::end()
38  {
39  return m_value.end();
40  }
41 
42  MapMetadata::valueType::const_iterator MapMetadata::cbegin() const
43  {
44  return m_value.cbegin();
45  }
46 
47  MapMetadata::valueType::const_iterator MapMetadata::cend() const
48  {
49  return m_value.cend();
50  }
51 
52  MapMetadata::valueType& MapMetadata::data()
53  {
54  return m_value;
55  }
56 
57  const MapMetadata::valueType& MapMetadata::data() const
58  {
59  return m_value;
60  }
61 }
valueType::iterator begin()
Begin iteration.
Definition: MapMetadata.impl.h:32
valueType::const_iterator cbegin() const
Begin const iterator.
Definition: MapMetadata.impl.h:42
std::map< Key, AtomsPtr< Metadata > > valueType
value type
Definition: MapMetadata.h:29
AtomsPtr< T > getTypedEntry(const Key &key)
Get a typed entry.
Definition: MapMetadata.impl.h:4
T * getTypedEntryRaw(const Key &key)
Get a typed entry raw pointer.
Definition: MapMetadata.impl.h:14
valueType::const_iterator cend() const
End const iterator.
Definition: MapMetadata.impl.h:47
valueType::iterator end()
End iteration.
Definition: MapMetadata.impl.h:37
AtomsCore namespace.
Definition: Agent.h:344