19#include <AIDA/IAnnotation.h>
29 bool addItem(
const std::string&
key,
const std::string&
value,
bool sticky =
false )
override;
35 std::string
value(
const std::string&
key )
const override;
41 void setSticky(
const std::string&
key,
bool sticky )
override;
44 int size()
const override;
47 std::string
key(
int index )
const override;
48 std::string
value(
int index )
const override;
51 void reset()
override;
87 unsigned int indexToBeRemoved = iKey->second;
95 std::vector<AnnotationItem> annotationItemsNew;
98 if ( iItem == indexToBeRemoved )
continue;
100 annotationItemsNew.emplace_back( item.m_key, item.m_value, item.m_sticky );
101 m_identifiers.emplace( item.m_key, annotationItemsNew.size() - 1 );
140 std::vector<std::string> itemsToRemove;
141 itemsToRemove.reserve(
size() );
143 if ( !item.m_sticky ) itemsToRemove.push_back( item.m_key );
145 for (
const auto& i : itemsToRemove )
removeItem( i );
Implementation of the AIDA IAnnotation interface class.
void setSticky(const std::string &key, bool sticky) override
Set sticky for a given key.
bool removeItem(const std::string &key) override
Remove the item indicated by a given key.
int size() const override
Get the number of items in the Annotation.
std::string value(const std::string &key) const override
Retrieve the value for a given key.
std::string key(int index) const override
Individual access to the Annotation-items.
std::vector< AnnotationItem > m_annotationItems
The vector of the annotation items.
std::map< std::string, unsigned int > m_identifiers
The map of strings to identifiers.
bool addItem(const std::string &key, const std::string &value, bool sticky=false) override
Add a key/value pair with a given sticky.
void reset() override
Remove all the non-sticky items.
void setValue(const std::string &key, const std::string &value) override
Set value for a given key.
~AnnotationItem()=default
AnnotationItem(std::string k="", std::string v="", bool vis=true)