source: branches/profile/MULTI_PROBE/MP_probe_tabs.cxx

Last change on this file was 11571, checked in by westram, 10 years ago
  • silence some clang warnings
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1// ============================================================= //
2//                                                               //
3//   File      : MP_probe_tabs.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
14#include <cmath>
15
16// **************************************************************
17void probe_tabs::print()
18{
19    int i;
20
21
22    printf("**********************\n");
23    printf("GRUPPENTABELLE:\n");
24    for (i=0; i< length_of_group_tabs; i++)
25        printf("%d  %d \n", i, group_tab[i]);
26
27    printf("NON_GRUPPENTABELLE:\n");
28    for (i=0; i< length_of_group_tabs; i++)
29        printf("%d %d\n", i, non_group_tab[i]);
30
31    printf("**********************\n");
32
33}
34
35probe_tabs *probe_tabs::duplicate()
36{
37    int  i;
38    int *new_group_field     = new int[length_of_group_tabs];
39    int *new_non_group_field = new int[length_of_group_tabs];
40
41    for (i=0; i< length_of_group_tabs; i++)
42        new_group_field[i] = group_tab[i];
43
44
45    for (i=0; i< length_of_group_tabs; i++)
46        new_non_group_field[i] = non_group_tab[i];
47
48    return  new probe_tabs(new_group_field, new_non_group_field, length_of_group_tabs);
49}
50
51
52probe_tabs::probe_tabs(int *new_group_field, int *new_non_group_field, int len_group) {
53    int length;
54    memset((void*)this, 0, sizeof(probe_tabs)); // @@@ potentially dangerous (overwrites vtable pointer!)
55
56    if (new_group_field)                                // Duplicate !!!
57    {
58        group_tab = new_group_field;
59        non_group_tab = new_non_group_field;
60        length_of_group_tabs = len_group;
61    }
62    else
63    {
64        length = (int)(pow(3.0, (double)mp_gl_awars.no_of_probes));
65        group_tab = new int[length];
66        memset(group_tab, 0, sizeof(int)*length);
67        non_group_tab = new int[length];
68        memset(non_group_tab, 0, sizeof(int)*length);
69        length_of_group_tabs = length;
70    }
71}
72
73probe_tabs::~probe_tabs()
74{
75    delete [] group_tab;
76    delete [] non_group_tab;
77}
Note: See TracBrowser for help on using the repository browser.