MCPcopy Create free account
hub / github.com/MITK/MITK / Write

Method Write

Modules/ContourModel/src/IO/mitkContourModelWriter.cpp:90–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

88}
89
90void mitk::ContourModelWriter::Write()
91{
92 std::ostream *out;
93 std::ofstream outStream;
94
95 if (this->GetOutputStream())
96 {
97 out = this->GetOutputStream();
98 }
99 else
100 {
101 outStream.open(this->GetOutputLocation().c_str());
102 out = &outStream;
103 }
104
105 if (!out->good())
106 {
107 mitkThrow() << "Stream not good.";
108 }
109
110 std::locale previousLocale(out->getloc());
111 out->imbue(std::locale::classic());
112
113 /*+++++++++++ Here the actual xml writing begins +++++++++*/
114
115 /*++++ <?xml version="1.0" encoding="utf-8"?> ++++*/
116 if (m_WriteXMLHeader)
117 WriteXMLHeader(*out);
118
119 //
120 // for each input object write its xml representation to
121 // the stream
122 //
123 mitk::ContourModel::ConstPointer contourModel = dynamic_cast<const mitk::ContourModel *>(this->GetInput());
124 assert(contourModel.IsNotNull());
125 WriteXML(contourModel.GetPointer(), *out);
126
127 out->imbue(previousLocale);
128
129 if (!out->good()) // some error during output
130 {
131 throw std::ios_base::failure("Some error during contour writing.");
132 }
133}
134
135mitk::ContourModelWriter *mitk::ContourModelWriter::Clone() const
136{

Callers 2

SerializeMethod · 0.45
SerializeMethod · 0.45

Calls 6

GetOutputStreamMethod · 0.80
GetOutputLocationMethod · 0.80
IsNotNullMethod · 0.80
GetPointerMethod · 0.80
openMethod · 0.45
GetInputMethod · 0.45

Tested by

no test coverage detected