MCPcopy Create free account
hub / github.com/Kitware/VTK / operator()

Method operator()

IO/XML/vtkXMLWriter.cxx:117–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115 // Specialize for AoS arrays.
116 template <class ValueType>
117 void operator()(vtkAOSDataArrayTemplate<ValueType>* array)
118 {
119 // Get the raw pointer to the array data:
120 ValueType* iter = array->GetPointer(0);
121
122 // generic implementation for fixed component length arrays.
123 size_t blockWords = this->Writer->GetBlockSize() / this->OutWordSize;
124 size_t memBlockSize = blockWords * this->MemWordSize;
125
126 // Prepare a pointer and counter to move through the data.
127 unsigned char* ptr = reinterpret_cast<unsigned char*>(iter);
128 size_t wordsLeft = this->NumWords;
129
130 // Do the complete blocks.
131 vtkXMLWriterHelper::SetProgressPartial(this->Writer, 0);
132 this->Result = true;
133 while (this->Result && (wordsLeft >= blockWords))
134 {
135 if (!vtkXMLWriterHelper::WriteBinaryDataBlock(this->Writer, ptr, blockWords, this->WordType))
136 {
137 this->Result = false;
138 }
139 ptr += memBlockSize;
140 wordsLeft -= blockWords;
141 vtkXMLWriterHelper::SetProgressPartial(
142 this->Writer, static_cast<float>(this->NumWords - wordsLeft) / this->NumWords);
143 }
144
145 // Do the last partial block if any.
146 if (this->Result && (wordsLeft > 0))
147 {
148 if (!vtkXMLWriterHelper::WriteBinaryDataBlock(this->Writer, ptr, wordsLeft, this->WordType))
149 {
150 this->Result = false;
151 }
152 }
153 vtkXMLWriterHelper::SetProgressPartial(this->Writer, 1);
154 }
155
156#if defined(__clang__) && defined(__has_warning)
157#if __has_warning("-Wunused-template")

Callers

nothing calls this directly

Calls 6

WriteBinaryDataBlockFunction · 0.85
GetBlockSizeMethod · 0.80
GetPointerMethod · 0.45
emptyMethod · 0.45
dataMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected