source: tags/ms_r16q3/MULTI_PROBE/MP_GenerationDuplicates.cxx

Last change on this file was 8393, checked in by westram, 12 years ago
  • cppchecked (1.53)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1// ============================================================= //
2//                                                               //
3//   File      : MP_GenerationDuplicates.cxx                     //
4//   Purpose   :                                                 //
5//                                                               //
6//   Institute of Microbiology (Technical University Munich)     //
7//   http://www.arb-home.de/                                     //
8//                                                               //
9// ============================================================= //
10
11#include "MP_probe.hxx"
12#include "MultiProbe.hxx"
13
14bool GenerationDuplicates::insert(probe_combi_statistic *sondenkombi, bool &result, int depth)          // initial muss result true sein
15{
16    int max_depth = mp_gl_awars.no_of_probes;
17
18    if (depth == max_depth)
19    {
20        result = false;
21        return false;
22    }
23
24    if (! next[sondenkombi->get_probe_combi(depth)->probe_index])               // sonde muss auf alle Faelle bis zuletzt eingetragen werden
25    {
26        if (depth == max_depth-1)
27        {
28            next[sondenkombi->get_probe_combi(depth)->probe_index] = new GenerationDuplicates(1);
29            next_mism[sondenkombi->get_probe_combi(depth)->allowed_mismatches] = 1;
30            return true;
31        }
32        else
33        {
34            next[sondenkombi->get_probe_combi(depth)->probe_index] = new GenerationDuplicates(intern_size);
35            next_mism[sondenkombi->get_probe_combi(depth)->allowed_mismatches] = 1;
36            return next[sondenkombi->get_probe_combi(depth)->probe_index]->insert(sondenkombi, result, depth+1);
37        }
38    }
39
40    result = result && next_mism[sondenkombi->get_probe_combi(depth)->allowed_mismatches];
41    next[sondenkombi->get_probe_combi(depth)->probe_index]->insert(sondenkombi, result, depth+1);       // man kann erst ganz unten entscheiden, ob doppelt oder nicht
42    return result;
43}
44
45GenerationDuplicates::GenerationDuplicates(int size)            // size muss die Groesse des Sondenarrays in ProbeValuation enthalten
46{
47    intern_size = size;
48    next = new GenerationDuplicates*[size];
49    next_mism = new int[MAXMISMATCHES];
50    memset(next_mism, 0, MAXMISMATCHES * sizeof(int));
51    memset(next, 0, size * sizeof(GenerationDuplicates*));
52}
53
54GenerationDuplicates::~GenerationDuplicates()
55{
56    for (int i=0; i<intern_size; i++)
57        delete next[i];
58
59    delete [] next_mism;
60    delete next;
61}
Note: See TracBrowser for help on using the repository browser.