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