/
datafactory.cpp
88 lines (69 loc) · 1.91 KB
/
datafactory.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include "datafactory.h"
#include "expressionmatrix.h"
#include "ccmatrix.h"
#include "correlationmatrix.h"
#include "cpmatrix.h"
#include "conditionspecificclustersmatrix.h"
using namespace std;
/*!
* Return the total number of data types this program implements.
*/
quint16 DataFactory::size() const
{
EDEBUG_FUNC(this);
return Total;
}
/*!
* Return the display name for the given data type.
*
* @param type
*/
QString DataFactory::name(quint16 type) const
{
EDEBUG_FUNC(this,type);
switch (type)
{
case ExpressionMatrixType: return "Expression Matrix";
case CCMatrixType: return "Cluster Matrix";
case CorrelationMatrixType: return "Correlation Matrix";
case CPMatrixType: return "Cluster Parameter Matrix";
case CSMatrixType: return "Condition-Specific Clusters Matrix";
default: return QString();
}
}
/*!
* Return the file extension for the given data type as a string.
*
* @param type
*/
QString DataFactory::fileExtension(quint16 type) const
{
EDEBUG_FUNC(this,type);
switch (type)
{
case ExpressionMatrixType: return "emx";
case CCMatrixType: return "ccm";
case CorrelationMatrixType: return "cmx";
case CPMatrixType: return "cpm";
case CSMatrixType: return "csm";
default: return QString();
}
}
/*!
* Make and return a new abstract data object of the given type.
*
* @param type
*/
unique_ptr<EAbstractData> DataFactory::make(quint16 type) const
{
EDEBUG_FUNC(this,type);
switch (type)
{
case ExpressionMatrixType: return unique_ptr<EAbstractData>(new ExpressionMatrix);
case CCMatrixType: return unique_ptr<EAbstractData>(new CCMatrix);
case CorrelationMatrixType: return unique_ptr<EAbstractData>(new CorrelationMatrix);
case CPMatrixType: return unique_ptr<EAbstractData>(new CPMatrix);
case CSMatrixType: return unique_ptr<CSMatrix>(new CSMatrix);
default: return nullptr;
}
}