1 | #include "data_output.hpp" |
---|
2 | |
---|
3 | #include "attribute_template_impl.hpp" |
---|
4 | #include "group_template_impl.hpp" |
---|
5 | #include "context.hpp" |
---|
6 | |
---|
7 | namespace xmlioserver |
---|
8 | { |
---|
9 | namespace io |
---|
10 | { |
---|
11 | /// ////////////////////// Définitions ////////////////////// /// |
---|
12 | |
---|
13 | CDataOutput::~CDataOutput(void) |
---|
14 | { /* Ne rien faire de plus */ } |
---|
15 | |
---|
16 | //---------------------------------------------------------------- |
---|
17 | |
---|
18 | void CDataOutput::writeGrid |
---|
19 | (const boost::shared_ptr<tree::CGrid> grid) |
---|
20 | { |
---|
21 | if (grid->domain_ref.isEmpty()) |
---|
22 | ERROR("CONetCDF4Adv::writeGrid(grid)", |
---|
23 | << " domain is not defined !"); |
---|
24 | |
---|
25 | if (grid->axis_ref.isEmpty()) |
---|
26 | { |
---|
27 | this->writeGrid |
---|
28 | (CObjectFactory::GetObject<tree::CDomain>(grid->domain_ref.getValue())); |
---|
29 | } |
---|
30 | else |
---|
31 | { |
---|
32 | this->writeGrid |
---|
33 | (CObjectFactory::GetObject<tree::CDomain>(grid->domain_ref.getValue()), |
---|
34 | CObjectFactory::GetObject<tree::CAxis>(grid->axis_ref.getValue())); |
---|
35 | } |
---|
36 | } |
---|
37 | |
---|
38 | //---------------------------------------------------------------- |
---|
39 | |
---|
40 | void CDataOutput::writeFile |
---|
41 | (const boost::shared_ptr<tree::CFile> file) |
---|
42 | { |
---|
43 | this->writeFile_(file); |
---|
44 | } |
---|
45 | |
---|
46 | //---------------------------------------------------------------- |
---|
47 | |
---|
48 | void CDataOutput::writeGrid |
---|
49 | (const boost::shared_ptr<tree::CDomain> domain, |
---|
50 | const boost::shared_ptr<tree::CAxis> axis) |
---|
51 | { |
---|
52 | this->writeDomain_(domain); |
---|
53 | this->writeAxis_(axis); |
---|
54 | } |
---|
55 | |
---|
56 | //---------------------------------------------------------------- |
---|
57 | |
---|
58 | void CDataOutput::writeGrid |
---|
59 | (const boost::shared_ptr<tree::CDomain> domain) |
---|
60 | { |
---|
61 | this->writeDomain_(domain); |
---|
62 | } |
---|
63 | |
---|
64 | //---------------------------------------------------------------- |
---|
65 | |
---|
66 | void CDataOutput::writeField |
---|
67 | (const boost::shared_ptr<tree::CField> field) |
---|
68 | { |
---|
69 | boost::shared_ptr<tree::CContext> context = |
---|
70 | CObjectFactory::GetObject<tree::CContext>(CObjectFactory::GetCurrentContextId()); |
---|
71 | boost::shared_ptr<date::CCalendar> calendar = context->getCalendar(); |
---|
72 | |
---|
73 | this->writeField_(field); |
---|
74 | this->writeTimeAxis_(field, calendar); |
---|
75 | } |
---|
76 | |
---|
77 | //---------------------------------------------------------------- |
---|
78 | |
---|
79 | void CDataOutput::writeFieldGrid |
---|
80 | (const boost::shared_ptr<tree::CField> field) |
---|
81 | { |
---|
82 | this->writeGrid(field->getRelGrid()); |
---|
83 | } |
---|
84 | |
---|
85 | //---------------------------------------------------------------- |
---|
86 | |
---|
87 | void CDataOutput::writeFieldData(const boost::shared_ptr<tree::CField> field) |
---|
88 | { |
---|
89 | boost::shared_ptr<CGrid> grid = |
---|
90 | CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue()); |
---|
91 | boost::shared_ptr<CDomain> domain = |
---|
92 | CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()); |
---|
93 | |
---|
94 | if (domain->isEmpty()) return; |
---|
95 | this->writeFieldData_(field); |
---|
96 | } |
---|
97 | |
---|
98 | ///---------------------------------------------------------------- |
---|
99 | |
---|
100 | } // namespace io |
---|
101 | } // namespace xmlioserver |
---|