#ifndef GledCore_ZStringMap_H
#define GledCore_ZStringMap_H
#include <Glasses/AList.h>
class ZStringMap : public AList
{
MAC_RNR_FRIENDS(ZStringMap);
public:
typedef map<TString, ZGlass*> container;
typedef pair<TString, ZGlass*> element;
struct iterator : public container::iterator
{
ZGlass* lens() { return (*this)->second; }
ElRep elrep() { return ElRep((*this)->second, (*this)->first); }
ZGlass* operator()() { return (*this)->second; }
iterator& operator++() { container::iterator::operator++(); return *this; }
iterator& operator--() { container::iterator::operator--(); return *this; }
iterator operator++(int) { iterator x(*this); operator++(); return x; }
iterator operator--(int) { iterator x(*this); operator--(); return x; }
iterator() {}
iterator(container::iterator i) : container::iterator(i) {}
};
iterator begin() { return mElements.begin(); }
iterator end() { return mElements.end(); }
#ifndef __CINT__
virtual stepper_base* make_stepper_imp();
#endif
private:
void _init();
protected:
virtual Int_t remove_references_to(ZGlass* lens);
virtual void clear_list();
virtual void on_insert(iterator iter) {}
virtual void on_remove(iterator iter) {}
virtual void on_change(iterator iter, ZGlass* old_lens) {}
virtual void on_change_label(iterator iter, TString old_label) {}
virtual void on_rebuild() {}
container mElements;
TString mAddLensPrefix;
TString mAddLensFormat;
Int_t mAddLensCurId;
public:
ZStringMap(const Text_t* n="ZStringMap", const Text_t* t=0) :
AList(n,t) { _init(); }
virtual ~ZStringMap() {}
virtual Int_t RebuildListRefs(An_ID_Demangler* idd);
virtual void ClearList();
virtual ElType_e el_type() { return ET_Label; }
virtual bool elrep_has_label() { return true; }
virtual bool elrep_can_hold_zero() { return true; }
virtual bool elrep_can_edit_label() { return true; }
virtual bool list_set_label_ops() { return true; }
virtual void Add (ZGlass* lens);
virtual Int_t RemoveAll(ZGlass* lens);
virtual void SetElementByLabel(ZGlass* lens, TString label);
virtual void AddLabel(TString label);
virtual void RemoveLabel(TString label);
virtual void ChangeLabel(TString label, TString new_label);
virtual ZGlass* GetElementByLabel(TString label);
#include "ZStringMap.h7"
ClassDef(ZStringMap, 1);
};
#endif