]> git.donarmstrong.com Git - lilypond.git/blobdiff - src/voice.cc
release: 0.0.21
[lilypond.git] / src / voice.cc
index 14883e149966d9997b6029168cd9e297cfb1c1ec..9c474f81bb851a84f696231de45b8bdb2ce37836 100644 (file)
@@ -1,5 +1,6 @@
 #include "debug.hh"
 #include "voice.hh"
+#include "request.hh"
 
 Voice::Voice(Voice const&src)
 {
@@ -15,25 +16,25 @@ Voice::Voice()
 void
 Voice::add(Voice_element*v)
 {
+    v->voice_ = this;
     elts.bottom().add(v);
 }
 
 void
 Voice::print() const
 {
-        #ifndef NPRINT
-
+#ifndef NPRINT
     mtor << "start: "<< start<<eol;
-    for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
+    for (iter_top(elts,vec); vec.ok(); vec++)
        vec->print();
 #endif
 }
 
-Real
+Moment
 Voice::last() const
 {
-    Real l =start;
-    for (PCursor<Voice_element*> vec(elts); vec.ok(); vec++)
+    Moment l =start;
+    for (iter_top(elts,vec); vec.ok(); vec++)
        l  += vec->duration;
     return l;
 }
@@ -43,7 +44,7 @@ Voice_element::print() const
 {
 #ifndef NPRINT
     mtor << "voice_element { dur :"<< duration <<"\n";
-    for (PCursor<Request*> rc(reqs); rc.ok(); rc++) {
+    for (iter_top(reqs,rc); rc.ok(); rc++) {
        rc->print();
     }
     mtor << "}\n";
@@ -63,7 +64,7 @@ Voice_element::add(Request*r)
 
 Voice_element::Voice_element()
 {
-    voice = 0;
+    voice_ = 0;
     group = 0;
     duration = 0.0;
 }
@@ -71,8 +72,8 @@ Voice_element::Voice_element()
 Voice_element::Voice_element(Voice_element const&src)
 {
     duration=src.duration;
-    voice=src.voice;
-    PointerList__copy(Request*, reqs, src.reqs, clone());
+    voice_=src.voice_;
+    IPointerList__copy(Request*, reqs, src.reqs, clone());
     group=src.group;
-    assert(!granted_items.size() && !granted_spanners.size());
+//    assert(!granted_items.size() && !granted_spanners.size());
 }