<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#c7edcc>
<DIV><FONT size=2>> Take just ContiguousSgmentation:</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> We would like to have a virtual function that receives
the array. But current <BR>> implementation does not receive a CLAM::Array
but it is templated as <BR>> iterators which is very convenient for other
uses (tests). But template and <BR>> virtual are incompatible, the first
refactoring would be to turn the template <BR>> constructor into a
constructor receiving just TData* which i think is <BR>> compatible with any
current use. Just in case, compile, both the annotator <BR>> and the tests
and pass the tests.</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> Once we turned the constructor into a templateless one,
lets do an 'Extract <BR>> method' refactoring from the constructor for the
data filling part. So, for <BR>> each Segmentation add the following
method:<BR>> void takeArray(TData * begin, TData * iterator end)<BR>>
{<BR>> // copy here the filling code from the constructor<BR>>
}<BR>> Then substitute the copied code at the constructor by a call to such
method.<BR>> All the test should be working.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>The patch is of the step above.</FONT></DIV>
<DIV><FONT size=2>Notice that to make the test pass, I made a forced type
change (Iterator->TData), and changed the related </FONT><FONT size=2>type
(double->float) of the unittests. That is ugly and requires
the "Iterator" datatype must be consistent with "TData".</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> No proceed the same with the rest of the Segmentations
sending patches at the <BR>> same points.</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> Create a virtual method takeArray on base Segmentation.
Should still compile.</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> On SegmentationPane, intead of using the three parameters
constructor use the <BR>> one parameter one and let's call the takeArray
method after the switch. All <BR>> the segmentations should still work so try
them at Annotator as we did some <BR>> days ago.</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> Now, those refactoring have prepared the way for our
desired red, the LoadFrom <BR>> test. Some hints: you can define an
std::istreamstream("With some xml content <BR>> to be read") and see how
previous tests use the boundsAsString method to get <BR>> the actual
segmentation content as string.</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> Now you'll try to use the load but now we have a problem:
We are missing the <BR>> audioDuration parameter. By now, just set it on the
constructor. Here we <BR>> would need to change the XML format to add such a
bound as part of the XML, <BR>> this can break a lot of things so this is the
perfect point to have a <BR>> meeting.</FONT></DIV>
<DIV><FONT size=2>> </FONT></DIV>
<DIV><FONT size=2>> <BR>> -- <BR>> David Garc¨ªa Garz¨®n<BR>> (Work)
dgarcia at iua dot upf anotherdot es<BR>> <A
href="http://www.iua.upf.edu/~dgarcia">http://www.iua.upf.edu/~dgarcia</A></FONT></DIV></BODY></HTML>