[Clam-devel] Patch for Steps of LoadFrom

JunJun wangjun at dsp.ac.cn
Sun Jun 15 07:39:50 PDT 2008


> 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/20080615/aa02175c/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LoadFromStep1.patch
Type: application/octet-stream
Size: 2458 bytes
Desc: not available
URL: <http://lists.clam-project.org/pipermail/clam-devel-clam-project.org/attachments/20080615/aa02175c/attachment-0004.obj>


More information about the clam-devel mailing list