[Clam-devel] Re: Patch for Steps of LoadFrom

JunJun wangjun at dsp.ac.cn
Sun Jun 15 19:10:52 PDT 2008


Patch of LoadFromStep2:
to test whether ContiguousSegmentation s(200,marks,marks+nMarks); is equivalent to 
ContiguousSegmetation s(200); s.addArray(marks, marks+nMarks);

Bests,
June
  ----- Original Message ----- 
  From: JunJun 
  To: David García Garzón 
  Cc: clam-devel at llistes.projectes.lafarga.org 
  Sent: Sunday, June 15, 2008 10:39 PM
  Subject: Patch for Steps of LoadFrom 


  > Take just ContiguousSgmentation:
  > 
  > We would like to have a virtual function that receives the array. But current 
  > implementation does not receive a CLAM::Array but it is templated as 
  > iterators which is very convenient for other uses (tests). But template and 
  > virtual are incompatible, the first refactoring would be to turn the template 
  > constructor into a constructor receiving just TData* which i think is 
  > compatible with any current use. Just in case, compile, both the annotator 
  > and the tests and pass the tests.
  > 
  > Once we turned the constructor into a templateless one, lets do an 'Extract 
  > method' refactoring from the constructor for the data filling part. So, for 
  > each Segmentation add the following method:
  > void takeArray(TData * begin, TData * iterator end)
  > {
  >  // copy here the filling code from the constructor
  > }
  > Then substitute the copied code at the constructor by a call to such method.
  > All the test should be working.

  The patch is of the step above.
  Notice that to make the test pass, I made a forced type change (Iterator->TData), and changed the related type (double->float) of the unittests. That is ugly and requires the "Iterator" datatype must be consistent with "TData".

  > 
  > No proceed the same with the rest of the Segmentations sending patches at the 
  > same points.
  > 
  > Create a virtual method takeArray on base Segmentation. Should still compile.
  > 
  > On SegmentationPane, intead of using the three parameters constructor use the 
  > one parameter one and let's call the takeArray method after the switch. All 
  > the segmentations should still work so try them at Annotator as we did some 
  > days ago.
  > 
  > Now, those refactoring have prepared the way for our desired red, the LoadFrom 
  > test. Some hints: you can define an std::istreamstream("With some xml content 
  > to be read") and see how previous tests use the boundsAsString method to get 
  > the actual segmentation content as string.
  > 
  > Now you'll try to use the load but now we have a problem: We are missing the 
  > audioDuration parameter. By now, just set it on the constructor. Here we 
  > would need to change the XML format to add such a bound as part of the XML, 
  > this can break a lot of things so this is the perfect point to have a 
  > meeting.
  > 
  > 
  > -- 
  > David García Garzón
  > (Work) dgarcia at iua dot upf anotherdot es
  > http://www.iua.upf.edu/~dgarcia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20080616/ad0b51cd/attachment-0003.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LoadFromStep2.patch
Type: application/octet-stream
Size: 2569 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20080616/ad0b51cd/attachment-0003.obj>


More information about the clam-devel mailing list