Browse code

removed dynamic exception specifications that are deprecated, regarding issue #14

David Rasp authored on 02/04/2019 15:32:12
Showing1 changed files
... ...
@@ -50,9 +50,9 @@ public:
50 50
 	~MatchMatrix();
51 51
 
52 52
 	/** Set specified entry to 1. */
53
-	void set(std::size_t row, std::size_t column) throw (IndexOutOfBounds, InvalidMatchMatrix);
53
+	void set(std::size_t row, std::size_t column) /*throw (IndexOutOfBounds, InvalidMatchMatrix)*/;
54 54
 	/** Set specified entry to 0. */
55
-	void unset(std::size_t row, std::size_t column) throw (IndexOutOfBounds, InvalidMatchMatrix);
55
+	void unset(std::size_t row, std::size_t column) /*throw (IndexOutOfBounds, InvalidMatchMatrix)*/;
56 56
 
57 57
 	/** Returns number of rows. */
58 58
 	std::size_t getRows();
Browse code

added the Rdisop package (2nd try)

git-svn-id: https://hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Rdisop@27972 bc3139a8-67e5-0310-9ffc-ced21a209358

hpages@fhcrc.org authored on 12/10/2007 19:36:30
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,70 @@
1
+#ifndef IMS_MATCHMATRIX_H
2
+#define IMS_MATCHMATRIX_H
3
+
4
+#include <memory>
5
+#include <map>
6
+#include <ims/base/exception/exception.h>
7
+
8
+namespace ims {
9
+/**
10
+ *
11
+ * @author Tobias Marschall <Tobias.Marschall@CeBiTec.Uni-Bielefeld.DE>
12
+ *
13
+ */
14
+// TODO: where to put this one? Maybe there already is a IndexOutOfBounds Exception somewhere?!?
15
+////////////////////////////////////////////////////////////////////////////////////////
16
+// Anton: temporary workaround is done, in order to compile the code with CC. Redesign is needed!
17
+class IndexOutOfBounds : public Exception {
18
+	public:
19
+		explicit IndexOutOfBounds() : Exception() { }
20
+		explicit IndexOutOfBounds(const std::string& msg) : Exception(msg) { }
21
+};
22
+
23
+class InvalidMatchMatrix : public Exception {
24
+	public:
25
+		explicit InvalidMatchMatrix() : Exception() { }
26
+		explicit InvalidMatchMatrix(const std::string& msg) : Exception(msg) { }
27
+};
28
+////////////////////////////////////////////////////////////////////////////////////////
29
+// TODO: add excact reference to mentioned paper
30
+/** Represents a matrix which contains entries either 0 or 1 and has a staircase property.
31
+ *  See Velis/Sebastians paper on recalibration for exact definition.
32
+ */
33
+class MatchMatrix {
34
+private:
35
+	// The matrix is a staircase matrix, so we only store the start and the end
36
+	// of a run of 1s for each row. If a row is zero, start and end are set to -1
37
+	typedef struct {
38
+		// start of run of 1s
39
+		int start;
40
+		// end of run of 1s
41
+		int end;
42
+	} row_t;
43
+	row_t *matrix;
44
+	std::size_t rows;
45
+public:
46
+	/** Construct MatchMatrix with specified number of rows.
47
+	 *  The number of columns need not be known because of the staircase property.
48
+	 */
49
+	explicit MatchMatrix(std::size_t rows);
50
+	~MatchMatrix();
51
+
52
+	/** Set specified entry to 1. */
53
+	void set(std::size_t row, std::size_t column) throw (IndexOutOfBounds, InvalidMatchMatrix);
54
+	/** Set specified entry to 0. */
55
+	void unset(std::size_t row, std::size_t column) throw (IndexOutOfBounds, InvalidMatchMatrix);
56
+
57
+	/** Returns number of rows. */
58
+	std::size_t getRows();
59
+
60
+	/** Greedily compute one-to-one matches. */
61
+	std::auto_ptr<std::map<int,int> > countMatches();
62
+	/** Similar to countMatches() with the restriction, to allow only real one2one matches
63
+	 * (i.e. matches that are non-ambiguous).
64
+	 */
65
+	std::auto_ptr<std::map<int,int> > countMatchesRestrictive();
66
+};
67
+
68
+}
69
+
70
+#endif