22 #ifndef NDN_CXX_DETAIL_TAG_HOST_HPP
23 #define NDN_CXX_DETAIL_TAG_HOST_HPP
29 #include <type_traits>
55 setTag(std::shared_ptr<T> tag)
const;
67 mutable std::map<int, std::shared_ptr<Tag>> m_tags;
74 static_assert(std::is_convertible_v<T*, Tag*>,
"T must inherit from ndn::Tag");
76 if (
auto it = m_tags.find(T::getTypeId()); it != m_tags.end()) {
77 return std::static_pointer_cast<T>(it->second);
86 static_assert(std::is_convertible_v<T*, Tag*>,
"T must inherit from ndn::Tag");
89 m_tags.erase(T::getTypeId());
92 m_tags[T::getTypeId()] = std::move(tag);
Base class to store tag information, e.g., inside Interest and Data packets.
void removeTag() const
Remove a tag item.
std::shared_ptr< T > getTag() const
Get a tag item.
void setTag(std::shared_ptr< T > tag) const
Set (add or replace) a tag item.