ROOT logo
// $Id: ZList.h 2088 2008-11-23 20:26:46Z matevz $

// Copyright (C) 1999-2008, Matevz Tadel. All rights reserved.
// This file is part of GLED, released under GNU General Public License version 2.
// For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/.

#ifndef GledCore_ZList_H
#define GledCore_ZList_H

#include <Glasses/AList.h>

class ZList : public AList
{
  MAC_RNR_FRIENDS(ZList);

  // Element representation

public:
  struct element
  {
    ZGlass* fLens;
    Int_t   fId;
    element(ZGlass* l=0, Int_t i=0) : fLens(l), fId(i) {}
  };

  typedef list<element> container;

  struct iterator : public container::iterator
  {
    ZGlass* lens()  { return (*this)->fLens; }
    ElRep   elrep() { return ElRep((*this)->fLens, (*this)->fId); }

    ZGlass* operator()() { return (*this)->fLens; }

    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

protected:
  Int_t           mNextId;
  container       mElements; //! Problem during TStreamerElement creation (it's getting created despite manual streamer).

private:
  void _init();

protected:
  // From AList
  virtual Int_t remove_references_to(ZGlass* lens);
  virtual void  clear_list();

  // ZList
  virtual void on_insert(iterator iter) {}
  virtual void on_remove(iterator iter) {}
  virtual void on_rebuild() {}

public:
  ZList(const Text_t* n="ZList", const Text_t* t=0) :
    AList(n,t) { _init(); }
  virtual ~ZList() {}

  virtual Int_t RebuildListRefs(An_ID_Demangler* idd);
  virtual void  ClearList();

  //----------------------------------------------------------------------
  // ElRep properties and supported operations.
  //----------------------------------------------------------------------

  virtual ElType_e el_type()             { return ET_Id; }

  virtual bool elrep_has_id()            { return true; }

  virtual bool list_deque_ops()          { return true; }
  virtual bool list_insert_id_ops()      { return true; }

  //----------------------------------------------------------------------
  // List element handling operations.
  //----------------------------------------------------------------------

  // General interface
  virtual void    Add      (ZGlass* lens); // Exported in AList
  virtual Int_t   RemoveAll(ZGlass* lens); // -"-

  // Deque interface
  virtual ZGlass* FrontElement();          // X{E} C{0}
  virtual ZGlass* BackElement();           // X{E} C{0}
  virtual void    PushBack(ZGlass* lens);  // X{E} C{1}
  virtual ZGlass* PopBack();               // X{E} C{0}
  virtual void    PushFront(ZGlass* lens); // X{E} C{1}
  virtual ZGlass* PopFront();              // X{E} C{0}

  // Insert-by-id interface
  virtual void InsertById(ZGlass* lens, Int_t before_id);      // X{E} C{1}
  virtual void RemoveById(Int_t id_to_remove);                 // X{E} C{0}

  Int_t FindFirst(ZGlass* lens);

  // Pure ZList.

  virtual void SortByName();               // X{ED} 7 MButt()

  // Interface for direct placement of config entries (start-up only).

  ZList* AssertPath(const Text_t* path,
                    const Text_t* new_el_type="ZList"); // X{Ed}
  void Swallow(ZGlass* entry, Bool_t replace_p=true,
	       const Text_t* path="",
	       const Text_t* new_el_type="ZList");
  void Swallow(const Text_t* path, ZGlass* entry);

#include "ZList.h7"
  ClassDef(ZList, 1); // Standard list.
}; // endclass ZList


#endif
 ZList.h:1
 ZList.h:2
 ZList.h:3
 ZList.h:4
 ZList.h:5
 ZList.h:6
 ZList.h:7
 ZList.h:8
 ZList.h:9
 ZList.h:10
 ZList.h:11
 ZList.h:12
 ZList.h:13
 ZList.h:14
 ZList.h:15
 ZList.h:16
 ZList.h:17
 ZList.h:18
 ZList.h:19
 ZList.h:20
 ZList.h:21
 ZList.h:22
 ZList.h:23
 ZList.h:24
 ZList.h:25
 ZList.h:26
 ZList.h:27
 ZList.h:28
 ZList.h:29
 ZList.h:30
 ZList.h:31
 ZList.h:32
 ZList.h:33
 ZList.h:34
 ZList.h:35
 ZList.h:36
 ZList.h:37
 ZList.h:38
 ZList.h:39
 ZList.h:40
 ZList.h:41
 ZList.h:42
 ZList.h:43
 ZList.h:44
 ZList.h:45
 ZList.h:46
 ZList.h:47
 ZList.h:48
 ZList.h:49
 ZList.h:50
 ZList.h:51
 ZList.h:52
 ZList.h:53
 ZList.h:54
 ZList.h:55
 ZList.h:56
 ZList.h:57
 ZList.h:58
 ZList.h:59
 ZList.h:60
 ZList.h:61
 ZList.h:62
 ZList.h:63
 ZList.h:64
 ZList.h:65
 ZList.h:66
 ZList.h:67
 ZList.h:68
 ZList.h:69
 ZList.h:70
 ZList.h:71
 ZList.h:72
 ZList.h:73
 ZList.h:74
 ZList.h:75
 ZList.h:76
 ZList.h:77
 ZList.h:78
 ZList.h:79
 ZList.h:80
 ZList.h:81
 ZList.h:82
 ZList.h:83
 ZList.h:84
 ZList.h:85
 ZList.h:86
 ZList.h:87
 ZList.h:88
 ZList.h:89
 ZList.h:90
 ZList.h:91
 ZList.h:92
 ZList.h:93
 ZList.h:94
 ZList.h:95
 ZList.h:96
 ZList.h:97
 ZList.h:98
 ZList.h:99
 ZList.h:100
 ZList.h:101
 ZList.h:102
 ZList.h:103
 ZList.h:104
 ZList.h:105
 ZList.h:106
 ZList.h:107
 ZList.h:108
 ZList.h:109
 ZList.h:110
 ZList.h:111
 ZList.h:112
 ZList.h:113
 ZList.h:114
 ZList.h:115
 ZList.h:116
 ZList.h:117
 ZList.h:118
 ZList.h:119
 ZList.h:120
 ZList.h:121
 ZList.h:122
 ZList.h:123
 ZList.h:124
 ZList.h:125
 ZList.h:126
 ZList.h:127