PoseDcps_impl.cpp
Go to the documentation of this file.
00001 #include "PoseDcps_impl.h"
00002 #include "gapi.h"
00003 #include "gapi_loanRegistry.h"
00004 #include "PoseSplDcps.h"
00005 #include "ccpp_DataReader_impl.h"
00006 #include "ccpp_DataReaderView_impl.h"
00007 
00008 
00009 extern c_bool
00010 __Pose__copyIn(
00011     c_base base,
00012     struct Pose *from,
00013     struct _Pose *to);
00014 
00015 extern void
00016 __Pose__copyOut(
00017     void *_from,
00018     void *_to);
00019 
00020 // DDS Pose TypeSupportFactory Object Body
00021 
00022  DDS::DataWriter_ptr 
00023 PoseTypeSupportFactory::create_datawriter (gapi_dataWriter handle)
00024 {
00025     return new PoseDataWriter_impl(handle);
00026 }
00027 
00028  DDS::DataReader_ptr 
00029 PoseTypeSupportFactory::create_datareader (gapi_dataReader handle)
00030 {
00031     return new PoseDataReader_impl (handle);
00032 }
00033 
00034 
00035  DDS::DataReaderView_ptr 
00036 PoseTypeSupportFactory::create_view (gapi_dataReaderView handle)
00037 {
00038     return new PoseDataReaderView_impl (handle);
00039 }
00040 
00041 // DDS Pose TypeSupport Object Body
00042 
00043  PoseTypeSupport::PoseTypeSupport(void) :
00044     TypeSupport_impl(
00045         __Pose__name(),
00046         __Pose__keys(),
00047         PoseTypeSupport::metaDescriptor,
00048         (gapi_copyIn) __Pose__copyIn,
00049         (gapi_copyOut) __Pose__copyOut,
00050         (gapi_readerCopy) DDS::ccpp_DataReaderCopy<PoseSeq, Pose>,
00051         new  PoseTypeSupportFactory())
00052 {
00053     // Parent constructor takes care of everything.
00054 }
00055 
00056  PoseTypeSupport::~PoseTypeSupport(void)
00057 {
00058     // Parent destructor takes care of everything.
00059 }
00060 
00061  DDS::ReturnCode_t
00062 PoseTypeSupport::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 PoseTypeSupport::get_type_name() THROW_ORB_EXCEPTIONS
00071 {
00072     return TypeSupport_impl::get_type_name();
00073 }
00074 
00075 // DDS Pose DataWriter_impl Object Body
00076 
00077  PoseDataWriter_impl::PoseDataWriter_impl (
00078     gapi_dataWriter handle
00079 ) : DDS::DataWriter_impl(handle)
00080 {
00081     // Parent constructor takes care of everything.
00082 }
00083 
00084  PoseDataWriter_impl::~PoseDataWriter_impl(void)
00085 {
00086     // Parent destructor takes care of everything.
00087 }
00088 
00089  DDS::InstanceHandle_t
00090 PoseDataWriter_impl::register_instance(
00091     const Pose & instance_data) THROW_ORB_EXCEPTIONS
00092 {
00093     return DataWriter_impl::register_instance(&instance_data);
00094 }
00095 
00096  DDS::InstanceHandle_t 
00097 PoseDataWriter_impl::register_instance_w_timestamp(
00098     const Pose & 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 PoseDataWriter_impl::unregister_instance(
00106     const Pose & 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 PoseDataWriter_impl::unregister_instance_w_timestamp(
00114     const Pose & 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 PoseDataWriter_impl::write(
00123     const Pose & 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 PoseDataWriter_impl::write_w_timestamp(
00131     const Pose & 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 PoseDataWriter_impl::dispose(
00140     const Pose & 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 PoseDataWriter_impl::dispose_w_timestamp(
00148     const Pose & 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 PoseDataWriter_impl::writedispose(
00157     const Pose & 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 PoseDataWriter_impl::writedispose_w_timestamp(
00165     const Pose & 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 PoseDataWriter_impl::get_key_value(
00174     Pose & 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 PoseDataWriter_impl::lookup_instance(
00182         const Pose & instance_data) THROW_ORB_EXCEPTIONS
00183 {
00184     return DataWriter_impl::lookup_instance(&instance_data);
00185 }
00186 
00187 // DDS Pose DataReader_impl Object Body
00188 
00189  PoseDataReader_impl::PoseDataReader_impl (
00190     gapi_dataReader handle
00191 ) : DDS::DataReader_impl(handle)
00192 {
00193     // Parent constructor takes care of everything.
00194 }
00195 
00196  PoseDataReader_impl::~PoseDataReader_impl(void)
00197 {
00198     // Parent destructor takes care of everything.
00199 }
00200 
00201 
00202  DDS::ReturnCode_t
00203 PoseDataReader_impl::read(
00204     PoseSeq & 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 PoseDataReader_impl::take(
00222     PoseSeq & 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 PoseDataReader_impl::read_w_condition(
00240     PoseSeq & 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 PoseDataReader_impl::take_w_condition(
00256     PoseSeq & 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 PoseDataReader_impl::read_next_sample(
00273     Pose & 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 PoseDataReader_impl::take_next_sample(
00282     Pose & 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 PoseDataReader_impl::read_instance(
00291     PoseSeq & 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 PoseDataReader_impl::take_instance(
00310     PoseSeq & 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 PoseDataReader_impl::read_next_instance(
00329     PoseSeq & 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 PoseDataReader_impl::take_next_instance(
00348     PoseSeq & 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 PoseDataReader_impl::read_next_instance_w_condition(
00368     PoseSeq & 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 PoseDataReader_impl::take_next_instance_w_condition(
00386     PoseSeq & 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 PoseDataReader_impl::return_loan(
00404     PoseSeq & 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                         PoseSeq::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 PoseDataReader_impl::get_key_value(
00441     Pose & 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 PoseDataReader_impl::lookup_instance(
00449     const Pose & instance) THROW_ORB_EXCEPTIONS
00450 {
00451     return DataReader_impl::lookup_instance(&instance);
00452 }
00453 
00454  DDS::ReturnCode_t 
00455 PoseDataReader_impl::check_preconditions(
00456     PoseSeq & 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 // DDS Pose DataReaderView_impl Object Body
00478 
00479  PoseDataReaderView_impl::PoseDataReaderView_impl (
00480     gapi_dataReaderView handle
00481 ) : DDS::DataReaderView_impl(handle)
00482 {
00483     // Parent constructor takes care of everything.
00484 }
00485 
00486  PoseDataReaderView_impl::~PoseDataReaderView_impl(void)
00487 {
00488     // Parent destructor takes care of everything.
00489 }
00490 
00491 
00492  DDS::ReturnCode_t
00493 PoseDataReaderView_impl::read(
00494     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::take(
00512     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::read_w_condition(
00530     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::take_w_condition(
00546     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::read_next_sample(
00563     Pose & 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 PoseDataReaderView_impl::take_next_sample(
00572     Pose & 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 PoseDataReaderView_impl::read_instance(
00581     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::take_instance(
00600     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::read_next_instance(
00619     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::take_next_instance(
00638     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::read_next_instance_w_condition(
00658     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::take_next_instance_w_condition(
00676     PoseSeq & 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 = PoseDataReader_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 PoseDataReaderView_impl::return_loan(
00694     PoseSeq & 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                         PoseSeq::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 PoseDataReaderView_impl::get_key_value(
00731     Pose & 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 PoseDataReaderView_impl::lookup_instance(
00739     const Pose & instance) THROW_ORB_EXCEPTIONS
00740 {
00741     return DataReaderView_impl::lookup_instance(&instance);
00742 }
00743 
00744 
00745 
00746 const char * PoseTypeSupport::metaDescriptor = "<MetaData version=\"1.0.0\"><Struct name=\"Point\"><Member name=\"x\"><Double/></Member><Member name=\"y\">"
00747 "<Double/></Member><Member name=\"z\"><Double/></Member></Struct><Struct name=\"Quaternion\"><Member name=\"x\">"
00748 "<Double/></Member><Member name=\"y\"><Double/></Member><Member name=\"z\"><Double/></Member><Member name=\"w\">"
00749 "<Double/></Member></Struct><Struct name=\"Pose\"><Member name=\"position\"><Type name=\"Point\"/></Member>"
00750 "<Member name=\"orientation\"><Type name=\"Quaternion\"/></Member></Struct></MetaData>";


proxyPoseWithCovarianceStamped
Author(s): Ronny Hartanto
autogenerated on Mon Oct 6 2014 06:54:21