/
bioSeveralFormulas.cc
61 lines (48 loc) · 1.58 KB
/
bioSeveralFormulas.cc
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
//-*-c++-*------------------------------------------------------------
//
// File name : bioSeveralFormulas.cc
// @date Wed Mar 3 17:31:51 2021
// @author Michel Bierlaire
// @version Revision 1.0
//
//--------------------------------------------------------------------
#include "bioSeveralFormulas.h"
#include "bioMemoryManagement.h"
#include "bioDebug.h"
#include "bioSeveralExpressions.h"
bioSeveralFormulas::bioSeveralFormulas(): theFormulas(NULL) {
}
void bioSeveralFormulas::
setExpressions(std::vector<std::vector<bioString> > vectOfExpressionsStrings) {
std::vector<bioExpression*> exprs ;
// Process the formulas
for (std::vector<std::vector<bioString> >::iterator k = vectOfExpressionsStrings.begin() ;
k != vectOfExpressionsStrings.end() ;
++k) {
bioExpression* lastExpression = NULL ;
for (std::vector<bioString>::iterator i = k->begin() ;
i != k->end() ;
++i) {
// As the formula is the last in the list, it will
// be correct at the end of the loop. The other assignments do not
// matter.
lastExpression = processFormula(*i) ;
}
exprs.push_back(lastExpression) ;
}
theFormulas = bioMemoryManagement::the()->get_bioSeveralExpressions(exprs) ;
}
void bioSeveralFormulas::resetExpressions() {
theFormulas = NULL ;
}
bioSeveralFormulas::~bioSeveralFormulas() {
}
bioSeveralExpressions* bioSeveralFormulas::getExpressions() {
return theFormulas ;
}
std::ostream& operator<<(std::ostream &str, const bioSeveralFormulas& x) {
if (x.theFormulas != NULL) {
str << x.theFormulas->print() ;
}
return str ;
}