MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / begin_serialize_complex

Method begin_serialize_complex

dds/DCPS/Xcdr2ValueWriter.cpp:136–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

134}
135
136bool Xcdr2ValueWriter::begin_serialize_complex(Extensibility extensibility, CollectionKind ck,
137 ACE_CDR::ULong seq_map_length)
138{
139 if (!ser_) {
140 if (log_level >= LogLevel::Notice) {
141 ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: Xcdr2ValueWriter::begin_serialize_complex:"
142 " Serializer object is not available\n"));
143 }
144 return false;
145 }
146
147 if (serialize_states_.empty() && extensibility == FINAL) {
148 // The first entry is the total size and does not correspond to any header.
149 ++pos_;
150 }
151
152 if (!serialize_states_.empty()) {
153 const Extensibility enclosing_ek = serialize_states_.top().extensibility;
154 if (extensibility == APPENDABLE || extensibility == MUTABLE) {
155 if (enclosing_ek == MUTABLE) {
156 // The same size is used for both the member header of the enclosing mutable type
157 // and the Dheader of this struct. pos_ was proactively increased by a preceding
158 // call to begin_*_member of the containing type.
159 --pos_;
160 }
161 }
162 }
163
164 // Write Dheader
165 if (extensibility == APPENDABLE || extensibility == MUTABLE) {
166 if (pos_ >= size_cache_.size()) {
167 if (log_level >= LogLevel::Notice) {
168 ACE_ERROR((LM_NOTICE, "(%P|%t) NOTICE: Xcdr2ValueWriter::begin_serialize_complex:"
169 " Size value is not available at index %u. Cache length: %u\n",
170 pos_, size_cache_.size()));
171 }
172 return false;
173 }
174 if (!ser_->write_delimiter(size_cache_.at(pos_))) {
175 return false;
176 }
177 ++pos_;
178 }
179
180 // maps without a DHeader have a 32-bit length prefix (like sequences)
181 if (ck == SEQUENCE_KIND || (ck == MAP_KIND && extensibility == FINAL)) {
182 if (!(*ser_ << seq_map_length)) {
183 return false;
184 }
185 }
186
187 serialize_states_.push(SerializeState(extensibility, ck));
188 return true;
189}
190
191bool Xcdr2ValueWriter::end_serialize_complex()
192{

Callers

nothing calls this directly

Calls 4

SerializeStateClass · 0.85
emptyMethod · 0.45
sizeMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected