1 | #include "transformation.hpp" |
---|
2 | #include "type.hpp" |
---|
3 | #include "duration.hpp" |
---|
4 | #include "context.hpp" |
---|
5 | #include <iterator> |
---|
6 | |
---|
7 | namespace xios { |
---|
8 | |
---|
9 | /// ////////////////////// Définitions ////////////////////// /// |
---|
10 | |
---|
11 | CTransformation::CTransformation(void) |
---|
12 | : CObjectTemplate<CTransformation>(), CTransformationAttributes() |
---|
13 | { /* Ne rien faire de plus */ } |
---|
14 | |
---|
15 | CTransformation::CTransformation(const StdString & id) |
---|
16 | : CObjectTemplate<CTransformation>(id), CTransformationAttributes() |
---|
17 | { /* Ne rien faire de plus */ } |
---|
18 | |
---|
19 | CTransformation::~CTransformation(void) |
---|
20 | {} |
---|
21 | |
---|
22 | //---------------------------------------------------------------- |
---|
23 | |
---|
24 | StdString CTransformation::GetName(void) { return StdString("transformation"); } |
---|
25 | StdString CTransformation::GetDefName(void) { return StdString("transformation"); } |
---|
26 | ENodeType CTransformation::GetType(void) { return eTransformation; } |
---|
27 | |
---|
28 | StdString transTypeTmp[] = {"inverse", "zoom" }; |
---|
29 | CTransformation::TransformationId transTypeIdTmp[] = {CTransformation::TRANS_ID_INVERSE, CTransformation::TRANS_ID_ZOOM}; |
---|
30 | std::vector<StdString> CTransformation::TransformationTypes = std::vector<StdString>(transTypeTmp, transTypeTmp + sizeof(transTypeTmp) / sizeof(StdString)); |
---|
31 | std::vector<CTransformation::TransformationId> CTransformation::TransformationTypeIds = std::vector<CTransformation::TransformationId>(transTypeIdTmp, transTypeIdTmp + sizeof(transTypeIdTmp) / sizeof(CTransformation::TransformationId)); |
---|
32 | //---------------------------------------------------------------- |
---|
33 | |
---|
34 | void CTransformation::checkAttributes() |
---|
35 | { |
---|
36 | if (this->type.isEmpty()) |
---|
37 | ERROR("CTransformation::checkAttributes(void)", |
---|
38 | << "Attribute <type> of the transformation in the context = '" |
---|
39 | << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); |
---|
40 | StdString transformationTypeStr = this->type.getValue(); |
---|
41 | |
---|
42 | std::vector<StdString>::const_iterator itbTrans = TransformationTypes.begin(), itTrans, |
---|
43 | iteTrans = TransformationTypes.end(); |
---|
44 | itTrans = std::find(itbTrans, iteTrans,transformationTypeStr); |
---|
45 | if (TransformationTypes.end() == itTrans) |
---|
46 | { |
---|
47 | StdString msgTmp; |
---|
48 | for (std::vector<StdString>::const_iterator it = itbTrans; it != iteTrans; ++it) |
---|
49 | msgTmp += *it + ", "; |
---|
50 | ERROR("CTransformation::checkAttributes(void)", |
---|
51 | << "Attribute <type = " << transformationTypeStr << " > is invalid" |
---|
52 | << "It should be one of following: " << msgTmp); |
---|
53 | } |
---|
54 | |
---|
55 | // if (this->axis_ref.isEmpty() && this->domain_ref.isEmpty()) |
---|
56 | // ERROR("CTransformation::checkAttributes(void)", |
---|
57 | // << "Attribute <axis_ref> or <domain_ref> of the transformation in the context = '" |
---|
58 | // << CObjectFactory::GetCurrentContextId() << "' ] must be specified"); |
---|
59 | |
---|
60 | |
---|
61 | checkAttributesType(TransformationTypeIds[std::distance(itbTrans, itTrans)]); |
---|
62 | } |
---|
63 | |
---|
64 | void CTransformation::checkAttributesType(TransformationId& typeId) |
---|
65 | { |
---|
66 | switch (typeId) { |
---|
67 | case TRANS_ID_ZOOM: |
---|
68 | checkAttributesZoomType(); |
---|
69 | break; |
---|
70 | case TRANS_ID_INVERSE: |
---|
71 | checkAttributesInverseType(); |
---|
72 | break; |
---|
73 | default: |
---|
74 | ERROR("CTransformation::checkAttributesType(TransformationId& typeId)", |
---|
75 | << "Type = " << typeId << " is invalid"); |
---|
76 | } |
---|
77 | } |
---|
78 | |
---|
79 | void CTransformation::checkAttributesZoomType() |
---|
80 | { |
---|
81 | |
---|
82 | } |
---|
83 | |
---|
84 | void CTransformation::checkAttributesInverseType() |
---|
85 | { |
---|
86 | |
---|
87 | } |
---|
88 | |
---|
89 | } |
---|