IsoSpec  1.95
cwrapper.h
1 /*
2  * Copyright (C) 2015-2018 Mateusz Łącki and Michał Startek.
3  *
4  * This file is part of IsoSpec.
5  *
6  * IsoSpec is free software: you can redistribute it and/or modify
7  * it under the terms of the Simplified ("2-clause") BSD licence.
8  *
9  * IsoSpec is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * You should have received a copy of the Simplified BSD Licence
14  * along with IsoSpec. If not, see <https://opensource.org/licenses/BSD-2-Clause>.
15  */
16 
17 #pragma once
18 
19 #define ISOSPEC_ALGO_LAYERED 0
20 #define ISOSPEC_ALGO_ORDERED 1
21 #define ISOSPEC_ALGO_THRESHOLD_ABSOLUTE 2
22 #define ISOSPEC_ALGO_THRESHOLD_RELATIVE 3
23 #define ISOSPEC_ALGO_LAYERED_ESTIMATE 4
24 
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #else
29 #include <stdbool.h>
30 #endif
31 
32 void * setupIso(int dimNumber,
33  const int* isotopeNumbers,
34  const int* atomCounts,
35  const double* isotopeMasses,
36  const double* isotopeProbabilities);
37 
38 void deleteIso(void* iso);
39 
40 #define ISOSPEC_C_FN_HEADER(generatorType, dataType, method)\
41 dataType method##generatorType(void* generator);
42 
43 #define ISOSPEC_C_FN_HEADER_GET_CONF_SIGNATURE(generatorType)\
44 void method##generatorType(void* generator);
45 
46 #define ISOSPEC_C_FN_HEADERS(generatorType)\
47 ISOSPEC_C_FN_HEADER(generatorType, double, mass) \
48 ISOSPEC_C_FN_HEADER(generatorType, double, lprob) \
49 ISOSPEC_C_FN_HEADER(generatorType, double, prob) \
50 ISOSPEC_C_FN_HEADER_GET_CONF_SIGNATURE(generatorType) \
51 ISOSPEC_C_FN_HEADER(generatorType, bool, advanceToNextConfiguration) \
52 ISOSPEC_C_FN_HEADER(generatorType, void, delete)
53 
54 
55 
56 
57 //______________________________________________________THRESHOLD GENERATOR
58 void* setupIsoThresholdGenerator(void* iso,
59  double threshold,
60  bool _absolute,
61  int _tabSize,
62  int _hashSize);
63 ISOSPEC_C_FN_HEADERS(IsoThresholdGenerator)
64 
65 
66 //______________________________________________________LAYERED GENERATOR
67 void* setupIsoLayeredGenerator(void* iso,
68  double _target_coverage,
69  double _percentage_to_expand,
70  int _tabSize,
71  int _hashSize,
72  bool _do_trim);
73 ISOSPEC_C_FN_HEADERS(IsoLayeredGenerator)
74 
75 //______________________________________________________ORDERED GENERATOR
76 void* setupIsoOrderedGenerator(void* iso,
77  int _tabSize,
78  int _hashSize);
79 ISOSPEC_C_FN_HEADERS(IsoOrderedGenerator)
80 
81 
82 
83 void* setupThresholdTabulator(void* generator,
84  bool get_masses,
85  bool get_probs,
86  bool get_lprobs,
87  bool get_confs);
88 
89 void deleteThresholdTabulator(void* tabulator);
90 
91 const double* massesThresholdTabulator(void* tabulator);
92 const double* lprobsThresholdTabulator(void* tabulator);
93 const double* probsThresholdTabulator(void* tabulator);
94 const int* confsThresholdTabulator(void* tabulator);
95 int confs_noThresholdTabulator(void* tabulator);
96 
97 
98 
99 void* setupLayeredTabulator(void* generator,
100  bool get_masses,
101  bool get_probs,
102  bool get_lprobs,
103  bool get_confs);
104 
105 void deleteLayeredTabulator(void* tabulator);
106 
107 const double* massesLayeredTabulator(void* tabulator);
108 const double* lprobsLayeredTabulator(void* tabulator);
109 const double* probsLayeredTabulator(void* tabulator);
110 const int* confsLayeredTabulator(void* tabulator);
111 int confs_noLayeredTabulator(void* tabulator);
112 
113 void freeReleasedArray(void* array);
114 
115 #ifdef __cplusplus
116 }
117 #endif
118