1 | |
---|
2 | #include <iostream> |
---|
3 | #include "elementSnapshot.h" |
---|
4 | #include "mixedTools.h" |
---|
5 | |
---|
6 | elementSnapshot::elementSnapshot() : abstractElement() |
---|
7 | { |
---|
8 | setDefaultValues(); |
---|
9 | setDefaults(); |
---|
10 | elementName_ = nomdElements("snapshot"); |
---|
11 | nbParam_ = elementName_.getElementNbParameters(); |
---|
12 | parametersString_ = new string[nbParam_+1]; |
---|
13 | } |
---|
14 | |
---|
15 | void elementSnapshot::setDefaultValues() |
---|
16 | { |
---|
17 | defaultLabel_ = "shot"; |
---|
18 | } |
---|
19 | |
---|
20 | void elementSnapshot::setDefaults() |
---|
21 | { |
---|
22 | label_ = defaultLabel_; |
---|
23 | } |
---|
24 | |
---|
25 | trivaluedBool elementSnapshot::is_accepted_by_software(nomDeLogiciel soft) const |
---|
26 | { |
---|
27 | return warning; |
---|
28 | } |
---|
29 | |
---|
30 | string* elementSnapshot::getParametersString() const |
---|
31 | { |
---|
32 | int compteur = -1; |
---|
33 | parametersString_[++compteur] = mixedTools::intToString(nbParam_); |
---|
34 | parametersString_[++compteur] = label_; |
---|
35 | |
---|
36 | if ( compteur != nbParam_ ) { |
---|
37 | cerr << " elementSnapshot::getParametersString() : ERROR parameters doesnt match " << endl; |
---|
38 | return NULL; |
---|
39 | } |
---|
40 | return parametersString_; |
---|
41 | } |
---|
42 | |
---|
43 | void elementSnapshot::setParametersString(string* param) |
---|
44 | { |
---|
45 | if ( param == NULL ) |
---|
46 | { |
---|
47 | cerr << " elementSnaphot::setParametersString parameters empty parameter set"; |
---|
48 | return; |
---|
49 | } |
---|
50 | |
---|
51 | int compteur = -1; |
---|
52 | int nbparam = atoi(param[++compteur].c_str()); |
---|
53 | if ( nbparam != nbParam_ ) |
---|
54 | { |
---|
55 | cerr << " elementSnaphot:: setParametersString parameters do not match for a DRIFT"; |
---|
56 | return; |
---|
57 | } |
---|
58 | |
---|
59 | label_ = param[++compteur]; |
---|
60 | } |
---|
61 | |
---|
62 | string elementSnapshot::parmelaOutputFlow() const |
---|
63 | { |
---|
64 | return string(" "); |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | string elementSnapshot::transportOutputFlow() const |
---|
69 | { |
---|
70 | return string(" "); |
---|
71 | } |
---|
72 | |
---|
73 | |
---|
74 | string elementSnapshot::FileOutputFlow() const |
---|
75 | { |
---|
76 | ostringstream sortie; |
---|
77 | sortie << elementName_.getElementLabel() << endl; |
---|
78 | sortie << label_ << endl; |
---|
79 | return sortie.str(); |
---|
80 | } |
---|
81 | |
---|
82 | void elementSnapshot::FileInput(ifstream& ifs) |
---|
83 | { |
---|
84 | ifs >> label_; |
---|
85 | } |
---|
86 | |
---|
87 | string elementSnapshot::print() |
---|
88 | { |
---|
89 | string txt = ""; |
---|
90 | txt += label_; |
---|
91 | return txt; |
---|
92 | } |
---|