00001 #include "HeaderDcps_impl.h"
00002 #include "gapi.h"
00003 #include "gapi_loanRegistry.h"
00004 #include "HeaderSplDcps.h"
00005 #include "ccpp_DataReader_impl.h"
00006 #include "ccpp_DataReaderView_impl.h"
00007
00008
00009 extern c_bool
00010 __Header__copyIn(
00011 c_base base,
00012 struct Header *from,
00013 struct _Header *to);
00014
00015 extern void
00016 __Header__copyOut(
00017 void *_from,
00018 void *_to);
00019
00020
00021
00022 DDS::DataWriter_ptr
00023 HeaderTypeSupportFactory::create_datawriter (gapi_dataWriter handle)
00024 {
00025 return new HeaderDataWriter_impl(handle);
00026 }
00027
00028 DDS::DataReader_ptr
00029 HeaderTypeSupportFactory::create_datareader (gapi_dataReader handle)
00030 {
00031 return new HeaderDataReader_impl (handle);
00032 }
00033
00034
00035 DDS::DataReaderView_ptr
00036 HeaderTypeSupportFactory::create_view (gapi_dataReaderView handle)
00037 {
00038 return new HeaderDataReaderView_impl (handle);
00039 }
00040
00041
00042
00043 HeaderTypeSupport::HeaderTypeSupport(void) :
00044 TypeSupport_impl(
00045 __Header__name(),
00046 __Header__keys(),
00047 HeaderTypeSupport::metaDescriptor,
00048 (gapi_copyIn) __Header__copyIn,
00049 (gapi_copyOut) __Header__copyOut,
00050 (gapi_readerCopy) DDS::ccpp_DataReaderCopy<HeaderSeq, Header>,
00051 new HeaderTypeSupportFactory())
00052 {
00053
00054 }
00055
00056 HeaderTypeSupport::~HeaderTypeSupport(void)
00057 {
00058
00059 }
00060
00061 DDS::ReturnCode_t
00062 HeaderTypeSupport::register_type(
00063 DDS::DomainParticipant_ptr domain,
00064 const char * type_name) THROW_ORB_EXCEPTIONS
00065 {
00066 return TypeSupport_impl::register_type(domain, type_name);
00067 }
00068
00069 char *
00070 HeaderTypeSupport::get_type_name() THROW_ORB_EXCEPTIONS
00071 {
00072 return TypeSupport_impl::get_type_name();
00073 }
00074
00075
00076
00077 HeaderDataWriter_impl::HeaderDataWriter_impl (
00078 gapi_dataWriter handle
00079 ) : DDS::DataWriter_impl(handle)
00080 {
00081
00082 }
00083
00084 HeaderDataWriter_impl::~HeaderDataWriter_impl(void)
00085 {
00086
00087 }
00088
00089 DDS::InstanceHandle_t
00090 HeaderDataWriter_impl::register_instance(
00091 const Header & instance_data) THROW_ORB_EXCEPTIONS
00092 {
00093 return DataWriter_impl::register_instance(&instance_data);
00094 }
00095
00096 DDS::InstanceHandle_t
00097 HeaderDataWriter_impl::register_instance_w_timestamp(
00098 const Header & instance_data,
00099 const DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS
00100 {
00101 return DataWriter_impl::register_instance_w_timestamp(&instance_data, source_timestamp);
00102 }
00103
00104 DDS::ReturnCode_t
00105 HeaderDataWriter_impl::unregister_instance(
00106 const Header & instance_data,
00107 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00108 {
00109 return DataWriter_impl::unregister_instance(&instance_data, handle);
00110 }
00111
00112 DDS::ReturnCode_t
00113 HeaderDataWriter_impl::unregister_instance_w_timestamp(
00114 const Header & instance_data,
00115 DDS::InstanceHandle_t handle,
00116 const DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS
00117 {
00118 return DataWriter_impl::unregister_instance_w_timestamp(&instance_data, handle, source_timestamp);
00119 }
00120
00121 DDS::ReturnCode_t
00122 HeaderDataWriter_impl::write(
00123 const Header & instance_data,
00124 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00125 {
00126 return DataWriter_impl::write(&instance_data, handle);
00127 }
00128
00129 DDS::ReturnCode_t
00130 HeaderDataWriter_impl::write_w_timestamp(
00131 const Header & instance_data,
00132 DDS::InstanceHandle_t handle,
00133 const DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS
00134 {
00135 return DataWriter_impl::write_w_timestamp(&instance_data, handle, source_timestamp);
00136 }
00137
00138 DDS::ReturnCode_t
00139 HeaderDataWriter_impl::dispose(
00140 const Header & instance_data,
00141 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00142 {
00143 return DataWriter_impl::dispose(&instance_data, handle);
00144 }
00145
00146 DDS::ReturnCode_t
00147 HeaderDataWriter_impl::dispose_w_timestamp(
00148 const Header & instance_data,
00149 DDS::InstanceHandle_t handle,
00150 const DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS
00151 {
00152 return DataWriter_impl::dispose_w_timestamp(&instance_data, handle, source_timestamp);
00153 }
00154
00155 DDS::ReturnCode_t
00156 HeaderDataWriter_impl::writedispose(
00157 const Header & instance_data,
00158 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00159 {
00160 return DataWriter_impl::writedispose(&instance_data, handle);
00161 }
00162
00163 DDS::ReturnCode_t
00164 HeaderDataWriter_impl::writedispose_w_timestamp(
00165 const Header & instance_data,
00166 DDS::InstanceHandle_t handle,
00167 const DDS::Time_t & source_timestamp) THROW_ORB_EXCEPTIONS
00168 {
00169 return DataWriter_impl::writedispose_w_timestamp(&instance_data, handle, source_timestamp);
00170 }
00171
00172 DDS::ReturnCode_t
00173 HeaderDataWriter_impl::get_key_value(
00174 Header & key_holder,
00175 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00176 {
00177 return DataWriter_impl::get_key_value(&key_holder, handle);
00178 }
00179
00180 DDS::InstanceHandle_t
00181 HeaderDataWriter_impl::lookup_instance(
00182 const Header & instance_data) THROW_ORB_EXCEPTIONS
00183 {
00184 return DataWriter_impl::lookup_instance(&instance_data);
00185 }
00186
00187
00188
00189 HeaderDataReader_impl::HeaderDataReader_impl (
00190 gapi_dataReader handle
00191 ) : DDS::DataReader_impl(handle)
00192 {
00193
00194 }
00195
00196 HeaderDataReader_impl::~HeaderDataReader_impl(void)
00197 {
00198
00199 }
00200
00201
00202 DDS::ReturnCode_t
00203 HeaderDataReader_impl::read(
00204 HeaderSeq & received_data,
00205 DDS::SampleInfoSeq & info_seq,
00206 CORBA::Long max_samples,
00207 DDS::SampleStateMask sample_states,
00208 DDS::ViewStateMask view_states,
00209 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00210 {
00211 DDS::ReturnCode_t status;
00212
00213 status = check_preconditions(received_data, info_seq, max_samples);
00214 if ( status == DDS::RETCODE_OK ) {
00215 status = DataReader_impl::read(&received_data, info_seq, max_samples, sample_states, view_states, instance_states);
00216 }
00217 return status;
00218 }
00219
00220 DDS::ReturnCode_t
00221 HeaderDataReader_impl::take(
00222 HeaderSeq & received_data,
00223 DDS::SampleInfoSeq & info_seq,
00224 CORBA::Long max_samples,
00225 DDS::SampleStateMask sample_states,
00226 DDS::ViewStateMask view_states,
00227 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00228 {
00229 DDS::ReturnCode_t status;
00230
00231 status = check_preconditions(received_data, info_seq, max_samples);
00232 if ( status == DDS::RETCODE_OK ) {
00233 status = DataReader_impl::take(&received_data, info_seq, max_samples, sample_states, view_states, instance_states);
00234 }
00235 return status;
00236 }
00237
00238 DDS::ReturnCode_t
00239 HeaderDataReader_impl::read_w_condition(
00240 HeaderSeq & received_data,
00241 DDS::SampleInfoSeq & info_seq,
00242 CORBA::Long max_samples,
00243 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00244 {
00245 DDS::ReturnCode_t status;
00246
00247 status = check_preconditions(received_data, info_seq, max_samples);
00248 if ( status == DDS::RETCODE_OK ) {
00249 status = DataReader_impl::read_w_condition(&received_data, info_seq, max_samples, a_condition);
00250 }
00251 return status;
00252 }
00253
00254 DDS::ReturnCode_t
00255 HeaderDataReader_impl::take_w_condition(
00256 HeaderSeq & received_data,
00257 DDS::SampleInfoSeq & info_seq,
00258 CORBA::Long max_samples,
00259 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00260 {
00261 DDS::ReturnCode_t status;
00262
00263 status = check_preconditions(received_data, info_seq, max_samples);
00264 if ( status == DDS::RETCODE_OK ) {
00265 status = DataReader_impl::take_w_condition(&received_data, info_seq, max_samples, a_condition);
00266 }
00267 return status;
00268 }
00269
00270
00271 DDS::ReturnCode_t
00272 HeaderDataReader_impl::read_next_sample(
00273 Header & received_data,
00274 DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS
00275 {
00276 return DataReader_impl::read_next_sample(&received_data, sample_info);
00277 }
00278
00279
00280 DDS::ReturnCode_t
00281 HeaderDataReader_impl::take_next_sample(
00282 Header & received_data,
00283 DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS
00284 {
00285 return DataReader_impl::take_next_sample(&received_data, sample_info);
00286 }
00287
00288
00289 DDS::ReturnCode_t
00290 HeaderDataReader_impl::read_instance(
00291 HeaderSeq & received_data,
00292 DDS::SampleInfoSeq & info_seq,
00293 CORBA::Long max_samples,
00294 DDS::InstanceHandle_t a_handle,
00295 DDS::SampleStateMask sample_states,
00296 DDS::ViewStateMask view_states,
00297 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00298 {
00299 DDS::ReturnCode_t status;
00300
00301 status = check_preconditions(received_data, info_seq, max_samples);
00302 if ( status == DDS::RETCODE_OK ) {
00303 status = DataReader_impl::read_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00304 }
00305 return status;
00306 }
00307
00308 DDS::ReturnCode_t
00309 HeaderDataReader_impl::take_instance(
00310 HeaderSeq & received_data,
00311 DDS::SampleInfoSeq & info_seq,
00312 CORBA::Long max_samples,
00313 DDS::InstanceHandle_t a_handle,
00314 DDS::SampleStateMask sample_states,
00315 DDS::ViewStateMask view_states,
00316 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00317 {
00318 DDS::ReturnCode_t status;
00319
00320 status = check_preconditions(received_data, info_seq, max_samples);
00321 if ( status == DDS::RETCODE_OK ) {
00322 status = DataReader_impl::take_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00323 }
00324 return status;
00325 }
00326
00327 DDS::ReturnCode_t
00328 HeaderDataReader_impl::read_next_instance(
00329 HeaderSeq & received_data,
00330 DDS::SampleInfoSeq & info_seq,
00331 CORBA::Long max_samples,
00332 DDS::InstanceHandle_t a_handle,
00333 DDS::SampleStateMask sample_states,
00334 DDS::ViewStateMask view_states,
00335 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00336 {
00337 DDS::ReturnCode_t status;
00338
00339 status = check_preconditions(received_data, info_seq, max_samples);
00340 if ( status == DDS::RETCODE_OK ) {
00341 status = DataReader_impl::read_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00342 }
00343 return status;
00344 }
00345
00346 DDS::ReturnCode_t
00347 HeaderDataReader_impl::take_next_instance(
00348 HeaderSeq & received_data,
00349 DDS::SampleInfoSeq & info_seq,
00350 CORBA::Long max_samples,
00351 DDS::InstanceHandle_t a_handle,
00352 DDS::SampleStateMask sample_states,
00353 DDS::ViewStateMask view_states,
00354 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00355 {
00356 DDS::ReturnCode_t status;
00357
00358 status = check_preconditions(received_data, info_seq, max_samples);
00359 if ( status == DDS::RETCODE_OK ) {
00360 status = DataReader_impl::take_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00361 }
00362 return status;
00363 }
00364
00365
00366 DDS::ReturnCode_t
00367 HeaderDataReader_impl::read_next_instance_w_condition(
00368 HeaderSeq & received_data,
00369 DDS::SampleInfoSeq & info_seq,
00370 CORBA::Long max_samples,
00371 DDS::InstanceHandle_t a_handle,
00372 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00373 {
00374 DDS::ReturnCode_t status;
00375
00376 status = check_preconditions(received_data, info_seq, max_samples);
00377 if ( status == DDS::RETCODE_OK ) {
00378 status = DataReader_impl::read_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition);
00379 }
00380 return status;
00381 }
00382
00383
00384 DDS::ReturnCode_t
00385 HeaderDataReader_impl::take_next_instance_w_condition(
00386 HeaderSeq & received_data,
00387 DDS::SampleInfoSeq & info_seq,
00388 CORBA::Long max_samples,
00389 DDS::InstanceHandle_t a_handle,
00390 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00391 {
00392 DDS::ReturnCode_t status;
00393
00394 status = check_preconditions(received_data, info_seq, max_samples);
00395 if ( status == DDS::RETCODE_OK ) {
00396 status = DataReader_impl::take_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition);
00397 }
00398 return status;
00399 }
00400
00401
00402 DDS::ReturnCode_t
00403 HeaderDataReader_impl::return_loan(
00404 HeaderSeq & received_data,
00405 DDS::SampleInfoSeq & info_seq) THROW_ORB_EXCEPTIONS
00406 {
00407 DDS::ReturnCode_t status = DDS::RETCODE_OK;
00408
00409 if ( received_data.length() > 0 ) {
00410 if (received_data.length() == info_seq.length() &&
00411 received_data.release() == info_seq.release() ) {
00412 if (!received_data.release()) {
00413 status = DataReader_impl::return_loan( received_data.get_buffer(),
00414 info_seq.get_buffer() );
00415
00416 if ( status == DDS::RETCODE_OK ) {
00417 if ( !received_data.release() ) {
00418 HeaderSeq::freebuf( received_data.get_buffer(false) );
00419 received_data.replace(0, 0, NULL, false);
00420 DDS::SampleInfoSeq::freebuf( info_seq.get_buffer(false) );
00421 info_seq.replace(0, 0, NULL, false);
00422 }
00423 } else if ( status == DDS::RETCODE_NO_DATA ) {
00424 if ( received_data.release() ) {
00425 status = DDS::RETCODE_OK;
00426 } else {
00427 status = DDS::RETCODE_PRECONDITION_NOT_MET;
00428 }
00429 }
00430 }
00431 } else {
00432 status = DDS::RETCODE_PRECONDITION_NOT_MET;
00433 }
00434 }
00435 return status;
00436 }
00437
00438
00439 DDS::ReturnCode_t
00440 HeaderDataReader_impl::get_key_value(
00441 Header & key_holder,
00442 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00443 {
00444 return DataReader_impl::get_key_value(&key_holder, handle);
00445 }
00446
00447 DDS::InstanceHandle_t
00448 HeaderDataReader_impl::lookup_instance(
00449 const Header & instance) THROW_ORB_EXCEPTIONS
00450 {
00451 return DataReader_impl::lookup_instance(&instance);
00452 }
00453
00454 DDS::ReturnCode_t
00455 HeaderDataReader_impl::check_preconditions(
00456 HeaderSeq & received_data,
00457 DDS::SampleInfoSeq & info_seq,
00458 CORBA::Long max_samples)
00459 {
00460 DDS::ReturnCode_t status = DDS::RETCODE_PRECONDITION_NOT_MET;
00461
00462 if ( received_data.length() == info_seq.length() &&
00463 received_data.maximum() == info_seq.maximum() &&
00464 received_data.release() == info_seq.release() ) {
00465 if ( received_data.maximum() == 0 || received_data.release() ) {
00466 if (received_data.maximum() == 0 ||
00467 max_samples <= static_cast<CORBA::Long>(received_data.maximum()) ||
00468 max_samples == DDS::LENGTH_UNLIMITED ) {
00469 status = DDS::RETCODE_OK;
00470 }
00471 }
00472 }
00473 return status;
00474 }
00475
00476
00477
00478
00479 HeaderDataReaderView_impl::HeaderDataReaderView_impl (
00480 gapi_dataReaderView handle
00481 ) : DDS::DataReaderView_impl(handle)
00482 {
00483
00484 }
00485
00486 HeaderDataReaderView_impl::~HeaderDataReaderView_impl(void)
00487 {
00488
00489 }
00490
00491
00492 DDS::ReturnCode_t
00493 HeaderDataReaderView_impl::read(
00494 HeaderSeq & received_data,
00495 DDS::SampleInfoSeq & info_seq,
00496 CORBA::Long max_samples,
00497 DDS::SampleStateMask sample_states,
00498 DDS::ViewStateMask view_states,
00499 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00500 {
00501 DDS::ReturnCode_t status;
00502
00503 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00504 if ( status == DDS::RETCODE_OK ) {
00505 status = DataReaderView_impl::read(&received_data, info_seq, max_samples, sample_states, view_states, instance_states);
00506 }
00507 return status;
00508 }
00509
00510 DDS::ReturnCode_t
00511 HeaderDataReaderView_impl::take(
00512 HeaderSeq & received_data,
00513 DDS::SampleInfoSeq & info_seq,
00514 CORBA::Long max_samples,
00515 DDS::SampleStateMask sample_states,
00516 DDS::ViewStateMask view_states,
00517 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00518 {
00519 DDS::ReturnCode_t status;
00520
00521 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00522 if ( status == DDS::RETCODE_OK ) {
00523 status = DataReaderView_impl::take(&received_data, info_seq, max_samples, sample_states, view_states, instance_states);
00524 }
00525 return status;
00526 }
00527
00528 DDS::ReturnCode_t
00529 HeaderDataReaderView_impl::read_w_condition(
00530 HeaderSeq & received_data,
00531 DDS::SampleInfoSeq & info_seq,
00532 CORBA::Long max_samples,
00533 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00534 {
00535 DDS::ReturnCode_t status;
00536
00537 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00538 if ( status == DDS::RETCODE_OK ) {
00539 status = DataReaderView_impl::read_w_condition(&received_data, info_seq, max_samples, a_condition);
00540 }
00541 return status;
00542 }
00543
00544 DDS::ReturnCode_t
00545 HeaderDataReaderView_impl::take_w_condition(
00546 HeaderSeq & received_data,
00547 DDS::SampleInfoSeq & info_seq,
00548 CORBA::Long max_samples,
00549 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00550 {
00551 DDS::ReturnCode_t status;
00552
00553 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00554 if ( status == DDS::RETCODE_OK ) {
00555 status = DataReaderView_impl::take_w_condition(&received_data, info_seq, max_samples, a_condition);
00556 }
00557 return status;
00558 }
00559
00560
00561 DDS::ReturnCode_t
00562 HeaderDataReaderView_impl::read_next_sample(
00563 Header & received_data,
00564 DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS
00565 {
00566 return DataReaderView_impl::read_next_sample(&received_data, sample_info);
00567 }
00568
00569
00570 DDS::ReturnCode_t
00571 HeaderDataReaderView_impl::take_next_sample(
00572 Header & received_data,
00573 DDS::SampleInfo & sample_info) THROW_ORB_EXCEPTIONS
00574 {
00575 return DataReaderView_impl::take_next_sample(&received_data, sample_info);
00576 }
00577
00578
00579 DDS::ReturnCode_t
00580 HeaderDataReaderView_impl::read_instance(
00581 HeaderSeq & received_data,
00582 DDS::SampleInfoSeq & info_seq,
00583 CORBA::Long max_samples,
00584 DDS::InstanceHandle_t a_handle,
00585 DDS::SampleStateMask sample_states,
00586 DDS::ViewStateMask view_states,
00587 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00588 {
00589 DDS::ReturnCode_t status;
00590
00591 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00592 if ( status == DDS::RETCODE_OK ) {
00593 status = DataReaderView_impl::read_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00594 }
00595 return status;
00596 }
00597
00598 DDS::ReturnCode_t
00599 HeaderDataReaderView_impl::take_instance(
00600 HeaderSeq & received_data,
00601 DDS::SampleInfoSeq & info_seq,
00602 CORBA::Long max_samples,
00603 DDS::InstanceHandle_t a_handle,
00604 DDS::SampleStateMask sample_states,
00605 DDS::ViewStateMask view_states,
00606 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00607 {
00608 DDS::ReturnCode_t status;
00609
00610 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00611 if ( status == DDS::RETCODE_OK ) {
00612 status = DataReaderView_impl::take_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00613 }
00614 return status;
00615 }
00616
00617 DDS::ReturnCode_t
00618 HeaderDataReaderView_impl::read_next_instance(
00619 HeaderSeq & received_data,
00620 DDS::SampleInfoSeq & info_seq,
00621 CORBA::Long max_samples,
00622 DDS::InstanceHandle_t a_handle,
00623 DDS::SampleStateMask sample_states,
00624 DDS::ViewStateMask view_states,
00625 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00626 {
00627 DDS::ReturnCode_t status;
00628
00629 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00630 if ( status == DDS::RETCODE_OK ) {
00631 status = DataReaderView_impl::read_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00632 }
00633 return status;
00634 }
00635
00636 DDS::ReturnCode_t
00637 HeaderDataReaderView_impl::take_next_instance(
00638 HeaderSeq & received_data,
00639 DDS::SampleInfoSeq & info_seq,
00640 CORBA::Long max_samples,
00641 DDS::InstanceHandle_t a_handle,
00642 DDS::SampleStateMask sample_states,
00643 DDS::ViewStateMask view_states,
00644 DDS::InstanceStateMask instance_states) THROW_ORB_EXCEPTIONS
00645 {
00646 DDS::ReturnCode_t status;
00647
00648 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00649 if ( status == DDS::RETCODE_OK ) {
00650 status = DataReaderView_impl::take_next_instance(&received_data, info_seq, max_samples, a_handle, sample_states, view_states, instance_states);
00651 }
00652 return status;
00653 }
00654
00655
00656 DDS::ReturnCode_t
00657 HeaderDataReaderView_impl::read_next_instance_w_condition(
00658 HeaderSeq & received_data,
00659 DDS::SampleInfoSeq & info_seq,
00660 CORBA::Long max_samples,
00661 DDS::InstanceHandle_t a_handle,
00662 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00663 {
00664 DDS::ReturnCode_t status;
00665
00666 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00667 if ( status == DDS::RETCODE_OK ) {
00668 status = DataReaderView_impl::read_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition);
00669 }
00670 return status;
00671 }
00672
00673
00674 DDS::ReturnCode_t
00675 HeaderDataReaderView_impl::take_next_instance_w_condition(
00676 HeaderSeq & received_data,
00677 DDS::SampleInfoSeq & info_seq,
00678 CORBA::Long max_samples,
00679 DDS::InstanceHandle_t a_handle,
00680 DDS::ReadCondition_ptr a_condition) THROW_ORB_EXCEPTIONS
00681 {
00682 DDS::ReturnCode_t status;
00683
00684 status = HeaderDataReader_impl::check_preconditions(received_data, info_seq, max_samples);
00685 if ( status == DDS::RETCODE_OK ) {
00686 status = DataReaderView_impl::take_next_instance_w_condition(&received_data, info_seq, max_samples, a_handle, a_condition);
00687 }
00688 return status;
00689 }
00690
00691
00692 DDS::ReturnCode_t
00693 HeaderDataReaderView_impl::return_loan(
00694 HeaderSeq & received_data,
00695 DDS::SampleInfoSeq & info_seq) THROW_ORB_EXCEPTIONS
00696 {
00697 DDS::ReturnCode_t status = DDS::RETCODE_OK;
00698
00699 if ( received_data.length() > 0 ) {
00700 if (received_data.length() == info_seq.length() &&
00701 received_data.release() == info_seq.release() ) {
00702 if (!received_data.release()) {
00703 status = DataReaderView_impl::return_loan( received_data.get_buffer(),
00704 info_seq.get_buffer() );
00705
00706 if ( status == DDS::RETCODE_OK ) {
00707 if ( !received_data.release() ) {
00708 HeaderSeq::freebuf( received_data.get_buffer(false) );
00709 received_data.replace(0, 0, NULL, false);
00710 DDS::SampleInfoSeq::freebuf( info_seq.get_buffer(false) );
00711 info_seq.replace(0, 0, NULL, false);
00712 }
00713 } else if ( status == DDS::RETCODE_NO_DATA ) {
00714 if ( received_data.release() ) {
00715 status = DDS::RETCODE_OK;
00716 } else {
00717 status = DDS::RETCODE_PRECONDITION_NOT_MET;
00718 }
00719 }
00720 }
00721 } else {
00722 status = DDS::RETCODE_PRECONDITION_NOT_MET;
00723 }
00724 }
00725 return status;
00726 }
00727
00728
00729 DDS::ReturnCode_t
00730 HeaderDataReaderView_impl::get_key_value(
00731 Header & key_holder,
00732 DDS::InstanceHandle_t handle) THROW_ORB_EXCEPTIONS
00733 {
00734 return DataReaderView_impl::get_key_value(&key_holder, handle);
00735 }
00736
00737 DDS::InstanceHandle_t
00738 HeaderDataReaderView_impl::lookup_instance(
00739 const Header & instance) THROW_ORB_EXCEPTIONS
00740 {
00741 return DataReaderView_impl::lookup_instance(&instance);
00742 }
00743
00744
00745
00746 const char * HeaderTypeSupport::metaDescriptor = "<MetaData version=\"1.0.0\"><Struct name=\"Time\"><Member name=\"sec\"><Long/></Member><Member name=\"nsec\"><Long/></Member></Struct><Struct name=\"Header\"><Member name=\"seq\"><ULong/></Member><Member name=\"stamp\"><Type name=\"Time\"/></Member><Member name=\"frame_id\"><String/></Member></Struct></MetaData>";