]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/include/plist.hh
release: 0.1.12
[lilypond.git] / flower / include / plist.hh
index 1fc4d941ab0851e6890a32c92cc10b8915247700..f30c98ca5af0d0b3ab888e453372c4710aab1f36 100644 (file)
 /**
   A list of pointers.
   
-  Use for list of pointers, e.g. PointerList<AbstractType*>. 
+  Use for list of pointers, e.g. Link_list<AbstractType*>. 
   This class does no deletion of the pointers, but it knows how to
   copy itself (shallow copy). We could have derived it from List<T>,
-  but this design saves a lot of code dup; for all PointerLists in the
+  but this design saves a lot of code dup; for all Link_lists in the
   program only one parent List<void*> is instantiated.
   */
 template<class T>
-class PointerList : public List<void *>
+class Link_list : public List<void *>
 {
- public:
-    PCursor<T> top() const{
-       return PCursor<T> (List<void*>::top());
-    }
-    PCursor<T> bottom() const {
-       return PCursor<T> (List<void*>::bottom());
-    }
-    PCursor<T> find(T) const;
-    void concatenate(PointerList<T> const &s) { List<void*>::concatenate(s); }
-    PointerList() {}
+public:
+  PCursor<T> top() const{
+    return PCursor<T> (List<void*>::top());
+  }
+  PCursor<T> bottom() const {
+    return PCursor<T> (List<void*>::bottom());
+  }
+  PCursor<T> find (T) const;
+  void concatenate (Link_list<T> const &s) { List<void*>::concatenate (s); }
+
+  Link_list() {}
 };
 
-/**   PointerList which deletes pointers given to it. 
+/**   
+  
+  Link_list which deletes pointers given to it. 
+
   NOTE:
   
   The copy constructor doesn't do what you'd want:
   Since T might have a virtual ctor, we don't try to do a
 
-    new T(*cursor)
+    new T(**cursor)
 
-  You have to copy this yourself, or use the macro PointerList__copy
+  You have to copy this yourself, or use the macro Link_list__copy
   
+  TODO
+  operator =()
   */
 template<class T>
-class IPointerList : public PointerList<T> {
+class Pointer_list : public Link_list<T> {
+    
 public:
-    IPointerList(IPointerList const &) { set_empty(); }
-    IPointerList() { }
-    ~IPointerList();
+  void junk();
+  Pointer_list (Pointer_list const &) { set_empty(); }
+  Pointer_list() { }
+  ~Pointer_list() { junk (); }
 };
 
-#define IPointerList__copy(T, to, from, op)   \
-  for (PCursor<T> _pc_(from); _pc_.ok(); _pc_++)\
-      to.bottom().add(_pc_->op)\
-  \
+#define Pointer_list__copy(T, to, from, op)   \
+for (PCursor<T> _pc_(from); _pc_.ok(); _pc_++)\
+to.bottom().add (_pc_->op)\
+\
 
 
 template<class T>
-void PL_copy(IPointerList<T*> &dst,IPointerList<T*> const&src);
+void PL_copy (Pointer_list<T*> &dst,Pointer_list<T*> const&src);
 
 
-#define PL_instantiate(a)  template class PointerList<a*>; \
-       template class PCursor<a*>;
-#define IPL_instantiate(a) PL_instantiate(a); \
-       template class IPointerList<a*>
 
 #include "plist.icc"