From: Pedro Lopez-C. <ped...@gm...> - 2006-06-13 20:34:39
|
Hi, I'm going to swap the order of the paragraphs, because I think it helps to understand my arguments. > > A problem comes from the m_noteOnEvents member, which is used to > > calculate note durations. I've changed it to store Event pointers > > instead of Segment::iterator instances, because there is not a single > > recording segment now. > > I guess you could store multiple Segment/iterator pairs. Bulky but > probably not all that inefficient. Yes, I've also considered this way. It has the advantage that this solution doesn't need additional Event or Segment methods, and it is probably faster. It has the problem that it is a hell to understand and to implement. I will try to find some time to do it. Mainly because the promise is efficiency. > > I've added two new methods to the Event class. A private method, > > is_shared(), compares the shared data pointers of two events, and a > > public method isDuplicated() that is used to check if two events have > > the same properties. This last public method is implemented using the > > private is_shared(), because it is easy and quick, although a bit > > dirty. > > Then isDuplicated() should be operator==(const Event &) and should be > made to work (albeit more slowly) even if the events are equal but not > shared. We really don't want the sharing implementation exposed in the > API, and it's quite possible for events to be the same even if their > data pointers differ. I don't have any problem to convert isDuplicated() into the equality operator, but then I would like to implement it comparing first the shared data pointers, and if they match return true immediately. Only if the first comparison fails it would be necessary to compare the number of properties, and if they match compare also the values of them. Do you have yet any concern with this proposal? Of course, I would prefer to remove the new Event and Segment methods if I have success with the other way explained above. Regards, Pedro |