Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
82123 lines
2.9 MiB
Plaintext
82123 lines
2.9 MiB
Plaintext
|
|
|
|
/*
|
|
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
|
|
|
|
This file was generated from tab.idl
|
|
using RTI Code Generator (rtiddsgen) version 4.7.0.
|
|
The rtiddsgen tool is part of the RTI Connext DDS distribution.
|
|
For more information, type 'rtiddsgen -help' at a command shell
|
|
or consult the Code Generator User's Manual.
|
|
*/
|
|
|
|
#include <string.h>
|
|
|
|
#ifndef ndds_c_h
|
|
#include "ndds/ndds_c.h"
|
|
#endif
|
|
|
|
#ifndef osapi_type_h
|
|
#include "osapi/osapi_type.h"
|
|
#endif
|
|
#ifndef osapi_heap_h
|
|
#include "osapi/osapi_heap.h"
|
|
#endif
|
|
|
|
#ifndef osapi_utility_h
|
|
#include "osapi/osapi_utility.h"
|
|
#endif
|
|
|
|
#ifndef cdr_log_h
|
|
#include "cdr/cdr_log.h"
|
|
#endif
|
|
|
|
#ifndef cdr_type_h
|
|
#include "cdr/cdr_type.h"
|
|
#endif
|
|
|
|
#ifndef cdr_type_object_h
|
|
#include "cdr/cdr_typeObject.h"
|
|
#endif
|
|
|
|
#ifndef cdr_encapsulation_h
|
|
#include "cdr/cdr_encapsulation.h"
|
|
#endif
|
|
|
|
#ifndef cdr_stream_h
|
|
#include "cdr/cdr_stream.h"
|
|
#endif
|
|
|
|
#ifndef cdr_log_h
|
|
#include "cdr/cdr_log.h"
|
|
#endif
|
|
|
|
#ifndef pres_typePlugin_h
|
|
#include "pres/pres_typePlugin.h"
|
|
#endif
|
|
|
|
#include "dds_c/dds_c_typecode_impl.h"
|
|
|
|
#include "rti/topic/cdr/Serialization.hpp"
|
|
#define RTI_CDR_CURRENT_SUBMODULE RTI_CDR_SUBMODULE_MASK_STREAM
|
|
|
|
#include "tabPlugin.hpp"
|
|
|
|
#include <TrainingAreaBase/tab_export.h> // #define NDDSUSERDllExport for linux
|
|
#include "tab_enums.hpp"
|
|
#include </workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/build4/Lts/DDS/Core/core.hpp>
|
|
#include </workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/build4/Lts/Services/ProjectDataManagement/pdm.hpp>
|
|
namespace TrainingAreaBase {
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TrajectoryCalculationData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TrajectoryCalculationDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TrajectoryCalculationData *sample = new TrajectoryCalculationData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TrajectoryCalculationData *
|
|
TrajectoryCalculationDataPluginSupport_create_data(void)
|
|
{
|
|
return (TrajectoryCalculationData *) TrajectoryCalculationDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TrajectoryCalculationDataPluginSupport_destroy_data(
|
|
TrajectoryCalculationData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TrajectoryCalculationDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::TrajectoryCalculationDataPluginSupport_destroy_data((TrajectoryCalculationData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TrajectoryCalculationDataPluginSupport_copy_data(
|
|
TrajectoryCalculationData *dst,
|
|
const TrajectoryCalculationData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TrajectoryCalculationDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TrajectoryCalculationData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TrajectoryCalculationDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
TrajectoryCalculationDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
TrajectoryCalculationDataPluginSupport_create_dataI,
|
|
TrajectoryCalculationDataPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::TrajectoryCalculationDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TrajectoryCalculationDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TrajectoryCalculationDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TrajectoryCalculationData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TrajectoryCalculationDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TrajectoryCalculationDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TrajectoryCalculationData *dst,
|
|
const TrajectoryCalculationData *src)
|
|
{
|
|
return ::TrainingAreaBase::TrajectoryCalculationDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TrajectoryCalculationDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TrajectoryCalculationDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TrajectoryCalculationData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TrajectoryCalculationData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TrajectoryCalculationData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
TrajectoryCalculationDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TrajectoryCalculationDataPlugin_deserialize_from_cdr_buffer(
|
|
TrajectoryCalculationData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TrajectoryCalculationData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TrajectoryCalculationData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
TrajectoryCalculationDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
TrajectoryCalculationDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool TrajectoryCalculationDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TrajectoryCalculationData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TrajectoryCalculationDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TrajectoryCalculationDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *TrajectoryCalculationDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TrajectoryCalculationDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TrajectoryCalculationDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TrajectoryCalculationDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TrajectoryCalculationDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::TrajectoryCalculationData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::TrajectoryCalculationDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TrajectoryCalculationDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TrajectoryCalculationDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::TrajectoryCalculationData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TrajectoryCalculationDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type AdlerCalculateTrajectoryRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
AdlerCalculateTrajectoryRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
AdlerCalculateTrajectoryRequest *sample = new AdlerCalculateTrajectoryRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
AdlerCalculateTrajectoryRequest *
|
|
AdlerCalculateTrajectoryRequestPluginSupport_create_data(void)
|
|
{
|
|
return (AdlerCalculateTrajectoryRequest *) AdlerCalculateTrajectoryRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
AdlerCalculateTrajectoryRequestPluginSupport_destroy_data(
|
|
AdlerCalculateTrajectoryRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
AdlerCalculateTrajectoryRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPluginSupport_destroy_data((AdlerCalculateTrajectoryRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerCalculateTrajectoryRequestPluginSupport_copy_data(
|
|
AdlerCalculateTrajectoryRequest *dst,
|
|
const AdlerCalculateTrajectoryRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
AdlerCalculateTrajectoryRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerCalculateTrajectoryRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerCalculateTrajectoryRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
AdlerCalculateTrajectoryRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
AdlerCalculateTrajectoryRequestPluginSupport_create_dataI,
|
|
AdlerCalculateTrajectoryRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerCalculateTrajectoryRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
AdlerCalculateTrajectoryRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerCalculateTrajectoryRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"AdlerCalculateTrajectoryRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerCalculateTrajectoryRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
AdlerCalculateTrajectoryRequest *dst,
|
|
const AdlerCalculateTrajectoryRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::AdlerCalculateTrajectoryRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
AdlerCalculateTrajectoryRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
AdlerCalculateTrajectoryRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const AdlerCalculateTrajectoryRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerCalculateTrajectoryRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerCalculateTrajectoryRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
AdlerCalculateTrajectoryRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
AdlerCalculateTrajectoryRequestPlugin_deserialize_from_cdr_buffer(
|
|
AdlerCalculateTrajectoryRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerCalculateTrajectoryRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerCalculateTrajectoryRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
AdlerCalculateTrajectoryRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
AdlerCalculateTrajectoryRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool AdlerCalculateTrajectoryRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerCalculateTrajectoryRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerCalculateTrajectoryRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerCalculateTrajectoryRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *AdlerCalculateTrajectoryRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
AdlerCalculateTrajectoryRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
AdlerCalculateTrajectoryRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
AdlerCalculateTrajectoryRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
AdlerCalculateTrajectoryRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::AdlerCalculateTrajectoryRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::AdlerCalculateTrajectoryRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
AdlerCalculateTrajectoryRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
AdlerCalculateTrajectoryRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::AdlerCalculateTrajectoryRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
AdlerCalculateTrajectoryRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type AdlerFqAfRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
AdlerFqAfRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
AdlerFqAfRequest *sample = new AdlerFqAfRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
AdlerFqAfRequest *
|
|
AdlerFqAfRequestPluginSupport_create_data(void)
|
|
{
|
|
return (AdlerFqAfRequest *) AdlerFqAfRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
AdlerFqAfRequestPluginSupport_destroy_data(
|
|
AdlerFqAfRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
AdlerFqAfRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::AdlerFqAfRequestPluginSupport_destroy_data((AdlerFqAfRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqAfRequestPluginSupport_copy_data(
|
|
AdlerFqAfRequest *dst,
|
|
const AdlerFqAfRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
AdlerFqAfRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqAfRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerFqAfRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
AdlerFqAfRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
AdlerFqAfRequestPluginSupport_create_dataI,
|
|
AdlerFqAfRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::AdlerFqAfRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerFqAfRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
AdlerFqAfRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerFqAfRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"AdlerFqAfRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqAfRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
AdlerFqAfRequest *dst,
|
|
const AdlerFqAfRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::AdlerFqAfRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
AdlerFqAfRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
AdlerFqAfRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const AdlerFqAfRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqAfRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerFqAfRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
AdlerFqAfRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqAfRequestPlugin_deserialize_from_cdr_buffer(
|
|
AdlerFqAfRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqAfRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerFqAfRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqAfRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
AdlerFqAfRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool AdlerFqAfRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerFqAfRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqAfRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqAfRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *AdlerFqAfRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
AdlerFqAfRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
AdlerFqAfRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
AdlerFqAfRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
AdlerFqAfRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::AdlerFqAfRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::AdlerFqAfRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
AdlerFqAfRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
AdlerFqAfRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::AdlerFqAfRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
AdlerFqAfRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type AdlerFqFbRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
AdlerFqFbRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
AdlerFqFbRequest *sample = new AdlerFqFbRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
AdlerFqFbRequest *
|
|
AdlerFqFbRequestPluginSupport_create_data(void)
|
|
{
|
|
return (AdlerFqFbRequest *) AdlerFqFbRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
AdlerFqFbRequestPluginSupport_destroy_data(
|
|
AdlerFqFbRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
AdlerFqFbRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::AdlerFqFbRequestPluginSupport_destroy_data((AdlerFqFbRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqFbRequestPluginSupport_copy_data(
|
|
AdlerFqFbRequest *dst,
|
|
const AdlerFqFbRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
AdlerFqFbRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqFbRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerFqFbRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
AdlerFqFbRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
AdlerFqFbRequestPluginSupport_create_dataI,
|
|
AdlerFqFbRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::AdlerFqFbRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerFqFbRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
AdlerFqFbRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerFqFbRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"AdlerFqFbRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqFbRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
AdlerFqFbRequest *dst,
|
|
const AdlerFqFbRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::AdlerFqFbRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
AdlerFqFbRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
AdlerFqFbRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const AdlerFqFbRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqFbRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerFqFbRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
AdlerFqFbRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqFbRequestPlugin_deserialize_from_cdr_buffer(
|
|
AdlerFqFbRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqFbRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerFqFbRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqFbRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
AdlerFqFbRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool AdlerFqFbRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerFqFbRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqFbRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqFbRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *AdlerFqFbRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
AdlerFqFbRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
AdlerFqFbRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
AdlerFqFbRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
AdlerFqFbRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::AdlerFqFbRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::AdlerFqFbRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
AdlerFqFbRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
AdlerFqFbRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::AdlerFqFbRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
AdlerFqFbRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type AdlerFqVmRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
AdlerFqVmRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
AdlerFqVmRequest *sample = new AdlerFqVmRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
AdlerFqVmRequest *
|
|
AdlerFqVmRequestPluginSupport_create_data(void)
|
|
{
|
|
return (AdlerFqVmRequest *) AdlerFqVmRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
AdlerFqVmRequestPluginSupport_destroy_data(
|
|
AdlerFqVmRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
AdlerFqVmRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::AdlerFqVmRequestPluginSupport_destroy_data((AdlerFqVmRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqVmRequestPluginSupport_copy_data(
|
|
AdlerFqVmRequest *dst,
|
|
const AdlerFqVmRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
AdlerFqVmRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqVmRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerFqVmRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
AdlerFqVmRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
AdlerFqVmRequestPluginSupport_create_dataI,
|
|
AdlerFqVmRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::AdlerFqVmRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
AdlerFqVmRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
AdlerFqVmRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerFqVmRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"AdlerFqVmRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqVmRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
AdlerFqVmRequest *dst,
|
|
const AdlerFqVmRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::AdlerFqVmRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
AdlerFqVmRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
AdlerFqVmRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const AdlerFqVmRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqVmRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerFqVmRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
AdlerFqVmRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
AdlerFqVmRequestPlugin_deserialize_from_cdr_buffer(
|
|
AdlerFqVmRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< AdlerFqVmRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
AdlerFqVmRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqVmRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
AdlerFqVmRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool AdlerFqVmRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
AdlerFqVmRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqVmRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
AdlerFqVmRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *AdlerFqVmRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
AdlerFqVmRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
AdlerFqVmRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
AdlerFqVmRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
AdlerFqVmRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::AdlerFqVmRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::AdlerFqVmRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
AdlerFqVmRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
AdlerFqVmRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::AdlerFqVmRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
AdlerFqVmRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentBase
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentBasePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentBase *sample = new EquipmentBase();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentBase *
|
|
EquipmentBasePluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentBase *) EquipmentBasePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentBasePluginSupport_destroy_data(
|
|
EquipmentBase *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentBasePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentBasePluginSupport_destroy_data((EquipmentBase *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBasePluginSupport_copy_data(
|
|
EquipmentBase *dst,
|
|
const EquipmentBase *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentBasePluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentBasePluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentBase *
|
|
EquipmentBasePluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentBase *) EquipmentBasePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentBasePluginSupport_destroy_key(
|
|
EquipmentBaseKeyHolder *key)
|
|
{
|
|
EquipmentBasePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentBasePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentBasePluginSupport_destroy_key((EquipmentBaseKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentBasePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBase >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentBasePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentBasePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentBasePluginSupport_create_dataI,
|
|
EquipmentBasePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentBasePluginSupport_create_keyI , ::TrainingAreaBase::EquipmentBasePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentBasePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentBasePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentBasePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentBasePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentBasePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBase *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentBasePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBasePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentBase *dst,
|
|
const EquipmentBase *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentBasePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentBasePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentBasePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentBase *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBase >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentBase,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentBasePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBasePlugin_deserialize_from_cdr_buffer(
|
|
EquipmentBase *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBase >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentBase,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBasePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentBasePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentBasePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBase **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBasePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBasePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBasePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBaseKeyHolder *dst,
|
|
const EquipmentBase *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->equipmentNumber = src->equipmentNumber;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBasePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBase *dst, const
|
|
EquipmentBaseKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->equipmentNumber = src->equipmentNumber;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBasePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentBase * sample = NULL;
|
|
sample = (EquipmentBase *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentBasePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentBasePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentBasePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentBasePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentBasePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentBasePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentBasePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentBasePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentBasePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentBasePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentBasePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentBasePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentBase >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentBasePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentBasePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentBasePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentBase";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentBasePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type BatteryAlarm
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
BatteryAlarmPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
BatteryAlarm *sample = new BatteryAlarm();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
BatteryAlarm *
|
|
BatteryAlarmPluginSupport_create_data(void)
|
|
{
|
|
return (BatteryAlarm *) BatteryAlarmPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPluginSupport_destroy_data(
|
|
BatteryAlarm *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::BatteryAlarmPluginSupport_destroy_data((BatteryAlarm *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
BatteryAlarmPluginSupport_copy_data(
|
|
BatteryAlarm *dst,
|
|
const BatteryAlarm *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
BatteryAlarmPluginSupport_create_keyI(void)
|
|
{
|
|
return BatteryAlarmPluginSupport_create_data();
|
|
}
|
|
|
|
BatteryAlarm *
|
|
BatteryAlarmPluginSupport_create_key(void)
|
|
{
|
|
return (BatteryAlarm *) BatteryAlarmPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPluginSupport_destroy_key(
|
|
BatteryAlarmKeyHolder *key)
|
|
{
|
|
BatteryAlarmPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::BatteryAlarmPluginSupport_destroy_key((BatteryAlarmKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
BatteryAlarmPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryAlarm >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
BatteryAlarmPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
BatteryAlarmPluginSupport_create_dataI,
|
|
BatteryAlarmPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::BatteryAlarmPluginSupport_create_keyI , ::TrainingAreaBase::BatteryAlarmPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::BatteryAlarmPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = BatteryAlarmPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::BatteryAlarmPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryAlarm *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"BatteryAlarmPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
BatteryAlarmPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
BatteryAlarm *dst,
|
|
const BatteryAlarm *src)
|
|
{
|
|
return ::TrainingAreaBase::BatteryAlarmPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
BatteryAlarmPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
BatteryAlarmPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const BatteryAlarm *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryAlarm >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BatteryAlarm,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
BatteryAlarmPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryAlarmPlugin_deserialize_from_cdr_buffer(
|
|
BatteryAlarm *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryAlarm >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BatteryAlarm,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
BatteryAlarmPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
BatteryAlarmPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool BatteryAlarmPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryAlarm **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
BatteryAlarmPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
BatteryAlarmPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
BatteryAlarmPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryAlarmKeyHolder *dst,
|
|
const BatteryAlarm *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryAlarmPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryAlarm *dst, const
|
|
BatteryAlarmKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryAlarmPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
BatteryAlarm * sample = NULL;
|
|
sample = (BatteryAlarm *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *BatteryAlarmPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
BatteryAlarmPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
BatteryAlarmPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
BatteryAlarmPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
BatteryAlarmPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
BatteryAlarmPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
BatteryAlarmPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::BatteryAlarmPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::BatteryAlarm >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::BatteryAlarmPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
BatteryAlarmPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
BatteryAlarmPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::BatteryAlarm";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
BatteryAlarmPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type BatteryState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
BatteryStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
BatteryState *sample = new BatteryState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
BatteryState *
|
|
BatteryStatePluginSupport_create_data(void)
|
|
{
|
|
return (BatteryState *) BatteryStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
BatteryStatePluginSupport_destroy_data(
|
|
BatteryState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
BatteryStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::BatteryStatePluginSupport_destroy_data((BatteryState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
BatteryStatePluginSupport_copy_data(
|
|
BatteryState *dst,
|
|
const BatteryState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
BatteryStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BatteryStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
BatteryStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
BatteryStatePluginSupport_create_dataI,
|
|
BatteryStatePluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::BatteryStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BatteryStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
BatteryStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"BatteryStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
BatteryStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
BatteryState *dst,
|
|
const BatteryState *src)
|
|
{
|
|
return ::TrainingAreaBase::BatteryStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
BatteryStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
BatteryStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const BatteryState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BatteryState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
BatteryStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryStatePlugin_deserialize_from_cdr_buffer(
|
|
BatteryState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BatteryState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
BatteryStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
BatteryStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool BatteryStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
BatteryStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
BatteryStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *BatteryStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::BatteryStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::BatteryStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::BatteryStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::BatteryStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::BatteryStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
BatteryStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
BatteryStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
BatteryStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
BatteryStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::BatteryStatePlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::BatteryState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::BatteryStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
BatteryStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
BatteryStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::BatteryState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
BatteryStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type BatteryInfo
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
BatteryInfoPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
BatteryInfo *sample = new BatteryInfo();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
BatteryInfo *
|
|
BatteryInfoPluginSupport_create_data(void)
|
|
{
|
|
return (BatteryInfo *) BatteryInfoPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
BatteryInfoPluginSupport_destroy_data(
|
|
BatteryInfo *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
BatteryInfoPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::BatteryInfoPluginSupport_destroy_data((BatteryInfo *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
BatteryInfoPluginSupport_copy_data(
|
|
BatteryInfo *dst,
|
|
const BatteryInfo *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
BatteryInfoPluginSupport_create_keyI(void)
|
|
{
|
|
return BatteryInfoPluginSupport_create_data();
|
|
}
|
|
|
|
BatteryInfo *
|
|
BatteryInfoPluginSupport_create_key(void)
|
|
{
|
|
return (BatteryInfo *) BatteryInfoPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
BatteryInfoPluginSupport_destroy_key(
|
|
BatteryInfoKeyHolder *key)
|
|
{
|
|
BatteryInfoPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
BatteryInfoPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::BatteryInfoPluginSupport_destroy_key((BatteryInfoKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
BatteryInfoPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryInfo >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BatteryInfoPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
BatteryInfoPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
BatteryInfoPluginSupport_create_dataI,
|
|
BatteryInfoPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::BatteryInfoPluginSupport_create_keyI , ::TrainingAreaBase::BatteryInfoPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::BatteryInfoPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = BatteryInfoPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::BatteryInfoPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BatteryInfoPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
BatteryInfoPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryInfo *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"BatteryInfoPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
BatteryInfoPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
BatteryInfo *dst,
|
|
const BatteryInfo *src)
|
|
{
|
|
return ::TrainingAreaBase::BatteryInfoPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
BatteryInfoPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
BatteryInfoPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const BatteryInfo *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryInfo >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BatteryInfo,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
BatteryInfoPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryInfoPlugin_deserialize_from_cdr_buffer(
|
|
BatteryInfo *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< BatteryInfo >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BatteryInfo,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
BatteryInfoPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
BatteryInfoPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool BatteryInfoPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryInfo **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
BatteryInfoPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
BatteryInfoPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
BatteryInfoPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryInfoKeyHolder *dst,
|
|
const BatteryInfo *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryInfoPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BatteryInfo *dst, const
|
|
BatteryInfoKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BatteryInfoPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
BatteryInfo * sample = NULL;
|
|
sample = (BatteryInfo *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *BatteryInfoPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::BatteryInfoPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::BatteryInfoPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::BatteryInfoPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::BatteryInfoPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
BatteryInfoPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
BatteryInfoPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
BatteryInfoPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
BatteryInfoPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
BatteryInfoPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
BatteryInfoPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::BatteryInfoPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::BatteryInfo >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::BatteryInfoPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
BatteryInfoPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
BatteryInfoPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::BatteryInfo";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
BatteryInfoPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ConnectionState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ConnectionStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ConnectionState *sample = new ConnectionState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ConnectionState *
|
|
ConnectionStatePluginSupport_create_data(void)
|
|
{
|
|
return (ConnectionState *) ConnectionStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ConnectionStatePluginSupport_destroy_data(
|
|
ConnectionState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ConnectionStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ConnectionStatePluginSupport_destroy_data((ConnectionState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionStatePluginSupport_copy_data(
|
|
ConnectionState *dst,
|
|
const ConnectionState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ConnectionStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ConnectionState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ConnectionStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ConnectionStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ConnectionStatePluginSupport_create_dataI,
|
|
ConnectionStatePluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ConnectionStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ConnectionStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ConnectionStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ConnectionStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ConnectionState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ConnectionStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ConnectionState *dst,
|
|
const ConnectionState *src)
|
|
{
|
|
return ::TrainingAreaBase::ConnectionStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ConnectionStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ConnectionStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ConnectionState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ConnectionState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ConnectionState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ConnectionStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionStatePlugin_deserialize_from_cdr_buffer(
|
|
ConnectionState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ConnectionState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ConnectionState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ConnectionStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ConnectionStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool ConnectionStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ConnectionState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ConnectionStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ConnectionStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ConnectionStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ConnectionStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ConnectionStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ConnectionStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ConnectionStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ConnectionStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ConnectionStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ConnectionStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ConnectionStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ConnectionStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ConnectionStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ConnectionStatePlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ConnectionState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ConnectionStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ConnectionStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ConnectionStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ConnectionState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ConnectionStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Connections
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ConnectionsPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Connections *sample = new Connections();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Connections *
|
|
ConnectionsPluginSupport_create_data(void)
|
|
{
|
|
return (Connections *) ConnectionsPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ConnectionsPluginSupport_destroy_data(
|
|
Connections *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ConnectionsPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ConnectionsPluginSupport_destroy_data((Connections *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionsPluginSupport_copy_data(
|
|
Connections *dst,
|
|
const Connections *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ConnectionsPluginSupport_create_keyI(void)
|
|
{
|
|
return ConnectionsPluginSupport_create_data();
|
|
}
|
|
|
|
Connections *
|
|
ConnectionsPluginSupport_create_key(void)
|
|
{
|
|
return (Connections *) ConnectionsPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ConnectionsPluginSupport_destroy_key(
|
|
ConnectionsKeyHolder *key)
|
|
{
|
|
ConnectionsPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ConnectionsPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ConnectionsPluginSupport_destroy_key((ConnectionsKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ConnectionsPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Connections >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ConnectionsPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ConnectionsPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ConnectionsPluginSupport_create_dataI,
|
|
ConnectionsPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ConnectionsPluginSupport_create_keyI , ::TrainingAreaBase::ConnectionsPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ConnectionsPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ConnectionsPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ConnectionsPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ConnectionsPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ConnectionsPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Connections *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ConnectionsPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionsPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Connections *dst,
|
|
const Connections *src)
|
|
{
|
|
return ::TrainingAreaBase::ConnectionsPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ConnectionsPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ConnectionsPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Connections *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Connections >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Connections,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ConnectionsPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionsPlugin_deserialize_from_cdr_buffer(
|
|
Connections *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Connections >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Connections,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ConnectionsPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ConnectionsPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ConnectionsPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Connections **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ConnectionsPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ConnectionsPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionsPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ConnectionsKeyHolder *dst,
|
|
const Connections *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->id = src->id;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionsPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Connections *dst, const
|
|
ConnectionsKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->id = src->id;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ConnectionsPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
Connections * sample = NULL;
|
|
sample = (Connections *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ConnectionsPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ConnectionsPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ConnectionsPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ConnectionsPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ConnectionsPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ConnectionsPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ConnectionsPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ConnectionsPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ConnectionsPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ConnectionsPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ConnectionsPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ConnectionsPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Connections >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ConnectionsPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ConnectionsPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ConnectionsPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Connections";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ConnectionsPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type CtaDataError
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
CtaDataErrorPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
CtaDataError *sample = new CtaDataError();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
CtaDataError *
|
|
CtaDataErrorPluginSupport_create_data(void)
|
|
{
|
|
return (CtaDataError *) CtaDataErrorPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPluginSupport_destroy_data(
|
|
CtaDataError *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::CtaDataErrorPluginSupport_destroy_data((CtaDataError *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
CtaDataErrorPluginSupport_copy_data(
|
|
CtaDataError *dst,
|
|
const CtaDataError *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
CtaDataErrorPluginSupport_create_keyI(void)
|
|
{
|
|
return CtaDataErrorPluginSupport_create_data();
|
|
}
|
|
|
|
CtaDataError *
|
|
CtaDataErrorPluginSupport_create_key(void)
|
|
{
|
|
return (CtaDataError *) CtaDataErrorPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPluginSupport_destroy_key(
|
|
CtaDataErrorKeyHolder *key)
|
|
{
|
|
CtaDataErrorPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::CtaDataErrorPluginSupport_destroy_key((CtaDataErrorKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
CtaDataErrorPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< CtaDataError >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
CtaDataErrorPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
CtaDataErrorPluginSupport_create_dataI,
|
|
CtaDataErrorPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::CtaDataErrorPluginSupport_create_keyI , ::TrainingAreaBase::CtaDataErrorPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::CtaDataErrorPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = CtaDataErrorPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::CtaDataErrorPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CtaDataError *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"CtaDataErrorPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
CtaDataErrorPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
CtaDataError *dst,
|
|
const CtaDataError *src)
|
|
{
|
|
return ::TrainingAreaBase::CtaDataErrorPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
CtaDataErrorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
CtaDataErrorPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const CtaDataError *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< CtaDataError >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
CtaDataError,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
CtaDataErrorPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
CtaDataErrorPlugin_deserialize_from_cdr_buffer(
|
|
CtaDataError *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< CtaDataError >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
CtaDataError,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
CtaDataErrorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
CtaDataErrorPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool CtaDataErrorPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CtaDataError **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
CtaDataErrorPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
CtaDataErrorPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
CtaDataErrorPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CtaDataErrorKeyHolder *dst,
|
|
const CtaDataError *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
CtaDataErrorPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CtaDataError *dst, const
|
|
CtaDataErrorKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
CtaDataErrorPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
CtaDataError * sample = NULL;
|
|
sample = (CtaDataError *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *CtaDataErrorPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
CtaDataErrorPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
CtaDataErrorPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
CtaDataErrorPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
CtaDataErrorPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
CtaDataErrorPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
CtaDataErrorPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::CtaDataErrorPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::CtaDataError >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::CtaDataErrorPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
CtaDataErrorPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
CtaDataErrorPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::CtaDataError";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
CtaDataErrorPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type IedBaseData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
IedBaseDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
IedBaseData *sample = new IedBaseData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
IedBaseData *
|
|
IedBaseDataPluginSupport_create_data(void)
|
|
{
|
|
return (IedBaseData *) IedBaseDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
IedBaseDataPluginSupport_destroy_data(
|
|
IedBaseData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
IedBaseDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::IedBaseDataPluginSupport_destroy_data((IedBaseData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
IedBaseDataPluginSupport_copy_data(
|
|
IedBaseData *dst,
|
|
const IedBaseData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
IedBaseDataPluginSupport_create_keyI(void)
|
|
{
|
|
return IedBaseDataPluginSupport_create_data();
|
|
}
|
|
|
|
IedBaseData *
|
|
IedBaseDataPluginSupport_create_key(void)
|
|
{
|
|
return (IedBaseData *) IedBaseDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
IedBaseDataPluginSupport_destroy_key(
|
|
IedBaseDataKeyHolder *key)
|
|
{
|
|
IedBaseDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
IedBaseDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::IedBaseDataPluginSupport_destroy_key((IedBaseDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
IedBaseDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< IedBaseData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
IedBaseDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
IedBaseDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
IedBaseDataPluginSupport_create_dataI,
|
|
IedBaseDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::IedBaseDataPluginSupport_create_keyI , ::TrainingAreaBase::IedBaseDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::IedBaseDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = IedBaseDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::IedBaseDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
IedBaseDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
IedBaseDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IedBaseData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"IedBaseDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
IedBaseDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
IedBaseData *dst,
|
|
const IedBaseData *src)
|
|
{
|
|
return ::TrainingAreaBase::IedBaseDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
IedBaseDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
IedBaseDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const IedBaseData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< IedBaseData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
IedBaseData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
IedBaseDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IedBaseDataPlugin_deserialize_from_cdr_buffer(
|
|
IedBaseData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< IedBaseData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
IedBaseData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
IedBaseDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
IedBaseDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool IedBaseDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IedBaseData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
IedBaseDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
IedBaseDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
IedBaseDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IedBaseDataKeyHolder *dst,
|
|
const IedBaseData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IedBaseDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IedBaseData *dst, const
|
|
IedBaseDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IedBaseDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
IedBaseData * sample = NULL;
|
|
sample = (IedBaseData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *IedBaseDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::IedBaseDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::IedBaseDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::IedBaseDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::IedBaseDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
IedBaseDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
IedBaseDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
IedBaseDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
IedBaseDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
IedBaseDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
IedBaseDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::IedBaseDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::IedBaseData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::IedBaseDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
IedBaseDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
IedBaseDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::IedBaseData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
IedBaseDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DefinitionIed
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DefinitionIedPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DefinitionIed *sample = new DefinitionIed();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DefinitionIed *
|
|
DefinitionIedPluginSupport_create_data(void)
|
|
{
|
|
return (DefinitionIed *) DefinitionIedPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DefinitionIedPluginSupport_destroy_data(
|
|
DefinitionIed *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DefinitionIedPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DefinitionIedPluginSupport_destroy_data((DefinitionIed *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DefinitionIedPluginSupport_copy_data(
|
|
DefinitionIed *dst,
|
|
const DefinitionIed *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
DefinitionIedPluginSupport_create_keyI(void)
|
|
{
|
|
return DefinitionIedPluginSupport_create_data();
|
|
}
|
|
|
|
DefinitionIed *
|
|
DefinitionIedPluginSupport_create_key(void)
|
|
{
|
|
return (DefinitionIed *) DefinitionIedPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
DefinitionIedPluginSupport_destroy_key(
|
|
DefinitionIedKeyHolder *key)
|
|
{
|
|
DefinitionIedPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
DefinitionIedPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::DefinitionIedPluginSupport_destroy_key((DefinitionIedKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DefinitionIedPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DefinitionIed >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DefinitionIedPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DefinitionIedPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DefinitionIedPluginSupport_create_dataI,
|
|
DefinitionIedPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::DefinitionIedPluginSupport_create_keyI , ::TrainingAreaBase::DefinitionIedPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::DefinitionIedPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = DefinitionIedPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DefinitionIedPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DefinitionIedPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DefinitionIedPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DefinitionIed *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DefinitionIedPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DefinitionIedPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DefinitionIed *dst,
|
|
const DefinitionIed *src)
|
|
{
|
|
return ::TrainingAreaBase::DefinitionIedPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DefinitionIedPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DefinitionIedPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DefinitionIed *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DefinitionIed >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DefinitionIed,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DefinitionIedPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DefinitionIedPlugin_deserialize_from_cdr_buffer(
|
|
DefinitionIed *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DefinitionIed >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DefinitionIed,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DefinitionIedPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DefinitionIedPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool DefinitionIedPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DefinitionIed **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DefinitionIedPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DefinitionIedPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
DefinitionIedPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DefinitionIedKeyHolder *dst,
|
|
const DefinitionIed *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::IedBaseDataPlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::IedBaseData *)dst,(const ::TrainingAreaBase::IedBaseData*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DefinitionIedPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DefinitionIed *dst, const
|
|
DefinitionIedKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::IedBaseDataPlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::IedBaseData*)dst,(const ::TrainingAreaBase::IedBaseData*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DefinitionIedPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
DefinitionIed * sample = NULL;
|
|
sample = (DefinitionIed *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DefinitionIedPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DefinitionIedPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DefinitionIedPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DefinitionIedPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DefinitionIedPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DefinitionIedPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DefinitionIedPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DefinitionIedPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DefinitionIedPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
DefinitionIedPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
DefinitionIedPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::DefinitionIedPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DefinitionIed >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DefinitionIedPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DefinitionIedPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DefinitionIedPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DefinitionIed";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DefinitionIedPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DemandBiteRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DemandBiteRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DemandBiteRequest *sample = new DemandBiteRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DemandBiteRequest *
|
|
DemandBiteRequestPluginSupport_create_data(void)
|
|
{
|
|
return (DemandBiteRequest *) DemandBiteRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DemandBiteRequestPluginSupport_destroy_data(
|
|
DemandBiteRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DemandBiteRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DemandBiteRequestPluginSupport_destroy_data((DemandBiteRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DemandBiteRequestPluginSupport_copy_data(
|
|
DemandBiteRequest *dst,
|
|
const DemandBiteRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DemandBiteRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandBiteRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandBiteRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DemandBiteRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DemandBiteRequestPluginSupport_create_dataI,
|
|
DemandBiteRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DemandBiteRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandBiteRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DemandBiteRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandBiteRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DemandBiteRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DemandBiteRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DemandBiteRequest *dst,
|
|
const DemandBiteRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::DemandBiteRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DemandBiteRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DemandBiteRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DemandBiteRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandBiteRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandBiteRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DemandBiteRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandBiteRequestPlugin_deserialize_from_cdr_buffer(
|
|
DemandBiteRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandBiteRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandBiteRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DemandBiteRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DemandBiteRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool DemandBiteRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandBiteRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandBiteRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandBiteRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DemandBiteRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DemandBiteRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DemandBiteRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DemandBiteRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DemandBiteRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DemandBiteRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DemandBiteRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DemandBiteRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DemandBiteRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DemandBiteRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DemandBiteRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type FtEquipmentBase
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
FtEquipmentBasePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
FtEquipmentBase *sample = new FtEquipmentBase();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
FtEquipmentBase *
|
|
FtEquipmentBasePluginSupport_create_data(void)
|
|
{
|
|
return (FtEquipmentBase *) FtEquipmentBasePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePluginSupport_destroy_data(
|
|
FtEquipmentBase *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::FtEquipmentBasePluginSupport_destroy_data((FtEquipmentBase *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
FtEquipmentBasePluginSupport_copy_data(
|
|
FtEquipmentBase *dst,
|
|
const FtEquipmentBase *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
FtEquipmentBasePluginSupport_create_keyI(void)
|
|
{
|
|
return FtEquipmentBasePluginSupport_create_data();
|
|
}
|
|
|
|
FtEquipmentBase *
|
|
FtEquipmentBasePluginSupport_create_key(void)
|
|
{
|
|
return (FtEquipmentBase *) FtEquipmentBasePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePluginSupport_destroy_key(
|
|
FtEquipmentBaseKeyHolder *key)
|
|
{
|
|
FtEquipmentBasePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::FtEquipmentBasePluginSupport_destroy_key((FtEquipmentBaseKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
FtEquipmentBasePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FtEquipmentBase >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
FtEquipmentBasePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
FtEquipmentBasePluginSupport_create_dataI,
|
|
FtEquipmentBasePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::FtEquipmentBasePluginSupport_create_keyI , ::TrainingAreaBase::FtEquipmentBasePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::FtEquipmentBasePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = FtEquipmentBasePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::FtEquipmentBasePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FtEquipmentBase *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"FtEquipmentBasePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
FtEquipmentBasePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
FtEquipmentBase *dst,
|
|
const FtEquipmentBase *src)
|
|
{
|
|
return ::TrainingAreaBase::FtEquipmentBasePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
FtEquipmentBasePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
FtEquipmentBasePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const FtEquipmentBase *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FtEquipmentBase >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FtEquipmentBase,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
FtEquipmentBasePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FtEquipmentBasePlugin_deserialize_from_cdr_buffer(
|
|
FtEquipmentBase *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FtEquipmentBase >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FtEquipmentBase,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
FtEquipmentBasePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
FtEquipmentBasePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool FtEquipmentBasePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FtEquipmentBase **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
FtEquipmentBasePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
FtEquipmentBasePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
FtEquipmentBasePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FtEquipmentBaseKeyHolder *dst,
|
|
const FtEquipmentBase *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->equipmentNumber = src->equipmentNumber;
|
|
dst->participantId = src->participantId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FtEquipmentBasePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FtEquipmentBase *dst, const
|
|
FtEquipmentBaseKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->equipmentNumber = src->equipmentNumber;
|
|
dst->participantId = src->participantId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FtEquipmentBasePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
FtEquipmentBase * sample = NULL;
|
|
sample = (FtEquipmentBase *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *FtEquipmentBasePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
FtEquipmentBasePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
FtEquipmentBasePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
FtEquipmentBasePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
FtEquipmentBasePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
FtEquipmentBasePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
FtEquipmentBasePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::FtEquipmentBase >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::FtEquipmentBasePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
FtEquipmentBasePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
FtEquipmentBasePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::FtEquipmentBase";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
FtEquipmentBasePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DemandConfigurationReportRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DemandConfigurationReportRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DemandConfigurationReportRequest *sample = new DemandConfigurationReportRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DemandConfigurationReportRequest *
|
|
DemandConfigurationReportRequestPluginSupport_create_data(void)
|
|
{
|
|
return (DemandConfigurationReportRequest *) DemandConfigurationReportRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPluginSupport_destroy_data(
|
|
DemandConfigurationReportRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPluginSupport_destroy_data((DemandConfigurationReportRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPluginSupport_copy_data(
|
|
DemandConfigurationReportRequest *dst,
|
|
const DemandConfigurationReportRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
DemandConfigurationReportRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return DemandConfigurationReportRequestPluginSupport_create_data();
|
|
}
|
|
|
|
DemandConfigurationReportRequest *
|
|
DemandConfigurationReportRequestPluginSupport_create_key(void)
|
|
{
|
|
return (DemandConfigurationReportRequest *) DemandConfigurationReportRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPluginSupport_destroy_key(
|
|
DemandConfigurationReportRequestKeyHolder *key)
|
|
{
|
|
DemandConfigurationReportRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPluginSupport_destroy_key((DemandConfigurationReportRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DemandConfigurationReportRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandConfigurationReportRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DemandConfigurationReportRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DemandConfigurationReportRequestPluginSupport_create_dataI,
|
|
DemandConfigurationReportRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPluginSupport_create_keyI , ::TrainingAreaBase::DemandConfigurationReportRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::DemandConfigurationReportRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = DemandConfigurationReportRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DemandConfigurationReportRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandConfigurationReportRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DemandConfigurationReportRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DemandConfigurationReportRequest *dst,
|
|
const DemandConfigurationReportRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::DemandConfigurationReportRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DemandConfigurationReportRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DemandConfigurationReportRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandConfigurationReportRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandConfigurationReportRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DemandConfigurationReportRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPlugin_deserialize_from_cdr_buffer(
|
|
DemandConfigurationReportRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandConfigurationReportRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandConfigurationReportRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DemandConfigurationReportRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DemandConfigurationReportRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool DemandConfigurationReportRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandConfigurationReportRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandConfigurationReportRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandConfigurationReportRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandConfigurationReportRequestKeyHolder *dst,
|
|
const DemandConfigurationReportRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandConfigurationReportRequest *dst, const
|
|
DemandConfigurationReportRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandConfigurationReportRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
DemandConfigurationReportRequest * sample = NULL;
|
|
sample = (DemandConfigurationReportRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DemandConfigurationReportRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DemandConfigurationReportRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DemandConfigurationReportRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DemandConfigurationReportRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DemandConfigurationReportRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
DemandConfigurationReportRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
DemandConfigurationReportRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DemandConfigurationReportRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DemandConfigurationReportRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DemandConfigurationReportRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DemandConfigurationReportRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DemandConfigurationReportRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DemandConfigurationReportRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DemandInitRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DemandInitRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DemandInitRequest *sample = new DemandInitRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DemandInitRequest *
|
|
DemandInitRequestPluginSupport_create_data(void)
|
|
{
|
|
return (DemandInitRequest *) DemandInitRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DemandInitRequestPluginSupport_destroy_data(
|
|
DemandInitRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DemandInitRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DemandInitRequestPluginSupport_destroy_data((DemandInitRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DemandInitRequestPluginSupport_copy_data(
|
|
DemandInitRequest *dst,
|
|
const DemandInitRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DemandInitRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandInitRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandInitRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DemandInitRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DemandInitRequestPluginSupport_create_dataI,
|
|
DemandInitRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DemandInitRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandInitRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DemandInitRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandInitRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DemandInitRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DemandInitRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DemandInitRequest *dst,
|
|
const DemandInitRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::DemandInitRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DemandInitRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DemandInitRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DemandInitRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandInitRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandInitRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DemandInitRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandInitRequestPlugin_deserialize_from_cdr_buffer(
|
|
DemandInitRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandInitRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandInitRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DemandInitRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DemandInitRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool DemandInitRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandInitRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandInitRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandInitRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DemandInitRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DemandInitRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DemandInitRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DemandInitRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DemandInitRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DemandInitRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DemandInitRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DemandInitRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DemandInitRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DemandInitRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DemandInitRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DemandInitRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DemandParticipantConfigurationRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DemandParticipantConfigurationRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DemandParticipantConfigurationRequest *sample = new DemandParticipantConfigurationRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DemandParticipantConfigurationRequest *
|
|
DemandParticipantConfigurationRequestPluginSupport_create_data(void)
|
|
{
|
|
return (DemandParticipantConfigurationRequest *) DemandParticipantConfigurationRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPluginSupport_destroy_data(
|
|
DemandParticipantConfigurationRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPluginSupport_destroy_data((DemandParticipantConfigurationRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPluginSupport_copy_data(
|
|
DemandParticipantConfigurationRequest *dst,
|
|
const DemandParticipantConfigurationRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
DemandParticipantConfigurationRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return DemandParticipantConfigurationRequestPluginSupport_create_data();
|
|
}
|
|
|
|
DemandParticipantConfigurationRequest *
|
|
DemandParticipantConfigurationRequestPluginSupport_create_key(void)
|
|
{
|
|
return (DemandParticipantConfigurationRequest *) DemandParticipantConfigurationRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPluginSupport_destroy_key(
|
|
DemandParticipantConfigurationRequestKeyHolder *key)
|
|
{
|
|
DemandParticipantConfigurationRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPluginSupport_destroy_key((DemandParticipantConfigurationRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DemandParticipantConfigurationRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandParticipantConfigurationRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DemandParticipantConfigurationRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DemandParticipantConfigurationRequestPluginSupport_create_dataI,
|
|
DemandParticipantConfigurationRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPluginSupport_create_keyI , ::TrainingAreaBase::DemandParticipantConfigurationRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = DemandParticipantConfigurationRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantConfigurationRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DemandParticipantConfigurationRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DemandParticipantConfigurationRequest *dst,
|
|
const DemandParticipantConfigurationRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::DemandParticipantConfigurationRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DemandParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DemandParticipantConfigurationRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandParticipantConfigurationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandParticipantConfigurationRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DemandParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPlugin_deserialize_from_cdr_buffer(
|
|
DemandParticipantConfigurationRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandParticipantConfigurationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandParticipantConfigurationRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DemandParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DemandParticipantConfigurationRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool DemandParticipantConfigurationRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantConfigurationRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandParticipantConfigurationRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandParticipantConfigurationRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantConfigurationRequestKeyHolder *dst,
|
|
const DemandParticipantConfigurationRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantConfigurationRequest *dst, const
|
|
DemandParticipantConfigurationRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantConfigurationRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
DemandParticipantConfigurationRequest * sample = NULL;
|
|
sample = (DemandParticipantConfigurationRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DemandParticipantConfigurationRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DemandParticipantConfigurationRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DemandParticipantConfigurationRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DemandParticipantConfigurationRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DemandParticipantConfigurationRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
DemandParticipantConfigurationRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
DemandParticipantConfigurationRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DemandParticipantConfigurationRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DemandParticipantConfigurationRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DemandParticipantConfigurationRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DemandParticipantConfigurationRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DemandParticipantConfigurationRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DemandParticipantConfigurationRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DemandParticipantModeRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DemandParticipantModeRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DemandParticipantModeRequest *sample = new DemandParticipantModeRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DemandParticipantModeRequest *
|
|
DemandParticipantModeRequestPluginSupport_create_data(void)
|
|
{
|
|
return (DemandParticipantModeRequest *) DemandParticipantModeRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPluginSupport_destroy_data(
|
|
DemandParticipantModeRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DemandParticipantModeRequestPluginSupport_destroy_data((DemandParticipantModeRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPluginSupport_copy_data(
|
|
DemandParticipantModeRequest *dst,
|
|
const DemandParticipantModeRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
DemandParticipantModeRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return DemandParticipantModeRequestPluginSupport_create_data();
|
|
}
|
|
|
|
DemandParticipantModeRequest *
|
|
DemandParticipantModeRequestPluginSupport_create_key(void)
|
|
{
|
|
return (DemandParticipantModeRequest *) DemandParticipantModeRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPluginSupport_destroy_key(
|
|
DemandParticipantModeRequestKeyHolder *key)
|
|
{
|
|
DemandParticipantModeRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::DemandParticipantModeRequestPluginSupport_destroy_key((DemandParticipantModeRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DemandParticipantModeRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandParticipantModeRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DemandParticipantModeRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DemandParticipantModeRequestPluginSupport_create_dataI,
|
|
DemandParticipantModeRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::DemandParticipantModeRequestPluginSupport_create_keyI , ::TrainingAreaBase::DemandParticipantModeRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::DemandParticipantModeRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = DemandParticipantModeRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DemandParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantModeRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DemandParticipantModeRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DemandParticipantModeRequest *dst,
|
|
const DemandParticipantModeRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::DemandParticipantModeRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DemandParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DemandParticipantModeRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandParticipantModeRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandParticipantModeRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DemandParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPlugin_deserialize_from_cdr_buffer(
|
|
DemandParticipantModeRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandParticipantModeRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandParticipantModeRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DemandParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DemandParticipantModeRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool DemandParticipantModeRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantModeRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandParticipantModeRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandParticipantModeRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantModeRequestKeyHolder *dst,
|
|
const DemandParticipantModeRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandParticipantModeRequest *dst, const
|
|
DemandParticipantModeRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandParticipantModeRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
DemandParticipantModeRequest * sample = NULL;
|
|
sample = (DemandParticipantModeRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DemandParticipantModeRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DemandParticipantModeRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DemandParticipantModeRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DemandParticipantModeRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DemandParticipantModeRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
DemandParticipantModeRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
DemandParticipantModeRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DemandParticipantModeRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DemandParticipantModeRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DemandParticipantModeRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DemandParticipantModeRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DemandParticipantModeRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DemandParticipantModeRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DemandVulnerabilityStateChangeRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DemandVulnerabilityStateChangeRequest *sample = new DemandVulnerabilityStateChangeRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DemandVulnerabilityStateChangeRequest *
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_create_data(void)
|
|
{
|
|
return (DemandVulnerabilityStateChangeRequest *) DemandVulnerabilityStateChangeRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_destroy_data(
|
|
DemandVulnerabilityStateChangeRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPluginSupport_destroy_data((DemandVulnerabilityStateChangeRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_copy_data(
|
|
DemandVulnerabilityStateChangeRequest *dst,
|
|
const DemandVulnerabilityStateChangeRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DemandVulnerabilityStateChangeRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandVulnerabilityStateChangeRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandVulnerabilityStateChangeRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DemandVulnerabilityStateChangeRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_create_dataI,
|
|
DemandVulnerabilityStateChangeRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DemandVulnerabilityStateChangeRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DemandVulnerabilityStateChangeRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandVulnerabilityStateChangeRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DemandVulnerabilityStateChangeRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DemandVulnerabilityStateChangeRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DemandVulnerabilityStateChangeRequest *dst,
|
|
const DemandVulnerabilityStateChangeRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DemandVulnerabilityStateChangeRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DemandVulnerabilityStateChangeRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandVulnerabilityStateChangeRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandVulnerabilityStateChangeRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DemandVulnerabilityStateChangeRequestPlugin_deserialize_from_cdr_buffer(
|
|
DemandVulnerabilityStateChangeRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DemandVulnerabilityStateChangeRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DemandVulnerabilityStateChangeRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool DemandVulnerabilityStateChangeRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DemandVulnerabilityStateChangeRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DemandVulnerabilityStateChangeRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DemandVulnerabilityStateChangeRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DemandVulnerabilityStateChangeRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DemandVulnerabilityStateChangeRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DemandVulnerabilityStateChangeRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DemandVulnerabilityStateChangeRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DemandVulnerabilityStateChangeRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DemandVulnerabilityStateChangeRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DemandVulnerabilityStateChangeRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DemandVulnerabilityStateChangeRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Dispersion
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DispersionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Dispersion *sample = new Dispersion();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Dispersion *
|
|
DispersionPluginSupport_create_data(void)
|
|
{
|
|
return (Dispersion *) DispersionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DispersionPluginSupport_destroy_data(
|
|
Dispersion *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DispersionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DispersionPluginSupport_destroy_data((Dispersion *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DispersionPluginSupport_copy_data(
|
|
Dispersion *dst,
|
|
const Dispersion *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DispersionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Dispersion >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DispersionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DispersionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DispersionPluginSupport_create_dataI,
|
|
DispersionPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DispersionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DispersionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DispersionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DispersionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Dispersion *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DispersionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DispersionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Dispersion *dst,
|
|
const Dispersion *src)
|
|
{
|
|
return ::TrainingAreaBase::DispersionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DispersionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DispersionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Dispersion *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Dispersion >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Dispersion,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DispersionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DispersionPlugin_deserialize_from_cdr_buffer(
|
|
Dispersion *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Dispersion >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Dispersion,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DispersionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DispersionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool DispersionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Dispersion **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DispersionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DispersionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DispersionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DispersionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DispersionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DispersionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DispersionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DispersionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DispersionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DispersionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DispersionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DispersionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DispersionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DispersionPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Dispersion >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DispersionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DispersionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DispersionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Dispersion";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DispersionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type DusSingleMineState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
DusSingleMineStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
DusSingleMineState *sample = new DusSingleMineState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
DusSingleMineState *
|
|
DusSingleMineStatePluginSupport_create_data(void)
|
|
{
|
|
return (DusSingleMineState *) DusSingleMineStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePluginSupport_destroy_data(
|
|
DusSingleMineState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::DusSingleMineStatePluginSupport_destroy_data((DusSingleMineState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
DusSingleMineStatePluginSupport_copy_data(
|
|
DusSingleMineState *dst,
|
|
const DusSingleMineState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
DusSingleMineStatePluginSupport_create_keyI(void)
|
|
{
|
|
return DusSingleMineStatePluginSupport_create_data();
|
|
}
|
|
|
|
DusSingleMineState *
|
|
DusSingleMineStatePluginSupport_create_key(void)
|
|
{
|
|
return (DusSingleMineState *) DusSingleMineStatePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePluginSupport_destroy_key(
|
|
DusSingleMineStateKeyHolder *key)
|
|
{
|
|
DusSingleMineStatePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::DusSingleMineStatePluginSupport_destroy_key((DusSingleMineStateKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
DusSingleMineStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DusSingleMineState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
DusSingleMineStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
DusSingleMineStatePluginSupport_create_dataI,
|
|
DusSingleMineStatePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::DusSingleMineStatePluginSupport_create_keyI , ::TrainingAreaBase::DusSingleMineStatePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::DusSingleMineStatePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = DusSingleMineStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::DusSingleMineStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DusSingleMineState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"DusSingleMineStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
DusSingleMineStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
DusSingleMineState *dst,
|
|
const DusSingleMineState *src)
|
|
{
|
|
return ::TrainingAreaBase::DusSingleMineStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
DusSingleMineStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
DusSingleMineStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const DusSingleMineState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DusSingleMineState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DusSingleMineState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
DusSingleMineStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DusSingleMineStatePlugin_deserialize_from_cdr_buffer(
|
|
DusSingleMineState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< DusSingleMineState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
DusSingleMineState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
DusSingleMineStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
DusSingleMineStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool DusSingleMineStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DusSingleMineState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DusSingleMineStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
DusSingleMineStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
DusSingleMineStatePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DusSingleMineStateKeyHolder *dst,
|
|
const DusSingleMineState *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DusSingleMineStatePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
DusSingleMineState *dst, const
|
|
DusSingleMineStateKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
DusSingleMineStatePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
DusSingleMineState * sample = NULL;
|
|
sample = (DusSingleMineState *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *DusSingleMineStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
DusSingleMineStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
DusSingleMineStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
DusSingleMineStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
DusSingleMineStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
DusSingleMineStatePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
DusSingleMineStatePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::DusSingleMineState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::DusSingleMineStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
DusSingleMineStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
DusSingleMineStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::DusSingleMineState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
DusSingleMineStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_CeaseFiring
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_CeaseFiringPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_CeaseFiring *sample = new EX_CeaseFiring();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_CeaseFiring *
|
|
EX_CeaseFiringPluginSupport_create_data(void)
|
|
{
|
|
return (EX_CeaseFiring *) EX_CeaseFiringPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPluginSupport_destroy_data(
|
|
EX_CeaseFiring *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_CeaseFiringPluginSupport_destroy_data((EX_CeaseFiring *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPluginSupport_copy_data(
|
|
EX_CeaseFiring *dst,
|
|
const EX_CeaseFiring *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_CeaseFiringPluginSupport_create_keyI(void)
|
|
{
|
|
return EX_CeaseFiringPluginSupport_create_data();
|
|
}
|
|
|
|
EX_CeaseFiring *
|
|
EX_CeaseFiringPluginSupport_create_key(void)
|
|
{
|
|
return (EX_CeaseFiring *) EX_CeaseFiringPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPluginSupport_destroy_key(
|
|
EX_CeaseFiringKeyHolder *key)
|
|
{
|
|
EX_CeaseFiringPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_CeaseFiringPluginSupport_destroy_key((EX_CeaseFiringKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_CeaseFiringPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_CeaseFiring >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_CeaseFiringPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_CeaseFiringPluginSupport_create_dataI,
|
|
EX_CeaseFiringPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_CeaseFiringPluginSupport_create_keyI , ::TrainingAreaBase::EX_CeaseFiringPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_CeaseFiringPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_CeaseFiringPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_CeaseFiringPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_CeaseFiring *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_CeaseFiringPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_CeaseFiring *dst,
|
|
const EX_CeaseFiring *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_CeaseFiringPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_CeaseFiringPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_CeaseFiring *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_CeaseFiring >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_CeaseFiring,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_CeaseFiringPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPlugin_deserialize_from_cdr_buffer(
|
|
EX_CeaseFiring *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_CeaseFiring >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_CeaseFiring,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_CeaseFiringPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_CeaseFiringPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_CeaseFiringPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_CeaseFiring **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_CeaseFiringPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_CeaseFiringPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_CeaseFiringKeyHolder *dst,
|
|
const EX_CeaseFiring *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_CeaseFiring *dst, const
|
|
EX_CeaseFiringKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_CeaseFiringPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_CeaseFiring * sample = NULL;
|
|
sample = (EX_CeaseFiring *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_CeaseFiringPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_CeaseFiringPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_CeaseFiringPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_CeaseFiringPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_CeaseFiringPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_CeaseFiringPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_CeaseFiringPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_CeaseFiring >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_CeaseFiringPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_CeaseFiringPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_CeaseFiringPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_CeaseFiring";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_CeaseFiringPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_DoNotFire
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_DoNotFirePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_DoNotFire *sample = new EX_DoNotFire();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_DoNotFire *
|
|
EX_DoNotFirePluginSupport_create_data(void)
|
|
{
|
|
return (EX_DoNotFire *) EX_DoNotFirePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePluginSupport_destroy_data(
|
|
EX_DoNotFire *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_DoNotFirePluginSupport_destroy_data((EX_DoNotFire *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_DoNotFirePluginSupport_copy_data(
|
|
EX_DoNotFire *dst,
|
|
const EX_DoNotFire *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_DoNotFirePluginSupport_create_keyI(void)
|
|
{
|
|
return EX_DoNotFirePluginSupport_create_data();
|
|
}
|
|
|
|
EX_DoNotFire *
|
|
EX_DoNotFirePluginSupport_create_key(void)
|
|
{
|
|
return (EX_DoNotFire *) EX_DoNotFirePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePluginSupport_destroy_key(
|
|
EX_DoNotFireKeyHolder *key)
|
|
{
|
|
EX_DoNotFirePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_DoNotFirePluginSupport_destroy_key((EX_DoNotFireKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_DoNotFirePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_DoNotFire >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_DoNotFirePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_DoNotFirePluginSupport_create_dataI,
|
|
EX_DoNotFirePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_DoNotFirePluginSupport_create_keyI , ::TrainingAreaBase::EX_DoNotFirePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_DoNotFirePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_DoNotFirePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_DoNotFirePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_DoNotFire *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_DoNotFirePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_DoNotFirePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_DoNotFire *dst,
|
|
const EX_DoNotFire *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_DoNotFirePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_DoNotFirePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_DoNotFirePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_DoNotFire *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_DoNotFire >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_DoNotFire,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_DoNotFirePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_DoNotFirePlugin_deserialize_from_cdr_buffer(
|
|
EX_DoNotFire *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_DoNotFire >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_DoNotFire,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_DoNotFirePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_DoNotFirePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_DoNotFirePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_DoNotFire **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_DoNotFirePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_DoNotFirePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_DoNotFirePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_DoNotFireKeyHolder *dst,
|
|
const EX_DoNotFire *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_DoNotFirePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_DoNotFire *dst, const
|
|
EX_DoNotFireKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_DoNotFirePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_DoNotFire * sample = NULL;
|
|
sample = (EX_DoNotFire *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_DoNotFirePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_DoNotFirePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_DoNotFirePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_DoNotFirePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_DoNotFirePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_DoNotFirePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_DoNotFirePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_DoNotFire >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_DoNotFirePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_DoNotFirePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_DoNotFirePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_DoNotFire";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_DoNotFirePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L29_ReconnaissanceUnit
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L29_ReconnaissanceUnitPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L29_ReconnaissanceUnit *sample = new L29_ReconnaissanceUnit();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L29_ReconnaissanceUnit *
|
|
L29_ReconnaissanceUnitPluginSupport_create_data(void)
|
|
{
|
|
return (L29_ReconnaissanceUnit *) L29_ReconnaissanceUnitPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L29_ReconnaissanceUnitPluginSupport_destroy_data(
|
|
L29_ReconnaissanceUnit *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L29_ReconnaissanceUnitPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPluginSupport_destroy_data((L29_ReconnaissanceUnit *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L29_ReconnaissanceUnitPluginSupport_copy_data(
|
|
L29_ReconnaissanceUnit *dst,
|
|
const L29_ReconnaissanceUnit *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L29_ReconnaissanceUnitPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L29_ReconnaissanceUnit >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L29_ReconnaissanceUnitPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L29_ReconnaissanceUnitPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L29_ReconnaissanceUnitPluginSupport_create_dataI,
|
|
L29_ReconnaissanceUnitPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L29_ReconnaissanceUnitPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L29_ReconnaissanceUnitPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L29_ReconnaissanceUnit *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L29_ReconnaissanceUnitPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L29_ReconnaissanceUnitPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L29_ReconnaissanceUnit *dst,
|
|
const L29_ReconnaissanceUnit *src)
|
|
{
|
|
return ::TrainingAreaBase::L29_ReconnaissanceUnitPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L29_ReconnaissanceUnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L29_ReconnaissanceUnitPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L29_ReconnaissanceUnit *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L29_ReconnaissanceUnit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L29_ReconnaissanceUnit,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L29_ReconnaissanceUnitPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L29_ReconnaissanceUnitPlugin_deserialize_from_cdr_buffer(
|
|
L29_ReconnaissanceUnit *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L29_ReconnaissanceUnit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L29_ReconnaissanceUnit,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L29_ReconnaissanceUnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L29_ReconnaissanceUnitPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L29_ReconnaissanceUnitPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L29_ReconnaissanceUnit **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L29_ReconnaissanceUnitPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L29_ReconnaissanceUnitPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L29_ReconnaissanceUnitPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L29_ReconnaissanceUnitPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L29_ReconnaissanceUnitPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L29_ReconnaissanceUnitPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L29_ReconnaissanceUnitPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L29_ReconnaissanceUnit >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L29_ReconnaissanceUnitPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L29_ReconnaissanceUnitPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L29_ReconnaissanceUnitPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L29_ReconnaissanceUnit";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L29_ReconnaissanceUnitPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L30_reconnaissancePositionArea
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L30_reconnaissancePositionAreaPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L30_reconnaissancePositionArea *sample = new L30_reconnaissancePositionArea();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L30_reconnaissancePositionArea *
|
|
L30_reconnaissancePositionAreaPluginSupport_create_data(void)
|
|
{
|
|
return (L30_reconnaissancePositionArea *) L30_reconnaissancePositionAreaPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L30_reconnaissancePositionAreaPluginSupport_destroy_data(
|
|
L30_reconnaissancePositionArea *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L30_reconnaissancePositionAreaPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPluginSupport_destroy_data((L30_reconnaissancePositionArea *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L30_reconnaissancePositionAreaPluginSupport_copy_data(
|
|
L30_reconnaissancePositionArea *dst,
|
|
const L30_reconnaissancePositionArea *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L30_reconnaissancePositionAreaPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L30_reconnaissancePositionArea >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L30_reconnaissancePositionAreaPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L30_reconnaissancePositionAreaPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L30_reconnaissancePositionAreaPluginSupport_create_dataI,
|
|
L30_reconnaissancePositionAreaPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L30_reconnaissancePositionAreaPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L30_reconnaissancePositionAreaPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L30_reconnaissancePositionArea *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L30_reconnaissancePositionAreaPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L30_reconnaissancePositionAreaPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L30_reconnaissancePositionArea *dst,
|
|
const L30_reconnaissancePositionArea *src)
|
|
{
|
|
return ::TrainingAreaBase::L30_reconnaissancePositionAreaPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L30_reconnaissancePositionAreaPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L30_reconnaissancePositionAreaPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L30_reconnaissancePositionArea *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L30_reconnaissancePositionArea >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L30_reconnaissancePositionArea,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L30_reconnaissancePositionAreaPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L30_reconnaissancePositionAreaPlugin_deserialize_from_cdr_buffer(
|
|
L30_reconnaissancePositionArea *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L30_reconnaissancePositionArea >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L30_reconnaissancePositionArea,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L30_reconnaissancePositionAreaPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L30_reconnaissancePositionAreaPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L30_reconnaissancePositionAreaPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L30_reconnaissancePositionArea **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L30_reconnaissancePositionAreaPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L30_reconnaissancePositionAreaPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L30_reconnaissancePositionAreaPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L30_reconnaissancePositionAreaPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L30_reconnaissancePositionAreaPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L30_reconnaissancePositionAreaPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L30_reconnaissancePositionAreaPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L30_reconnaissancePositionArea >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L30_reconnaissancePositionAreaPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L30_reconnaissancePositionAreaPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L30_reconnaissancePositionAreaPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L30_reconnaissancePositionArea";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L30_reconnaissancePositionAreaPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_ExplorationResult
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_ExplorationResultPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_ExplorationResult *sample = new EX_ExplorationResult();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_ExplorationResult *
|
|
EX_ExplorationResultPluginSupport_create_data(void)
|
|
{
|
|
return (EX_ExplorationResult *) EX_ExplorationResultPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_ExplorationResultPluginSupport_destroy_data(
|
|
EX_ExplorationResult *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_ExplorationResultPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_ExplorationResultPluginSupport_destroy_data((EX_ExplorationResult *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_ExplorationResultPluginSupport_copy_data(
|
|
EX_ExplorationResult *dst,
|
|
const EX_ExplorationResult *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_ExplorationResultPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_ExplorationResult >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_ExplorationResultPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_ExplorationResultPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_ExplorationResultPluginSupport_create_dataI,
|
|
EX_ExplorationResultPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_ExplorationResultPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_ExplorationResultPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_ExplorationResultPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_ExplorationResult *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_ExplorationResultPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_ExplorationResultPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_ExplorationResult *dst,
|
|
const EX_ExplorationResult *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_ExplorationResultPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_ExplorationResultPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_ExplorationResultPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_ExplorationResult *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_ExplorationResult >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_ExplorationResult,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_ExplorationResultPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_ExplorationResultPlugin_deserialize_from_cdr_buffer(
|
|
EX_ExplorationResult *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_ExplorationResult >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_ExplorationResult,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_ExplorationResultPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_ExplorationResultPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool EX_ExplorationResultPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_ExplorationResult **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_ExplorationResultPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_ExplorationResultPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_ExplorationResultPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_ExplorationResultPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_ExplorationResultPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_ExplorationResultPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_ExplorationResultPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_ExplorationResult >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_ExplorationResultPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_ExplorationResultPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_ExplorationResultPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_ExplorationResult";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_ExplorationResultPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_Fire
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_FirePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_Fire *sample = new EX_Fire();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_Fire *
|
|
EX_FirePluginSupport_create_data(void)
|
|
{
|
|
return (EX_Fire *) EX_FirePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_FirePluginSupport_destroy_data(
|
|
EX_Fire *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_FirePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_FirePluginSupport_destroy_data((EX_Fire *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_FirePluginSupport_copy_data(
|
|
EX_Fire *dst,
|
|
const EX_Fire *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_FirePluginSupport_create_keyI(void)
|
|
{
|
|
return EX_FirePluginSupport_create_data();
|
|
}
|
|
|
|
EX_Fire *
|
|
EX_FirePluginSupport_create_key(void)
|
|
{
|
|
return (EX_Fire *) EX_FirePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_FirePluginSupport_destroy_key(
|
|
EX_FireKeyHolder *key)
|
|
{
|
|
EX_FirePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_FirePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_FirePluginSupport_destroy_key((EX_FireKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_FirePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_Fire >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_FirePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_FirePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_FirePluginSupport_create_dataI,
|
|
EX_FirePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_FirePluginSupport_create_keyI , ::TrainingAreaBase::EX_FirePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_FirePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_FirePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_FirePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_FirePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_FirePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_Fire *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_FirePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_FirePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_Fire *dst,
|
|
const EX_Fire *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_FirePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_FirePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_FirePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_Fire *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_Fire >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_Fire,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_FirePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_FirePlugin_deserialize_from_cdr_buffer(
|
|
EX_Fire *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_Fire >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_Fire,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_FirePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_FirePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_FirePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_Fire **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_FirePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_FirePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_FirePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_FireKeyHolder *dst,
|
|
const EX_Fire *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_FirePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_Fire *dst, const
|
|
EX_FireKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_FirePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_Fire * sample = NULL;
|
|
sample = (EX_Fire *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_FirePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_FirePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_FirePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_FirePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_FirePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_FirePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_FirePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_FirePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_FirePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_FirePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_FirePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_FirePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_Fire >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_FirePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_FirePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_FirePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_Fire";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_FirePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L31_MailAddress
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L31_MailAddressPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L31_MailAddress *sample = new L31_MailAddress();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L31_MailAddress *
|
|
L31_MailAddressPluginSupport_create_data(void)
|
|
{
|
|
return (L31_MailAddress *) L31_MailAddressPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L31_MailAddressPluginSupport_destroy_data(
|
|
L31_MailAddress *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L31_MailAddressPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L31_MailAddressPluginSupport_destroy_data((L31_MailAddress *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L31_MailAddressPluginSupport_copy_data(
|
|
L31_MailAddress *dst,
|
|
const L31_MailAddress *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L31_MailAddressPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L31_MailAddress >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L31_MailAddressPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L31_MailAddressPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L31_MailAddressPluginSupport_create_dataI,
|
|
L31_MailAddressPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L31_MailAddressPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L31_MailAddressPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L31_MailAddressPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L31_MailAddress *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L31_MailAddressPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L31_MailAddressPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L31_MailAddress *dst,
|
|
const L31_MailAddress *src)
|
|
{
|
|
return ::TrainingAreaBase::L31_MailAddressPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L31_MailAddressPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L31_MailAddressPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L31_MailAddress *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L31_MailAddress >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L31_MailAddress,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L31_MailAddressPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L31_MailAddressPlugin_deserialize_from_cdr_buffer(
|
|
L31_MailAddress *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L31_MailAddress >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L31_MailAddress,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L31_MailAddressPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L31_MailAddressPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L31_MailAddressPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L31_MailAddress **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L31_MailAddressPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L31_MailAddressPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L31_MailAddressPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L31_MailAddressPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L31_MailAddressPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L31_MailAddressPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L31_MailAddressPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L31_MailAddressPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L31_MailAddress >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L31_MailAddressPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L31_MailAddressPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L31_MailAddressPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L31_MailAddress";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L31_MailAddressPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_GuidingLines
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_GuidingLinesPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_GuidingLines *sample = new EX_GuidingLines();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_GuidingLines *
|
|
EX_GuidingLinesPluginSupport_create_data(void)
|
|
{
|
|
return (EX_GuidingLines *) EX_GuidingLinesPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPluginSupport_destroy_data(
|
|
EX_GuidingLines *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_GuidingLinesPluginSupport_destroy_data((EX_GuidingLines *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPluginSupport_copy_data(
|
|
EX_GuidingLines *dst,
|
|
const EX_GuidingLines *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_GuidingLinesPluginSupport_create_keyI(void)
|
|
{
|
|
return EX_GuidingLinesPluginSupport_create_data();
|
|
}
|
|
|
|
EX_GuidingLines *
|
|
EX_GuidingLinesPluginSupport_create_key(void)
|
|
{
|
|
return (EX_GuidingLines *) EX_GuidingLinesPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPluginSupport_destroy_key(
|
|
EX_GuidingLinesKeyHolder *key)
|
|
{
|
|
EX_GuidingLinesPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_GuidingLinesPluginSupport_destroy_key((EX_GuidingLinesKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_GuidingLinesPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_GuidingLines >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_GuidingLinesPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_GuidingLinesPluginSupport_create_dataI,
|
|
EX_GuidingLinesPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_GuidingLinesPluginSupport_create_keyI , ::TrainingAreaBase::EX_GuidingLinesPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_GuidingLinesPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_GuidingLinesPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_GuidingLinesPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLines *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_GuidingLinesPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_GuidingLines *dst,
|
|
const EX_GuidingLines *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_GuidingLinesPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_GuidingLinesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_GuidingLines *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_GuidingLines >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_GuidingLines,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_GuidingLinesPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPlugin_deserialize_from_cdr_buffer(
|
|
EX_GuidingLines *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_GuidingLines >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_GuidingLines,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_GuidingLinesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_GuidingLinesPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_GuidingLinesPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLines **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_GuidingLinesPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_GuidingLinesPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLinesKeyHolder *dst,
|
|
const EX_GuidingLines *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLines *dst, const
|
|
EX_GuidingLinesKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_GuidingLines * sample = NULL;
|
|
sample = (EX_GuidingLines *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_GuidingLinesPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_GuidingLinesPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_GuidingLinesPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_GuidingLinesPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_GuidingLinesPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_GuidingLinesPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_GuidingLinesPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_GuidingLines >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_GuidingLinesPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_GuidingLinesPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_GuidingLinesPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_GuidingLines";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_GuidingLinesAndBoundaries
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_GuidingLinesAndBoundariesPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_GuidingLinesAndBoundaries *sample = new EX_GuidingLinesAndBoundaries();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_GuidingLinesAndBoundaries *
|
|
EX_GuidingLinesAndBoundariesPluginSupport_create_data(void)
|
|
{
|
|
return (EX_GuidingLinesAndBoundaries *) EX_GuidingLinesAndBoundariesPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPluginSupport_destroy_data(
|
|
EX_GuidingLinesAndBoundaries *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPluginSupport_destroy_data((EX_GuidingLinesAndBoundaries *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPluginSupport_copy_data(
|
|
EX_GuidingLinesAndBoundaries *dst,
|
|
const EX_GuidingLinesAndBoundaries *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_GuidingLinesAndBoundariesPluginSupport_create_keyI(void)
|
|
{
|
|
return EX_GuidingLinesAndBoundariesPluginSupport_create_data();
|
|
}
|
|
|
|
EX_GuidingLinesAndBoundaries *
|
|
EX_GuidingLinesAndBoundariesPluginSupport_create_key(void)
|
|
{
|
|
return (EX_GuidingLinesAndBoundaries *) EX_GuidingLinesAndBoundariesPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPluginSupport_destroy_key(
|
|
EX_GuidingLinesAndBoundariesKeyHolder *key)
|
|
{
|
|
EX_GuidingLinesAndBoundariesPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPluginSupport_destroy_key((EX_GuidingLinesAndBoundariesKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_GuidingLinesAndBoundariesPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_GuidingLinesAndBoundaries >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_GuidingLinesAndBoundariesPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_GuidingLinesAndBoundariesPluginSupport_create_dataI,
|
|
EX_GuidingLinesAndBoundariesPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPluginSupport_create_keyI , ::TrainingAreaBase::EX_GuidingLinesAndBoundariesPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_GuidingLinesAndBoundariesPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLinesAndBoundaries *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_GuidingLinesAndBoundariesPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_GuidingLinesAndBoundaries *dst,
|
|
const EX_GuidingLinesAndBoundaries *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_GuidingLinesAndBoundariesPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_GuidingLinesAndBoundariesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_GuidingLinesAndBoundaries *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_GuidingLinesAndBoundaries >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_GuidingLinesAndBoundaries,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_GuidingLinesAndBoundariesPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPlugin_deserialize_from_cdr_buffer(
|
|
EX_GuidingLinesAndBoundaries *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_GuidingLinesAndBoundaries >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_GuidingLinesAndBoundaries,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_GuidingLinesAndBoundariesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_GuidingLinesAndBoundariesPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_GuidingLinesAndBoundariesPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLinesAndBoundaries **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_GuidingLinesAndBoundariesPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_GuidingLinesAndBoundariesPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLinesAndBoundariesKeyHolder *dst,
|
|
const EX_GuidingLinesAndBoundaries *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_GuidingLinesAndBoundaries *dst, const
|
|
EX_GuidingLinesAndBoundariesKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_GuidingLinesAndBoundariesPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_GuidingLinesAndBoundaries * sample = NULL;
|
|
sample = (EX_GuidingLinesAndBoundaries *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_GuidingLinesAndBoundariesPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_GuidingLinesAndBoundaries >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_GuidingLinesAndBoundariesPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_GuidingLinesAndBoundariesPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_GuidingLinesAndBoundaries";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_GuidingLinesAndBoundariesPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_MessageRevocation
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_MessageRevocationPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_MessageRevocation *sample = new EX_MessageRevocation();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_MessageRevocation *
|
|
EX_MessageRevocationPluginSupport_create_data(void)
|
|
{
|
|
return (EX_MessageRevocation *) EX_MessageRevocationPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPluginSupport_destroy_data(
|
|
EX_MessageRevocation *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_MessageRevocationPluginSupport_destroy_data((EX_MessageRevocation *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPluginSupport_copy_data(
|
|
EX_MessageRevocation *dst,
|
|
const EX_MessageRevocation *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_MessageRevocationPluginSupport_create_keyI(void)
|
|
{
|
|
return EX_MessageRevocationPluginSupport_create_data();
|
|
}
|
|
|
|
EX_MessageRevocation *
|
|
EX_MessageRevocationPluginSupport_create_key(void)
|
|
{
|
|
return (EX_MessageRevocation *) EX_MessageRevocationPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPluginSupport_destroy_key(
|
|
EX_MessageRevocationKeyHolder *key)
|
|
{
|
|
EX_MessageRevocationPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_MessageRevocationPluginSupport_destroy_key((EX_MessageRevocationKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_MessageRevocationPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_MessageRevocation >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_MessageRevocationPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_MessageRevocationPluginSupport_create_dataI,
|
|
EX_MessageRevocationPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_MessageRevocationPluginSupport_create_keyI , ::TrainingAreaBase::EX_MessageRevocationPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_MessageRevocationPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_MessageRevocationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_MessageRevocationPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_MessageRevocation *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_MessageRevocationPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_MessageRevocation *dst,
|
|
const EX_MessageRevocation *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_MessageRevocationPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_MessageRevocationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_MessageRevocation *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_MessageRevocation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_MessageRevocation,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_MessageRevocationPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPlugin_deserialize_from_cdr_buffer(
|
|
EX_MessageRevocation *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_MessageRevocation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_MessageRevocation,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_MessageRevocationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_MessageRevocationPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_MessageRevocationPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_MessageRevocation **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_MessageRevocationPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_MessageRevocationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_MessageRevocationKeyHolder *dst,
|
|
const EX_MessageRevocation *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_MessageRevocation *dst, const
|
|
EX_MessageRevocationKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_MessageRevocationPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_MessageRevocation * sample = NULL;
|
|
sample = (EX_MessageRevocation *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_MessageRevocationPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_MessageRevocationPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_MessageRevocationPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_MessageRevocationPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_MessageRevocationPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_MessageRevocationPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_MessageRevocationPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_MessageRevocation >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_MessageRevocationPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_MessageRevocationPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_MessageRevocationPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_MessageRevocation";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_MessageRevocationPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L3_Unit
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L3_UnitPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L3_Unit *sample = new L3_Unit();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L3_Unit *
|
|
L3_UnitPluginSupport_create_data(void)
|
|
{
|
|
return (L3_Unit *) L3_UnitPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L3_UnitPluginSupport_destroy_data(
|
|
L3_Unit *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L3_UnitPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L3_UnitPluginSupport_destroy_data((L3_Unit *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L3_UnitPluginSupport_copy_data(
|
|
L3_Unit *dst,
|
|
const L3_Unit *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L3_UnitPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L3_Unit >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L3_UnitPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L3_UnitPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L3_UnitPluginSupport_create_dataI,
|
|
L3_UnitPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L3_UnitPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L3_UnitPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L3_UnitPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L3_UnitPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L3_Unit *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L3_UnitPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L3_UnitPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L3_Unit *dst,
|
|
const L3_Unit *src)
|
|
{
|
|
return ::TrainingAreaBase::L3_UnitPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L3_UnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L3_UnitPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L3_Unit *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L3_Unit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L3_Unit,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L3_UnitPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L3_UnitPlugin_deserialize_from_cdr_buffer(
|
|
L3_Unit *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L3_Unit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L3_Unit,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L3_UnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L3_UnitPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L3_UnitPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L3_Unit **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L3_UnitPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L3_UnitPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L3_UnitPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L3_UnitPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L3_UnitPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L3_UnitPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L3_UnitPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L3_UnitPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L3_UnitPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L3_UnitPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L3_UnitPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L3_UnitPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L3_UnitPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L3_UnitPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L3_Unit >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L3_UnitPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L3_UnitPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L3_UnitPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L3_Unit";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L3_UnitPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L8_Charges
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L8_ChargesPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L8_Charges *sample = new L8_Charges();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L8_Charges *
|
|
L8_ChargesPluginSupport_create_data(void)
|
|
{
|
|
return (L8_Charges *) L8_ChargesPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L8_ChargesPluginSupport_destroy_data(
|
|
L8_Charges *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L8_ChargesPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L8_ChargesPluginSupport_destroy_data((L8_Charges *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L8_ChargesPluginSupport_copy_data(
|
|
L8_Charges *dst,
|
|
const L8_Charges *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L8_ChargesPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L8_Charges >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L8_ChargesPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L8_ChargesPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L8_ChargesPluginSupport_create_dataI,
|
|
L8_ChargesPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L8_ChargesPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L8_ChargesPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L8_ChargesPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L8_ChargesPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L8_Charges *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L8_ChargesPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L8_ChargesPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L8_Charges *dst,
|
|
const L8_Charges *src)
|
|
{
|
|
return ::TrainingAreaBase::L8_ChargesPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L8_ChargesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L8_ChargesPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L8_Charges *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L8_Charges >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L8_Charges,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L8_ChargesPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L8_ChargesPlugin_deserialize_from_cdr_buffer(
|
|
L8_Charges *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L8_Charges >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L8_Charges,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L8_ChargesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L8_ChargesPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L8_ChargesPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L8_Charges **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L8_ChargesPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L8_ChargesPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L8_ChargesPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L8_ChargesPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L8_ChargesPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L8_ChargesPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L8_ChargesPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L8_ChargesPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L8_ChargesPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L8_ChargesPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L8_ChargesPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L8_ChargesPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L8_ChargesPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L8_ChargesPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L8_Charges >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L8_ChargesPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L8_ChargesPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L8_ChargesPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L8_Charges";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L8_ChargesPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L18_EffectableArea
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L18_EffectableAreaPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L18_EffectableArea *sample = new L18_EffectableArea();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L18_EffectableArea *
|
|
L18_EffectableAreaPluginSupport_create_data(void)
|
|
{
|
|
return (L18_EffectableArea *) L18_EffectableAreaPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L18_EffectableAreaPluginSupport_destroy_data(
|
|
L18_EffectableArea *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L18_EffectableAreaPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L18_EffectableAreaPluginSupport_destroy_data((L18_EffectableArea *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L18_EffectableAreaPluginSupport_copy_data(
|
|
L18_EffectableArea *dst,
|
|
const L18_EffectableArea *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L18_EffectableAreaPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L18_EffectableArea >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L18_EffectableAreaPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L18_EffectableAreaPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L18_EffectableAreaPluginSupport_create_dataI,
|
|
L18_EffectableAreaPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L18_EffectableAreaPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L18_EffectableAreaPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L18_EffectableAreaPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L18_EffectableArea *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L18_EffectableAreaPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L18_EffectableAreaPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L18_EffectableArea *dst,
|
|
const L18_EffectableArea *src)
|
|
{
|
|
return ::TrainingAreaBase::L18_EffectableAreaPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L18_EffectableAreaPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L18_EffectableAreaPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L18_EffectableArea *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L18_EffectableArea >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L18_EffectableArea,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L18_EffectableAreaPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L18_EffectableAreaPlugin_deserialize_from_cdr_buffer(
|
|
L18_EffectableArea *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L18_EffectableArea >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L18_EffectableArea,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L18_EffectableAreaPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L18_EffectableAreaPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L18_EffectableAreaPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L18_EffectableArea **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L18_EffectableAreaPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L18_EffectableAreaPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L18_EffectableAreaPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L18_EffectableAreaPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L18_EffectableAreaPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L18_EffectableAreaPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L18_EffectableAreaPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L18_EffectableArea >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L18_EffectableAreaPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L18_EffectableAreaPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L18_EffectableAreaPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L18_EffectableArea";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L18_EffectableAreaPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_ReportEffectorUnit
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_ReportEffectorUnitPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_ReportEffectorUnit *sample = new EX_ReportEffectorUnit();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_ReportEffectorUnit *
|
|
EX_ReportEffectorUnitPluginSupport_create_data(void)
|
|
{
|
|
return (EX_ReportEffectorUnit *) EX_ReportEffectorUnitPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPluginSupport_destroy_data(
|
|
EX_ReportEffectorUnit *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPluginSupport_destroy_data((EX_ReportEffectorUnit *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPluginSupport_copy_data(
|
|
EX_ReportEffectorUnit *dst,
|
|
const EX_ReportEffectorUnit *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_ReportEffectorUnitPluginSupport_create_keyI(void)
|
|
{
|
|
return EX_ReportEffectorUnitPluginSupport_create_data();
|
|
}
|
|
|
|
EX_ReportEffectorUnit *
|
|
EX_ReportEffectorUnitPluginSupport_create_key(void)
|
|
{
|
|
return (EX_ReportEffectorUnit *) EX_ReportEffectorUnitPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPluginSupport_destroy_key(
|
|
EX_ReportEffectorUnitKeyHolder *key)
|
|
{
|
|
EX_ReportEffectorUnitPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPluginSupport_destroy_key((EX_ReportEffectorUnitKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_ReportEffectorUnitPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_ReportEffectorUnit >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_ReportEffectorUnitPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_ReportEffectorUnitPluginSupport_create_dataI,
|
|
EX_ReportEffectorUnitPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPluginSupport_create_keyI , ::TrainingAreaBase::EX_ReportEffectorUnitPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_ReportEffectorUnitPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_ReportEffectorUnitPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_ReportEffectorUnitPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_ReportEffectorUnit *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_ReportEffectorUnitPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_ReportEffectorUnit *dst,
|
|
const EX_ReportEffectorUnit *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_ReportEffectorUnitPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_ReportEffectorUnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_ReportEffectorUnit *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_ReportEffectorUnit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_ReportEffectorUnit,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_ReportEffectorUnitPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPlugin_deserialize_from_cdr_buffer(
|
|
EX_ReportEffectorUnit *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_ReportEffectorUnit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_ReportEffectorUnit,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_ReportEffectorUnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_ReportEffectorUnitPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_ReportEffectorUnitPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_ReportEffectorUnit **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_ReportEffectorUnitPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_ReportEffectorUnitPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_ReportEffectorUnitKeyHolder *dst,
|
|
const EX_ReportEffectorUnit *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_ReportEffectorUnit *dst, const
|
|
EX_ReportEffectorUnitKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_ReportEffectorUnitPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_ReportEffectorUnit * sample = NULL;
|
|
sample = (EX_ReportEffectorUnit *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_ReportEffectorUnitPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_ReportEffectorUnitPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_ReportEffectorUnitPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_ReportEffectorUnitPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_ReportEffectorUnitPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_ReportEffectorUnitPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_ReportEffectorUnitPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_ReportEffectorUnit >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_ReportEffectorUnitPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_ReportEffectorUnitPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_ReportEffectorUnitPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_ReportEffectorUnit";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_ReportEffectorUnitPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EX_StartFiring
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EX_StartFiringPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EX_StartFiring *sample = new EX_StartFiring();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EX_StartFiring *
|
|
EX_StartFiringPluginSupport_create_data(void)
|
|
{
|
|
return (EX_StartFiring *) EX_StartFiringPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPluginSupport_destroy_data(
|
|
EX_StartFiring *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EX_StartFiringPluginSupport_destroy_data((EX_StartFiring *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EX_StartFiringPluginSupport_copy_data(
|
|
EX_StartFiring *dst,
|
|
const EX_StartFiring *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EX_StartFiringPluginSupport_create_keyI(void)
|
|
{
|
|
return EX_StartFiringPluginSupport_create_data();
|
|
}
|
|
|
|
EX_StartFiring *
|
|
EX_StartFiringPluginSupport_create_key(void)
|
|
{
|
|
return (EX_StartFiring *) EX_StartFiringPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPluginSupport_destroy_key(
|
|
EX_StartFiringKeyHolder *key)
|
|
{
|
|
EX_StartFiringPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EX_StartFiringPluginSupport_destroy_key((EX_StartFiringKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EX_StartFiringPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_StartFiring >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EX_StartFiringPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EX_StartFiringPluginSupport_create_dataI,
|
|
EX_StartFiringPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EX_StartFiringPluginSupport_create_keyI , ::TrainingAreaBase::EX_StartFiringPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EX_StartFiringPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EX_StartFiringPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EX_StartFiringPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_StartFiring *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EX_StartFiringPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EX_StartFiringPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EX_StartFiring *dst,
|
|
const EX_StartFiring *src)
|
|
{
|
|
return ::TrainingAreaBase::EX_StartFiringPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EX_StartFiringPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EX_StartFiringPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EX_StartFiring *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_StartFiring >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_StartFiring,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EX_StartFiringPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_StartFiringPlugin_deserialize_from_cdr_buffer(
|
|
EX_StartFiring *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EX_StartFiring >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EX_StartFiring,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EX_StartFiringPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EX_StartFiringPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EX_StartFiringPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_StartFiring **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_StartFiringPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EX_StartFiringPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EX_StartFiringPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_StartFiringKeyHolder *dst,
|
|
const EX_StartFiring *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_StartFiringPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EX_StartFiring *dst, const
|
|
EX_StartFiringKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EX_StartFiringPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EX_StartFiring * sample = NULL;
|
|
sample = (EX_StartFiring *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EX_StartFiringPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EX_StartFiringPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EX_StartFiringPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EX_StartFiringPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EX_StartFiringPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EX_StartFiringPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EX_StartFiringPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EX_StartFiringPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EX_StartFiring >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EX_StartFiringPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EX_StartFiringPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EX_StartFiringPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EX_StartFiring";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EX_StartFiringPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EmergencyCall
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EmergencyCallPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EmergencyCall *sample = new EmergencyCall();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EmergencyCall *
|
|
EmergencyCallPluginSupport_create_data(void)
|
|
{
|
|
return (EmergencyCall *) EmergencyCallPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EmergencyCallPluginSupport_destroy_data(
|
|
EmergencyCall *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EmergencyCallPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EmergencyCallPluginSupport_destroy_data((EmergencyCall *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EmergencyCallPluginSupport_copy_data(
|
|
EmergencyCall *dst,
|
|
const EmergencyCall *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EmergencyCallPluginSupport_create_keyI(void)
|
|
{
|
|
return EmergencyCallPluginSupport_create_data();
|
|
}
|
|
|
|
EmergencyCall *
|
|
EmergencyCallPluginSupport_create_key(void)
|
|
{
|
|
return (EmergencyCall *) EmergencyCallPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EmergencyCallPluginSupport_destroy_key(
|
|
EmergencyCallKeyHolder *key)
|
|
{
|
|
EmergencyCallPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EmergencyCallPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EmergencyCallPluginSupport_destroy_key((EmergencyCallKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EmergencyCallPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EmergencyCall >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EmergencyCallPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EmergencyCallPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EmergencyCallPluginSupport_create_dataI,
|
|
EmergencyCallPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EmergencyCallPluginSupport_create_keyI , ::TrainingAreaBase::EmergencyCallPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EmergencyCallPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EmergencyCallPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EmergencyCallPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EmergencyCallPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EmergencyCallPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EmergencyCall *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EmergencyCallPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EmergencyCallPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EmergencyCall *dst,
|
|
const EmergencyCall *src)
|
|
{
|
|
return ::TrainingAreaBase::EmergencyCallPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EmergencyCallPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EmergencyCallPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EmergencyCall *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EmergencyCall >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EmergencyCall,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EmergencyCallPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EmergencyCallPlugin_deserialize_from_cdr_buffer(
|
|
EmergencyCall *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EmergencyCall >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EmergencyCall,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EmergencyCallPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EmergencyCallPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EmergencyCallPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EmergencyCall **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EmergencyCallPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EmergencyCallPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EmergencyCallPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EmergencyCallKeyHolder *dst,
|
|
const EmergencyCall *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EmergencyCallPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EmergencyCall *dst, const
|
|
EmergencyCallKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EmergencyCallPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EmergencyCall * sample = NULL;
|
|
sample = (EmergencyCall *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EmergencyCallPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EmergencyCallPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EmergencyCallPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EmergencyCallPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EmergencyCallPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EmergencyCallPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EmergencyCallPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EmergencyCallPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EmergencyCallPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EmergencyCallPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EmergencyCallPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EmergencyCallPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EmergencyCall >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EmergencyCallPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EmergencyCallPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EmergencyCallPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EmergencyCall";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EmergencyCallPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Equipment
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Equipment *sample = new Equipment();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Equipment *
|
|
EquipmentPluginSupport_create_data(void)
|
|
{
|
|
return (Equipment *) EquipmentPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentPluginSupport_destroy_data(
|
|
Equipment *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentPluginSupport_destroy_data((Equipment *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPluginSupport_copy_data(
|
|
Equipment *dst,
|
|
const Equipment *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Equipment >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentPluginSupport_create_dataI,
|
|
EquipmentPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Equipment *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Equipment *dst,
|
|
const Equipment *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Equipment *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Equipment >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Equipment,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPlugin_deserialize_from_cdr_buffer(
|
|
Equipment *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Equipment >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Equipment,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Equipment **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Equipment >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Equipment";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentBiteError
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentBiteErrorPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentBiteError *sample = new EquipmentBiteError();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentBiteError *
|
|
EquipmentBiteErrorPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentBiteError *) EquipmentBiteErrorPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentBiteErrorPluginSupport_destroy_data(
|
|
EquipmentBiteError *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentBiteErrorPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentBiteErrorPluginSupport_destroy_data((EquipmentBiteError *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBiteErrorPluginSupport_copy_data(
|
|
EquipmentBiteError *dst,
|
|
const EquipmentBiteError *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentBiteErrorPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBiteError >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentBiteErrorPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentBiteErrorPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentBiteErrorPluginSupport_create_dataI,
|
|
EquipmentBiteErrorPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentBiteErrorPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentBiteErrorPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentBiteErrorPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBiteError *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentBiteErrorPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBiteErrorPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentBiteError *dst,
|
|
const EquipmentBiteError *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentBiteErrorPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentBiteErrorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentBiteErrorPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentBiteError *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBiteError >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentBiteError,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentBiteErrorPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBiteErrorPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentBiteError *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBiteError >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentBiteError,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBiteErrorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentBiteErrorPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentBiteErrorPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBiteError **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBiteErrorPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBiteErrorPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentBiteErrorPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentBiteErrorPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentBiteErrorPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentBiteErrorPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentBiteErrorPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentBiteError >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentBiteErrorPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentBiteErrorPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentBiteErrorPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentBiteError";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentBiteErrorPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentBite
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentBitePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentBite *sample = new EquipmentBite();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentBite *
|
|
EquipmentBitePluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentBite *) EquipmentBitePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentBitePluginSupport_destroy_data(
|
|
EquipmentBite *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentBitePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentBitePluginSupport_destroy_data((EquipmentBite *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBitePluginSupport_copy_data(
|
|
EquipmentBite *dst,
|
|
const EquipmentBite *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentBitePluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentBitePluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentBite *
|
|
EquipmentBitePluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentBite *) EquipmentBitePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentBitePluginSupport_destroy_key(
|
|
EquipmentBiteKeyHolder *key)
|
|
{
|
|
EquipmentBitePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentBitePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentBitePluginSupport_destroy_key((EquipmentBiteKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentBitePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBite >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentBitePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentBitePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentBitePluginSupport_create_dataI,
|
|
EquipmentBitePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentBitePluginSupport_create_keyI , ::TrainingAreaBase::EquipmentBitePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentBitePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentBitePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentBitePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentBitePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentBitePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBite *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentBitePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBitePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentBite *dst,
|
|
const EquipmentBite *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentBitePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentBitePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentBitePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentBite *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBite >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentBite,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentBitePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBitePlugin_deserialize_from_cdr_buffer(
|
|
EquipmentBite *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentBite >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentBite,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBitePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentBitePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentBitePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBite **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBitePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentBitePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBitePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBiteKeyHolder *dst,
|
|
const EquipmentBite *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBitePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentBite *dst, const
|
|
EquipmentBiteKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentBitePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentBite * sample = NULL;
|
|
sample = (EquipmentBite *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentBitePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentBitePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentBitePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentBitePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentBitePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentBitePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentBitePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentBitePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentBitePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentBitePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentBitePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentBitePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentBite >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentBitePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentBitePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentBitePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentBite";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentBitePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentConfigurationReport
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentConfigurationReportPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentConfigurationReport *sample = new EquipmentConfigurationReport();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentConfigurationReport *
|
|
EquipmentConfigurationReportPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentConfigurationReport *) EquipmentConfigurationReportPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPluginSupport_destroy_data(
|
|
EquipmentConfigurationReport *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentConfigurationReportPluginSupport_destroy_data((EquipmentConfigurationReport *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPluginSupport_copy_data(
|
|
EquipmentConfigurationReport *dst,
|
|
const EquipmentConfigurationReport *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentConfigurationReportPluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentConfigurationReportPluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentConfigurationReport *
|
|
EquipmentConfigurationReportPluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentConfigurationReport *) EquipmentConfigurationReportPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPluginSupport_destroy_key(
|
|
EquipmentConfigurationReportKeyHolder *key)
|
|
{
|
|
EquipmentConfigurationReportPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentConfigurationReportPluginSupport_destroy_key((EquipmentConfigurationReportKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentConfigurationReportPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentConfigurationReport >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentConfigurationReportPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentConfigurationReportPluginSupport_create_dataI,
|
|
EquipmentConfigurationReportPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentConfigurationReportPluginSupport_create_keyI , ::TrainingAreaBase::EquipmentConfigurationReportPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentConfigurationReportPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentConfigurationReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentConfigurationReport *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentConfigurationReportPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentConfigurationReport *dst,
|
|
const EquipmentConfigurationReport *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentConfigurationReportPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentConfigurationReport *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentConfigurationReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentConfigurationReport,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentConfigurationReport *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentConfigurationReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentConfigurationReport,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentConfigurationReportPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentConfigurationReportPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentConfigurationReport **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentConfigurationReportPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentConfigurationReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentConfigurationReportKeyHolder *dst,
|
|
const EquipmentConfigurationReport *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentConfigurationReport *dst, const
|
|
EquipmentConfigurationReportKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentConfigurationReportPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentConfigurationReport * sample = NULL;
|
|
sample = (EquipmentConfigurationReport *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentConfigurationReportPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentConfigurationReportPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentConfigurationReportPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentConfigurationReportPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentConfigurationReportPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentConfigurationReportPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentConfigurationReportPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentConfigurationReport >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentConfigurationReportPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentConfigurationReportPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentConfigurationReportPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentConfigurationReport";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentConfigurationReportPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentEvent
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentEventPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentEvent *sample = new EquipmentEvent();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentEvent *
|
|
EquipmentEventPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentEvent *) EquipmentEventPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentEventPluginSupport_destroy_data(
|
|
EquipmentEvent *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentEventPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentEventPluginSupport_destroy_data((EquipmentEvent *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentEventPluginSupport_copy_data(
|
|
EquipmentEvent *dst,
|
|
const EquipmentEvent *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentEventPluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentEventPluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentEvent *
|
|
EquipmentEventPluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentEvent *) EquipmentEventPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentEventPluginSupport_destroy_key(
|
|
EquipmentEventKeyHolder *key)
|
|
{
|
|
EquipmentEventPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentEventPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentEventPluginSupport_destroy_key((EquipmentEventKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentEventPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentEvent >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentEventPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentEventPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentEventPluginSupport_create_dataI,
|
|
EquipmentEventPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentEventPluginSupport_create_keyI , ::TrainingAreaBase::EquipmentEventPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentEventPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentEventPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentEventPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentEventPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentEventPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentEvent *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentEventPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentEventPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentEvent *dst,
|
|
const EquipmentEvent *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentEventPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentEventPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentEventPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentEvent *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentEvent >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentEvent,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentEventPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentEventPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentEvent *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentEvent >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentEvent,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentEventPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentEventPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentEventPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentEvent **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentEventPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentEventPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentEventPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentEventKeyHolder *dst,
|
|
const EquipmentEvent *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentEventPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentEvent *dst, const
|
|
EquipmentEventKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentEventPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentEvent * sample = NULL;
|
|
sample = (EquipmentEvent *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentEventPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentEventPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentEventPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentEventPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentEventPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentEventPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentEventPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentEventPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentEventPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentEventPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentEventPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentEventPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentEvent >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentEventPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentEventPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentEventPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentEvent";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentEventPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Gear
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
GearPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Gear *sample = new Gear();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Gear *
|
|
GearPluginSupport_create_data(void)
|
|
{
|
|
return (Gear *) GearPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
GearPluginSupport_destroy_data(
|
|
Gear *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
GearPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::GearPluginSupport_destroy_data((Gear *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
GearPluginSupport_copy_data(
|
|
Gear *dst,
|
|
const Gear *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
GearPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Gear >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GearPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
GearPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
GearPluginSupport_create_dataI,
|
|
GearPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::GearPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::GearPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GearPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
GearPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Gear *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"GearPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
GearPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Gear *dst,
|
|
const Gear *src)
|
|
{
|
|
return ::TrainingAreaBase::GearPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
GearPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
GearPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Gear *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Gear >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Gear,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
GearPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GearPlugin_deserialize_from_cdr_buffer(
|
|
Gear *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Gear >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Gear,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
GearPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
GearPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool GearPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Gear **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
GearPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
GearPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *GearPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::GearPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::GearPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::GearPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::GearPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::GearPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
GearPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
GearPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::GearPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
GearPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
GearPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::GearPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Gear >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::GearPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
GearPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
GearPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Gear";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
GearPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentGearAssignment
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentGearAssignmentPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentGearAssignment *sample = new EquipmentGearAssignment();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentGearAssignment *
|
|
EquipmentGearAssignmentPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentGearAssignment *) EquipmentGearAssignmentPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPluginSupport_destroy_data(
|
|
EquipmentGearAssignment *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentGearAssignmentPluginSupport_destroy_data((EquipmentGearAssignment *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPluginSupport_copy_data(
|
|
EquipmentGearAssignment *dst,
|
|
const EquipmentGearAssignment *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentGearAssignmentPluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentGearAssignmentPluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentGearAssignment *
|
|
EquipmentGearAssignmentPluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentGearAssignment *) EquipmentGearAssignmentPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPluginSupport_destroy_key(
|
|
EquipmentGearAssignmentKeyHolder *key)
|
|
{
|
|
EquipmentGearAssignmentPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentGearAssignmentPluginSupport_destroy_key((EquipmentGearAssignmentKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentGearAssignmentPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearAssignment >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentGearAssignmentPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentGearAssignmentPluginSupport_create_dataI,
|
|
EquipmentGearAssignmentPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentGearAssignmentPluginSupport_create_keyI , ::TrainingAreaBase::EquipmentGearAssignmentPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentGearAssignmentPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentGearAssignmentPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentGearAssignmentPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearAssignment *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentGearAssignmentPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentGearAssignment *dst,
|
|
const EquipmentGearAssignment *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentGearAssignmentPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentGearAssignmentPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentGearAssignment *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearAssignment >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentGearAssignment,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentGearAssignmentPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentGearAssignment *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearAssignment >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentGearAssignment,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearAssignmentPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentGearAssignmentPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentGearAssignmentPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearAssignment **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearAssignmentPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearAssignmentPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearAssignmentKeyHolder *dst,
|
|
const EquipmentGearAssignment *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearAssignment *dst, const
|
|
EquipmentGearAssignmentKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearAssignmentPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentGearAssignment * sample = NULL;
|
|
sample = (EquipmentGearAssignment *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentGearAssignmentPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentGearAssignmentPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentGearAssignmentPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentGearAssignmentPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentGearAssignmentPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentGearAssignmentPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentGearAssignmentPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentGearAssignment >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentGearAssignmentPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentGearAssignmentPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentGearAssignmentPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentGearAssignment";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentGearAssignmentPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type GearCharge
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
GearChargePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
GearCharge *sample = new GearCharge();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
GearCharge *
|
|
GearChargePluginSupport_create_data(void)
|
|
{
|
|
return (GearCharge *) GearChargePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
GearChargePluginSupport_destroy_data(
|
|
GearCharge *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
GearChargePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::GearChargePluginSupport_destroy_data((GearCharge *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
GearChargePluginSupport_copy_data(
|
|
GearCharge *dst,
|
|
const GearCharge *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
GearChargePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< GearCharge >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GearChargePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
GearChargePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
GearChargePluginSupport_create_dataI,
|
|
GearChargePluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::GearChargePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::GearChargePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GearChargePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
GearChargePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearCharge *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"GearChargePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
GearChargePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
GearCharge *dst,
|
|
const GearCharge *src)
|
|
{
|
|
return ::TrainingAreaBase::GearChargePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
GearChargePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
GearChargePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const GearCharge *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< GearCharge >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GearCharge,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
GearChargePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GearChargePlugin_deserialize_from_cdr_buffer(
|
|
GearCharge *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< GearCharge >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GearCharge,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
GearChargePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
GearChargePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool GearChargePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearCharge **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
GearChargePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
GearChargePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *GearChargePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::GearChargePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::GearChargePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::GearChargePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::GearChargePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::GearChargePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
GearChargePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
GearChargePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::GearChargePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
GearChargePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
GearChargePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::GearChargePlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::GearCharge >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::GearChargePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
GearChargePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
GearChargePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::GearCharge";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
GearChargePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentGearChargeState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentGearChargeStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentGearChargeState *sample = new EquipmentGearChargeState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentGearChargeState *
|
|
EquipmentGearChargeStatePluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentGearChargeState *) EquipmentGearChargeStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePluginSupport_destroy_data(
|
|
EquipmentGearChargeState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentGearChargeStatePluginSupport_destroy_data((EquipmentGearChargeState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePluginSupport_copy_data(
|
|
EquipmentGearChargeState *dst,
|
|
const EquipmentGearChargeState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentGearChargeStatePluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentGearChargeStatePluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentGearChargeState *
|
|
EquipmentGearChargeStatePluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentGearChargeState *) EquipmentGearChargeStatePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePluginSupport_destroy_key(
|
|
EquipmentGearChargeStateKeyHolder *key)
|
|
{
|
|
EquipmentGearChargeStatePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentGearChargeStatePluginSupport_destroy_key((EquipmentGearChargeStateKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentGearChargeStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearChargeState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentGearChargeStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentGearChargeStatePluginSupport_create_dataI,
|
|
EquipmentGearChargeStatePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentGearChargeStatePluginSupport_create_keyI , ::TrainingAreaBase::EquipmentGearChargeStatePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentGearChargeStatePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentGearChargeStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentGearChargeStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearChargeState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentGearChargeStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentGearChargeState *dst,
|
|
const EquipmentGearChargeState *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentGearChargeStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentGearChargeStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentGearChargeState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearChargeState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentGearChargeState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentGearChargeStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePlugin_deserialize_from_cdr_buffer(
|
|
EquipmentGearChargeState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearChargeState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentGearChargeState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearChargeStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentGearChargeStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentGearChargeStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearChargeState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearChargeStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearChargeStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearChargeStateKeyHolder *dst,
|
|
const EquipmentGearChargeState *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearChargeState *dst, const
|
|
EquipmentGearChargeStateKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearChargeStatePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentGearChargeState * sample = NULL;
|
|
sample = (EquipmentGearChargeState *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentGearChargeStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentGearChargeStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentGearChargeStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentGearChargeStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentGearChargeStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentGearChargeStatePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentGearChargeStatePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentGearChargeState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentGearChargeStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentGearChargeStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentGearChargeStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentGearChargeState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentGearChargeStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentGearEvent
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentGearEventPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentGearEvent *sample = new EquipmentGearEvent();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentGearEvent *
|
|
EquipmentGearEventPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentGearEvent *) EquipmentGearEventPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPluginSupport_destroy_data(
|
|
EquipmentGearEvent *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentGearEventPluginSupport_destroy_data((EquipmentGearEvent *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearEventPluginSupport_copy_data(
|
|
EquipmentGearEvent *dst,
|
|
const EquipmentGearEvent *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentGearEventPluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentGearEventPluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentGearEvent *
|
|
EquipmentGearEventPluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentGearEvent *) EquipmentGearEventPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPluginSupport_destroy_key(
|
|
EquipmentGearEventKeyHolder *key)
|
|
{
|
|
EquipmentGearEventPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentGearEventPluginSupport_destroy_key((EquipmentGearEventKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentGearEventPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearEvent >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentGearEventPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentGearEventPluginSupport_create_dataI,
|
|
EquipmentGearEventPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentGearEventPluginSupport_create_keyI , ::TrainingAreaBase::EquipmentGearEventPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentGearEventPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentGearEventPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentGearEventPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearEvent *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentGearEventPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearEventPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentGearEvent *dst,
|
|
const EquipmentGearEvent *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentGearEventPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentGearEventPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentGearEventPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentGearEvent *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearEvent >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentGearEvent,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentGearEventPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearEventPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentGearEvent *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentGearEvent >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentGearEvent,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearEventPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentGearEventPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentGearEventPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearEvent **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearEventPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentGearEventPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearEventPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearEventKeyHolder *dst,
|
|
const EquipmentGearEvent *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearEventPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentGearEvent *dst, const
|
|
EquipmentGearEventKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentGearEventPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentGearEvent * sample = NULL;
|
|
sample = (EquipmentGearEvent *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentGearEventPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentGearEventPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentGearEventPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentGearEventPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentGearEventPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentGearEventPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentGearEventPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentGearEvent >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentGearEventPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentGearEventPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentGearEventPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentGearEvent";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentGearEventPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentMessage
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentMessagePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentMessage *sample = new EquipmentMessage();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentMessage *
|
|
EquipmentMessagePluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentMessage *) EquipmentMessagePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePluginSupport_destroy_data(
|
|
EquipmentMessage *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentMessagePluginSupport_destroy_data((EquipmentMessage *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentMessagePluginSupport_copy_data(
|
|
EquipmentMessage *dst,
|
|
const EquipmentMessage *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentMessagePluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentMessagePluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentMessage *
|
|
EquipmentMessagePluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentMessage *) EquipmentMessagePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePluginSupport_destroy_key(
|
|
EquipmentMessageKeyHolder *key)
|
|
{
|
|
EquipmentMessagePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentMessagePluginSupport_destroy_key((EquipmentMessageKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentMessagePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentMessage >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentMessagePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentMessagePluginSupport_create_dataI,
|
|
EquipmentMessagePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentMessagePluginSupport_create_keyI , ::TrainingAreaBase::EquipmentMessagePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentMessagePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentMessagePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentMessagePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentMessage *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentMessagePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentMessagePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentMessage *dst,
|
|
const EquipmentMessage *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentMessagePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentMessagePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentMessagePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentMessage *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentMessage >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentMessage,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentMessagePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentMessagePlugin_deserialize_from_cdr_buffer(
|
|
EquipmentMessage *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentMessage >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentMessage,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentMessagePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentMessagePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentMessagePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentMessage **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentMessagePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentMessagePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentMessagePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentMessageKeyHolder *dst,
|
|
const EquipmentMessage *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentMessagePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentMessage *dst, const
|
|
EquipmentMessageKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentMessagePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentMessage * sample = NULL;
|
|
sample = (EquipmentMessage *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentMessagePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentMessagePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentMessagePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentMessagePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentMessagePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentMessagePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentMessagePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentMessagePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentMessage >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentMessagePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentMessagePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentMessagePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentMessage";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentMessagePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentOperationalState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentOperationalStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentOperationalState *sample = new EquipmentOperationalState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentOperationalState *
|
|
EquipmentOperationalStatePluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentOperationalState *) EquipmentOperationalStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePluginSupport_destroy_data(
|
|
EquipmentOperationalState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentOperationalStatePluginSupport_destroy_data((EquipmentOperationalState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePluginSupport_copy_data(
|
|
EquipmentOperationalState *dst,
|
|
const EquipmentOperationalState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentOperationalStatePluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentOperationalStatePluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentOperationalState *
|
|
EquipmentOperationalStatePluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentOperationalState *) EquipmentOperationalStatePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePluginSupport_destroy_key(
|
|
EquipmentOperationalStateKeyHolder *key)
|
|
{
|
|
EquipmentOperationalStatePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentOperationalStatePluginSupport_destroy_key((EquipmentOperationalStateKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentOperationalStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentOperationalState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentOperationalStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentOperationalStatePluginSupport_create_dataI,
|
|
EquipmentOperationalStatePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentOperationalStatePluginSupport_create_keyI , ::TrainingAreaBase::EquipmentOperationalStatePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentOperationalStatePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentOperationalStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentOperationalStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentOperationalState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentOperationalStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentOperationalState *dst,
|
|
const EquipmentOperationalState *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentOperationalStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentOperationalStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentOperationalState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentOperationalState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentOperationalState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentOperationalStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePlugin_deserialize_from_cdr_buffer(
|
|
EquipmentOperationalState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentOperationalState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentOperationalState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentOperationalStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentOperationalStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentOperationalStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentOperationalState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentOperationalStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentOperationalStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentOperationalStateKeyHolder *dst,
|
|
const EquipmentOperationalState *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentOperationalState *dst, const
|
|
EquipmentOperationalStateKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentOperationalStatePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentOperationalState * sample = NULL;
|
|
sample = (EquipmentOperationalState *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentOperationalStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentOperationalStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentOperationalStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentOperationalStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentOperationalStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentOperationalStatePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentOperationalStatePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentOperationalState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentOperationalStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentOperationalStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentOperationalStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentOperationalState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentOperationalStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TabPosition
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TabPositionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TabPosition *sample = new TabPosition();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TabPosition *
|
|
TabPositionPluginSupport_create_data(void)
|
|
{
|
|
return (TabPosition *) TabPositionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TabPositionPluginSupport_destroy_data(
|
|
TabPosition *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TabPositionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::TabPositionPluginSupport_destroy_data((TabPosition *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TabPositionPluginSupport_copy_data(
|
|
TabPosition *dst,
|
|
const TabPosition *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TabPositionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TabPosition >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TabPositionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
TabPositionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
TabPositionPluginSupport_create_dataI,
|
|
TabPositionPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::TabPositionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TabPositionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TabPositionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TabPositionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TabPosition *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TabPositionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TabPositionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TabPosition *dst,
|
|
const TabPosition *src)
|
|
{
|
|
return ::TrainingAreaBase::TabPositionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TabPositionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TabPositionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TabPosition *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TabPosition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TabPosition,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
TabPositionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TabPositionPlugin_deserialize_from_cdr_buffer(
|
|
TabPosition *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TabPosition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TabPosition,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
TabPositionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
TabPositionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool TabPositionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TabPosition **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TabPositionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TabPositionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *TabPositionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::TabPositionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::TabPositionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::TabPositionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::TabPositionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::TabPositionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TabPositionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TabPositionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TabPositionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TabPositionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TabPositionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::TabPositionPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::TabPosition >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::TabPositionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TabPositionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TabPositionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::TabPosition";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TabPositionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentPosition
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentPositionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentPosition *sample = new EquipmentPosition();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentPosition *
|
|
EquipmentPositionPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentPosition *) EquipmentPositionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPluginSupport_destroy_data(
|
|
EquipmentPosition *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentPositionPluginSupport_destroy_data((EquipmentPosition *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPositionPluginSupport_copy_data(
|
|
EquipmentPosition *dst,
|
|
const EquipmentPosition *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentPositionPluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentPositionPluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentPosition *
|
|
EquipmentPositionPluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentPosition *) EquipmentPositionPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPluginSupport_destroy_key(
|
|
EquipmentPositionKeyHolder *key)
|
|
{
|
|
EquipmentPositionPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentPositionPluginSupport_destroy_key((EquipmentPositionKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentPositionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentPosition >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentPositionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentPositionPluginSupport_create_dataI,
|
|
EquipmentPositionPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentPositionPluginSupport_create_keyI , ::TrainingAreaBase::EquipmentPositionPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentPositionPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentPositionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentPositionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentPosition *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentPositionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPositionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentPosition *dst,
|
|
const EquipmentPosition *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentPositionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentPositionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentPositionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentPosition *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentPosition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentPosition,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentPositionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPositionPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentPosition *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentPosition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentPosition,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentPositionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentPositionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentPositionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentPosition **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentPositionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentPositionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPositionPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentPositionKeyHolder *dst,
|
|
const EquipmentPosition *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPositionPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentPosition *dst, const
|
|
EquipmentPositionKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentPositionPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentPosition * sample = NULL;
|
|
sample = (EquipmentPosition *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentPositionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentPositionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentPositionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentPositionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentPositionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentPositionPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentPositionPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentPositionPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentPosition >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentPositionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentPositionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentPositionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentPosition";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentPositionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentState *sample = new EquipmentState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentState *
|
|
EquipmentStatePluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentState *) EquipmentStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentStatePluginSupport_destroy_data(
|
|
EquipmentState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentStatePluginSupport_destroy_data((EquipmentState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentStatePluginSupport_copy_data(
|
|
EquipmentState *dst,
|
|
const EquipmentState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentStatePluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentStatePluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentState *
|
|
EquipmentStatePluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentState *) EquipmentStatePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentStatePluginSupport_destroy_key(
|
|
EquipmentStateKeyHolder *key)
|
|
{
|
|
EquipmentStatePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentStatePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::EquipmentStatePluginSupport_destroy_key((EquipmentStateKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentStatePluginSupport_create_dataI,
|
|
EquipmentStatePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::EquipmentStatePluginSupport_create_keyI , ::TrainingAreaBase::EquipmentStatePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::EquipmentStatePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentState *dst,
|
|
const EquipmentState *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentStatePlugin_deserialize_from_cdr_buffer(
|
|
EquipmentState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentStatePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentStateKeyHolder *dst,
|
|
const EquipmentState *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentStatePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentState *dst, const
|
|
EquipmentStateKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentStatePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentState * sample = NULL;
|
|
sample = (EquipmentState *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentStatePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentStatePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::EquipmentStatePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentSwVersion
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentSwVersionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentSwVersion *sample = new EquipmentSwVersion();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentSwVersion *
|
|
EquipmentSwVersionPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentSwVersion *) EquipmentSwVersionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentSwVersionPluginSupport_destroy_data(
|
|
EquipmentSwVersion *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentSwVersionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::EquipmentSwVersionPluginSupport_destroy_data((EquipmentSwVersion *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSwVersionPluginSupport_copy_data(
|
|
EquipmentSwVersion *dst,
|
|
const EquipmentSwVersion *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentSwVersionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentSwVersion >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentSwVersionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
EquipmentSwVersionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
EquipmentSwVersionPluginSupport_create_dataI,
|
|
EquipmentSwVersionPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::EquipmentSwVersionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentSwVersionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentSwVersionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentSwVersion *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentSwVersionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSwVersionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentSwVersion *dst,
|
|
const EquipmentSwVersion *src)
|
|
{
|
|
return ::TrainingAreaBase::EquipmentSwVersionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentSwVersionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentSwVersionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentSwVersion *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentSwVersion >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentSwVersion,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
EquipmentSwVersionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSwVersionPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentSwVersion *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< EquipmentSwVersion >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentSwVersion,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentSwVersionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
EquipmentSwVersionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentSwVersionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentSwVersion **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentSwVersionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
EquipmentSwVersionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *EquipmentSwVersionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentSwVersionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentSwVersionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentSwVersionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentSwVersionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::EquipmentSwVersion >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::EquipmentSwVersionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentSwVersionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentSwVersionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::EquipmentSwVersion";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentSwVersionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L12_TargetData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L12_TargetDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L12_TargetData *sample = new L12_TargetData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L12_TargetData *
|
|
L12_TargetDataPluginSupport_create_data(void)
|
|
{
|
|
return (L12_TargetData *) L12_TargetDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPluginSupport_destroy_data(
|
|
L12_TargetData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L12_TargetDataPluginSupport_destroy_data((L12_TargetData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L12_TargetDataPluginSupport_copy_data(
|
|
L12_TargetData *dst,
|
|
const L12_TargetData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
L12_TargetDataPluginSupport_create_keyI(void)
|
|
{
|
|
return L12_TargetDataPluginSupport_create_data();
|
|
}
|
|
|
|
L12_TargetData *
|
|
L12_TargetDataPluginSupport_create_key(void)
|
|
{
|
|
return (L12_TargetData *) L12_TargetDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPluginSupport_destroy_key(
|
|
L12_TargetDataKeyHolder *key)
|
|
{
|
|
L12_TargetDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::L12_TargetDataPluginSupport_destroy_key((L12_TargetDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L12_TargetDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L12_TargetData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L12_TargetDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L12_TargetDataPluginSupport_create_dataI,
|
|
L12_TargetDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::L12_TargetDataPluginSupport_create_keyI , ::TrainingAreaBase::L12_TargetDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::L12_TargetDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = L12_TargetDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L12_TargetDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L12_TargetData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L12_TargetDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L12_TargetDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L12_TargetData *dst,
|
|
const L12_TargetData *src)
|
|
{
|
|
return ::TrainingAreaBase::L12_TargetDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L12_TargetDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L12_TargetDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L12_TargetData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L12_TargetData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L12_TargetData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L12_TargetDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L12_TargetDataPlugin_deserialize_from_cdr_buffer(
|
|
L12_TargetData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L12_TargetData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L12_TargetData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L12_TargetDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L12_TargetDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool L12_TargetDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L12_TargetData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L12_TargetDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L12_TargetDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
L12_TargetDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L12_TargetDataKeyHolder *dst,
|
|
const L12_TargetData *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->number = src->number;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L12_TargetDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L12_TargetData *dst, const
|
|
L12_TargetDataKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->number = src->number;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L12_TargetDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
L12_TargetData * sample = NULL;
|
|
sample = (L12_TargetData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L12_TargetDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L12_TargetDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L12_TargetDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L12_TargetDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L12_TargetDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
L12_TargetDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
L12_TargetDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::L12_TargetDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L12_TargetData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L12_TargetDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L12_TargetDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L12_TargetDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L12_TargetData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L12_TargetDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L36_FiringCommandCharges
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L36_FiringCommandChargesPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L36_FiringCommandCharges *sample = new L36_FiringCommandCharges();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L36_FiringCommandCharges *
|
|
L36_FiringCommandChargesPluginSupport_create_data(void)
|
|
{
|
|
return (L36_FiringCommandCharges *) L36_FiringCommandChargesPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L36_FiringCommandChargesPluginSupport_destroy_data(
|
|
L36_FiringCommandCharges *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L36_FiringCommandChargesPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L36_FiringCommandChargesPluginSupport_destroy_data((L36_FiringCommandCharges *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L36_FiringCommandChargesPluginSupport_copy_data(
|
|
L36_FiringCommandCharges *dst,
|
|
const L36_FiringCommandCharges *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L36_FiringCommandChargesPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L36_FiringCommandCharges >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L36_FiringCommandChargesPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L36_FiringCommandChargesPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L36_FiringCommandChargesPluginSupport_create_dataI,
|
|
L36_FiringCommandChargesPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L36_FiringCommandChargesPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L36_FiringCommandChargesPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L36_FiringCommandChargesPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L36_FiringCommandCharges *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L36_FiringCommandChargesPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L36_FiringCommandChargesPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L36_FiringCommandCharges *dst,
|
|
const L36_FiringCommandCharges *src)
|
|
{
|
|
return ::TrainingAreaBase::L36_FiringCommandChargesPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L36_FiringCommandChargesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L36_FiringCommandChargesPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L36_FiringCommandCharges *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L36_FiringCommandCharges >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L36_FiringCommandCharges,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L36_FiringCommandChargesPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L36_FiringCommandChargesPlugin_deserialize_from_cdr_buffer(
|
|
L36_FiringCommandCharges *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L36_FiringCommandCharges >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L36_FiringCommandCharges,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L36_FiringCommandChargesPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L36_FiringCommandChargesPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L36_FiringCommandChargesPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L36_FiringCommandCharges **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L36_FiringCommandChargesPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L36_FiringCommandChargesPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L36_FiringCommandChargesPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L36_FiringCommandChargesPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L36_FiringCommandChargesPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L36_FiringCommandChargesPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L36_FiringCommandChargesPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L36_FiringCommandCharges >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L36_FiringCommandChargesPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L36_FiringCommandChargesPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L36_FiringCommandChargesPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L36_FiringCommandCharges";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L36_FiringCommandChargesPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L35_TrajectoryPoint
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L35_TrajectoryPointPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L35_TrajectoryPoint *sample = new L35_TrajectoryPoint();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L35_TrajectoryPoint *
|
|
L35_TrajectoryPointPluginSupport_create_data(void)
|
|
{
|
|
return (L35_TrajectoryPoint *) L35_TrajectoryPointPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L35_TrajectoryPointPluginSupport_destroy_data(
|
|
L35_TrajectoryPoint *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L35_TrajectoryPointPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L35_TrajectoryPointPluginSupport_destroy_data((L35_TrajectoryPoint *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L35_TrajectoryPointPluginSupport_copy_data(
|
|
L35_TrajectoryPoint *dst,
|
|
const L35_TrajectoryPoint *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L35_TrajectoryPointPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L35_TrajectoryPoint >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L35_TrajectoryPointPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L35_TrajectoryPointPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L35_TrajectoryPointPluginSupport_create_dataI,
|
|
L35_TrajectoryPointPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L35_TrajectoryPointPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L35_TrajectoryPointPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L35_TrajectoryPointPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L35_TrajectoryPoint *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L35_TrajectoryPointPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L35_TrajectoryPointPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L35_TrajectoryPoint *dst,
|
|
const L35_TrajectoryPoint *src)
|
|
{
|
|
return ::TrainingAreaBase::L35_TrajectoryPointPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L35_TrajectoryPointPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L35_TrajectoryPointPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L35_TrajectoryPoint *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L35_TrajectoryPoint >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L35_TrajectoryPoint,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L35_TrajectoryPointPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L35_TrajectoryPointPlugin_deserialize_from_cdr_buffer(
|
|
L35_TrajectoryPoint *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L35_TrajectoryPoint >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L35_TrajectoryPoint,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L35_TrajectoryPointPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L35_TrajectoryPointPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L35_TrajectoryPointPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L35_TrajectoryPoint **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L35_TrajectoryPointPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L35_TrajectoryPointPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L35_TrajectoryPointPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L35_TrajectoryPointPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L35_TrajectoryPointPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L35_TrajectoryPointPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L35_TrajectoryPointPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L35_TrajectoryPoint >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L35_TrajectoryPointPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L35_TrajectoryPointPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L35_TrajectoryPointPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L35_TrajectoryPoint";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L35_TrajectoryPointPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L39_ScatteringData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L39_ScatteringDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L39_ScatteringData *sample = new L39_ScatteringData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L39_ScatteringData *
|
|
L39_ScatteringDataPluginSupport_create_data(void)
|
|
{
|
|
return (L39_ScatteringData *) L39_ScatteringDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L39_ScatteringDataPluginSupport_destroy_data(
|
|
L39_ScatteringData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L39_ScatteringDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L39_ScatteringDataPluginSupport_destroy_data((L39_ScatteringData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L39_ScatteringDataPluginSupport_copy_data(
|
|
L39_ScatteringData *dst,
|
|
const L39_ScatteringData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L39_ScatteringDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L39_ScatteringData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L39_ScatteringDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L39_ScatteringDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L39_ScatteringDataPluginSupport_create_dataI,
|
|
L39_ScatteringDataPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L39_ScatteringDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L39_ScatteringDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L39_ScatteringDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L39_ScatteringData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L39_ScatteringDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L39_ScatteringDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L39_ScatteringData *dst,
|
|
const L39_ScatteringData *src)
|
|
{
|
|
return ::TrainingAreaBase::L39_ScatteringDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L39_ScatteringDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L39_ScatteringDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L39_ScatteringData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L39_ScatteringData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L39_ScatteringData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L39_ScatteringDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L39_ScatteringDataPlugin_deserialize_from_cdr_buffer(
|
|
L39_ScatteringData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L39_ScatteringData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L39_ScatteringData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L39_ScatteringDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L39_ScatteringDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L39_ScatteringDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L39_ScatteringData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L39_ScatteringDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L39_ScatteringDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L39_ScatteringDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L39_ScatteringDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L39_ScatteringDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L39_ScatteringDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L39_ScatteringDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L39_ScatteringData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L39_ScatteringDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L39_ScatteringDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L39_ScatteringDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L39_ScatteringData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L39_ScatteringDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L34_effector
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L34_effectorPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L34_effector *sample = new L34_effector();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L34_effector *
|
|
L34_effectorPluginSupport_create_data(void)
|
|
{
|
|
return (L34_effector *) L34_effectorPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L34_effectorPluginSupport_destroy_data(
|
|
L34_effector *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L34_effectorPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L34_effectorPluginSupport_destroy_data((L34_effector *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L34_effectorPluginSupport_copy_data(
|
|
L34_effector *dst,
|
|
const L34_effector *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L34_effectorPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L34_effector >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L34_effectorPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L34_effectorPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L34_effectorPluginSupport_create_dataI,
|
|
L34_effectorPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L34_effectorPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L34_effectorPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L34_effectorPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L34_effectorPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L34_effector *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L34_effectorPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L34_effectorPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L34_effector *dst,
|
|
const L34_effector *src)
|
|
{
|
|
return ::TrainingAreaBase::L34_effectorPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L34_effectorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L34_effectorPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L34_effector *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L34_effector >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L34_effector,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L34_effectorPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L34_effectorPlugin_deserialize_from_cdr_buffer(
|
|
L34_effector *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L34_effector >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L34_effector,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L34_effectorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L34_effectorPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L34_effectorPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L34_effector **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L34_effectorPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L34_effectorPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L34_effectorPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L34_effectorPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L34_effectorPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L34_effectorPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L34_effectorPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L34_effectorPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L34_effectorPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L34_effectorPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L34_effectorPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L34_effectorPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L34_effectorPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L34_effectorPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L34_effector >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L34_effectorPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L34_effectorPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L34_effectorPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L34_effector";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L34_effectorPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L33_FireCommand
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L33_FireCommandPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L33_FireCommand *sample = new L33_FireCommand();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L33_FireCommand *
|
|
L33_FireCommandPluginSupport_create_data(void)
|
|
{
|
|
return (L33_FireCommand *) L33_FireCommandPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L33_FireCommandPluginSupport_destroy_data(
|
|
L33_FireCommand *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L33_FireCommandPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L33_FireCommandPluginSupport_destroy_data((L33_FireCommand *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L33_FireCommandPluginSupport_copy_data(
|
|
L33_FireCommand *dst,
|
|
const L33_FireCommand *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L33_FireCommandPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L33_FireCommand >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L33_FireCommandPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L33_FireCommandPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L33_FireCommandPluginSupport_create_dataI,
|
|
L33_FireCommandPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L33_FireCommandPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L33_FireCommandPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L33_FireCommandPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L33_FireCommand *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L33_FireCommandPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L33_FireCommandPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L33_FireCommand *dst,
|
|
const L33_FireCommand *src)
|
|
{
|
|
return ::TrainingAreaBase::L33_FireCommandPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L33_FireCommandPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L33_FireCommandPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L33_FireCommand *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L33_FireCommand >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L33_FireCommand,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L33_FireCommandPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L33_FireCommandPlugin_deserialize_from_cdr_buffer(
|
|
L33_FireCommand *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L33_FireCommand >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L33_FireCommand,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L33_FireCommandPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L33_FireCommandPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L33_FireCommandPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L33_FireCommand **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L33_FireCommandPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L33_FireCommandPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L33_FireCommandPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L33_FireCommandPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L33_FireCommandPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L33_FireCommandPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L33_FireCommandPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L33_FireCommandPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L33_FireCommand >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L33_FireCommandPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L33_FireCommandPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L33_FireCommandPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L33_FireCommand";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L33_FireCommandPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ExAwesPlanning
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ExAwesPlanningPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ExAwesPlanning *sample = new ExAwesPlanning();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ExAwesPlanning *
|
|
ExAwesPlanningPluginSupport_create_data(void)
|
|
{
|
|
return (ExAwesPlanning *) ExAwesPlanningPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPluginSupport_destroy_data(
|
|
ExAwesPlanning *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ExAwesPlanningPluginSupport_destroy_data((ExAwesPlanning *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ExAwesPlanningPluginSupport_copy_data(
|
|
ExAwesPlanning *dst,
|
|
const ExAwesPlanning *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ExAwesPlanningPluginSupport_create_keyI(void)
|
|
{
|
|
return ExAwesPlanningPluginSupport_create_data();
|
|
}
|
|
|
|
ExAwesPlanning *
|
|
ExAwesPlanningPluginSupport_create_key(void)
|
|
{
|
|
return (ExAwesPlanning *) ExAwesPlanningPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPluginSupport_destroy_key(
|
|
ExAwesPlanningKeyHolder *key)
|
|
{
|
|
ExAwesPlanningPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ExAwesPlanningPluginSupport_destroy_key((ExAwesPlanningKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ExAwesPlanningPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ExAwesPlanning >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ExAwesPlanningPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ExAwesPlanningPluginSupport_create_dataI,
|
|
ExAwesPlanningPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ExAwesPlanningPluginSupport_create_keyI , ::TrainingAreaBase::ExAwesPlanningPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ExAwesPlanningPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ExAwesPlanningPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ExAwesPlanningPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExAwesPlanning *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ExAwesPlanningPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ExAwesPlanningPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ExAwesPlanning *dst,
|
|
const ExAwesPlanning *src)
|
|
{
|
|
return ::TrainingAreaBase::ExAwesPlanningPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ExAwesPlanningPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ExAwesPlanningPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ExAwesPlanning *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ExAwesPlanning >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ExAwesPlanning,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ExAwesPlanningPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ExAwesPlanningPlugin_deserialize_from_cdr_buffer(
|
|
ExAwesPlanning *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ExAwesPlanning >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ExAwesPlanning,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ExAwesPlanningPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ExAwesPlanningPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ExAwesPlanningPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExAwesPlanning **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ExAwesPlanningPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ExAwesPlanningPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ExAwesPlanningPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExAwesPlanningKeyHolder *dst,
|
|
const ExAwesPlanning *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ExAwesPlanningPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExAwesPlanning *dst, const
|
|
ExAwesPlanningKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ExAwesPlanningPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ExAwesPlanning * sample = NULL;
|
|
sample = (ExAwesPlanning *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ExAwesPlanningPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ExAwesPlanningPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ExAwesPlanningPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ExAwesPlanningPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ExAwesPlanningPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ExAwesPlanningPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ExAwesPlanningPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ExAwesPlanning >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ExAwesPlanningPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ExAwesPlanningPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ExAwesPlanningPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ExAwesPlanning";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ExAwesPlanningPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type L13_EffectorUnit
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
L13_EffectorUnitPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
L13_EffectorUnit *sample = new L13_EffectorUnit();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
L13_EffectorUnit *
|
|
L13_EffectorUnitPluginSupport_create_data(void)
|
|
{
|
|
return (L13_EffectorUnit *) L13_EffectorUnitPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
L13_EffectorUnitPluginSupport_destroy_data(
|
|
L13_EffectorUnit *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
L13_EffectorUnitPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::L13_EffectorUnitPluginSupport_destroy_data((L13_EffectorUnit *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
L13_EffectorUnitPluginSupport_copy_data(
|
|
L13_EffectorUnit *dst,
|
|
const L13_EffectorUnit *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
L13_EffectorUnitPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L13_EffectorUnit >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L13_EffectorUnitPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
L13_EffectorUnitPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
L13_EffectorUnitPluginSupport_create_dataI,
|
|
L13_EffectorUnitPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::L13_EffectorUnitPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
L13_EffectorUnitPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
L13_EffectorUnitPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L13_EffectorUnit *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"L13_EffectorUnitPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
L13_EffectorUnitPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
L13_EffectorUnit *dst,
|
|
const L13_EffectorUnit *src)
|
|
{
|
|
return ::TrainingAreaBase::L13_EffectorUnitPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
L13_EffectorUnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
L13_EffectorUnitPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const L13_EffectorUnit *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L13_EffectorUnit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L13_EffectorUnit,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
L13_EffectorUnitPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
L13_EffectorUnitPlugin_deserialize_from_cdr_buffer(
|
|
L13_EffectorUnit *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< L13_EffectorUnit >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
L13_EffectorUnit,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
L13_EffectorUnitPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
L13_EffectorUnitPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool L13_EffectorUnitPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
L13_EffectorUnit **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L13_EffectorUnitPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
L13_EffectorUnitPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *L13_EffectorUnitPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
L13_EffectorUnitPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
L13_EffectorUnitPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
L13_EffectorUnitPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
L13_EffectorUnitPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::L13_EffectorUnit >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::L13_EffectorUnitPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
L13_EffectorUnitPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
L13_EffectorUnitPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::L13_EffectorUnit";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
L13_EffectorUnitPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ExReportEffector
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ExReportEffectorPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ExReportEffector *sample = new ExReportEffector();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ExReportEffector *
|
|
ExReportEffectorPluginSupport_create_data(void)
|
|
{
|
|
return (ExReportEffector *) ExReportEffectorPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPluginSupport_destroy_data(
|
|
ExReportEffector *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ExReportEffectorPluginSupport_destroy_data((ExReportEffector *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ExReportEffectorPluginSupport_copy_data(
|
|
ExReportEffector *dst,
|
|
const ExReportEffector *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ExReportEffectorPluginSupport_create_keyI(void)
|
|
{
|
|
return ExReportEffectorPluginSupport_create_data();
|
|
}
|
|
|
|
ExReportEffector *
|
|
ExReportEffectorPluginSupport_create_key(void)
|
|
{
|
|
return (ExReportEffector *) ExReportEffectorPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPluginSupport_destroy_key(
|
|
ExReportEffectorKeyHolder *key)
|
|
{
|
|
ExReportEffectorPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ExReportEffectorPluginSupport_destroy_key((ExReportEffectorKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ExReportEffectorPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ExReportEffector >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ExReportEffectorPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ExReportEffectorPluginSupport_create_dataI,
|
|
ExReportEffectorPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ExReportEffectorPluginSupport_create_keyI , ::TrainingAreaBase::ExReportEffectorPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ExReportEffectorPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ExReportEffectorPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ExReportEffectorPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExReportEffector *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ExReportEffectorPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ExReportEffectorPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ExReportEffector *dst,
|
|
const ExReportEffector *src)
|
|
{
|
|
return ::TrainingAreaBase::ExReportEffectorPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ExReportEffectorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ExReportEffectorPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ExReportEffector *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ExReportEffector >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ExReportEffector,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ExReportEffectorPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ExReportEffectorPlugin_deserialize_from_cdr_buffer(
|
|
ExReportEffector *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ExReportEffector >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ExReportEffector,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ExReportEffectorPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ExReportEffectorPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ExReportEffectorPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExReportEffector **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ExReportEffectorPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ExReportEffectorPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ExReportEffectorPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExReportEffectorKeyHolder *dst,
|
|
const ExReportEffector *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ExReportEffectorPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ExReportEffector *dst, const
|
|
ExReportEffectorKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ExReportEffectorPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ExReportEffector * sample = NULL;
|
|
sample = (ExReportEffector *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ExReportEffectorPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ExReportEffectorPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ExReportEffectorPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ExReportEffectorPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ExReportEffectorPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ExReportEffectorPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ExReportEffectorPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ExReportEffectorPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ExReportEffector >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ExReportEffectorPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ExReportEffectorPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ExReportEffectorPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ExReportEffector";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ExReportEffectorPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Ex_ReconResults
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
Ex_ReconResultsPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Ex_ReconResults *sample = new Ex_ReconResults();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Ex_ReconResults *
|
|
Ex_ReconResultsPluginSupport_create_data(void)
|
|
{
|
|
return (Ex_ReconResults *) Ex_ReconResultsPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPluginSupport_destroy_data(
|
|
Ex_ReconResults *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::Ex_ReconResultsPluginSupport_destroy_data((Ex_ReconResults *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPluginSupport_copy_data(
|
|
Ex_ReconResults *dst,
|
|
const Ex_ReconResults *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
Ex_ReconResultsPluginSupport_create_keyI(void)
|
|
{
|
|
return Ex_ReconResultsPluginSupport_create_data();
|
|
}
|
|
|
|
Ex_ReconResults *
|
|
Ex_ReconResultsPluginSupport_create_key(void)
|
|
{
|
|
return (Ex_ReconResults *) Ex_ReconResultsPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPluginSupport_destroy_key(
|
|
Ex_ReconResultsKeyHolder *key)
|
|
{
|
|
Ex_ReconResultsPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::Ex_ReconResultsPluginSupport_destroy_key((Ex_ReconResultsKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
Ex_ReconResultsPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Ex_ReconResults >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
Ex_ReconResultsPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
Ex_ReconResultsPluginSupport_create_dataI,
|
|
Ex_ReconResultsPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::Ex_ReconResultsPluginSupport_create_keyI , ::TrainingAreaBase::Ex_ReconResultsPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::Ex_ReconResultsPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = Ex_ReconResultsPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::Ex_ReconResultsPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReconResults *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"Ex_ReconResultsPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Ex_ReconResults *dst,
|
|
const Ex_ReconResults *src)
|
|
{
|
|
return ::TrainingAreaBase::Ex_ReconResultsPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
Ex_ReconResultsPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Ex_ReconResults *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Ex_ReconResults >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Ex_ReconResults,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
Ex_ReconResultsPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPlugin_deserialize_from_cdr_buffer(
|
|
Ex_ReconResults *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Ex_ReconResults >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Ex_ReconResults,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
Ex_ReconResultsPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
Ex_ReconResultsPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool Ex_ReconResultsPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReconResults **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
Ex_ReconResultsPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
Ex_ReconResultsPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReconResultsKeyHolder *dst,
|
|
const Ex_ReconResults *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReconResults *dst, const
|
|
Ex_ReconResultsKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReconResultsPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
Ex_ReconResults * sample = NULL;
|
|
sample = (Ex_ReconResults *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *Ex_ReconResultsPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
Ex_ReconResultsPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
Ex_ReconResultsPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
Ex_ReconResultsPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
Ex_ReconResultsPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
Ex_ReconResultsPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
Ex_ReconResultsPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Ex_ReconResults >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::Ex_ReconResultsPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
Ex_ReconResultsPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
Ex_ReconResultsPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Ex_ReconResults";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
Ex_ReconResultsPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Ex_ReportSupplyZone
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
Ex_ReportSupplyZonePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Ex_ReportSupplyZone *sample = new Ex_ReportSupplyZone();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Ex_ReportSupplyZone *
|
|
Ex_ReportSupplyZonePluginSupport_create_data(void)
|
|
{
|
|
return (Ex_ReportSupplyZone *) Ex_ReportSupplyZonePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePluginSupport_destroy_data(
|
|
Ex_ReportSupplyZone *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePluginSupport_destroy_data((Ex_ReportSupplyZone *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePluginSupport_copy_data(
|
|
Ex_ReportSupplyZone *dst,
|
|
const Ex_ReportSupplyZone *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
Ex_ReportSupplyZonePluginSupport_create_keyI(void)
|
|
{
|
|
return Ex_ReportSupplyZonePluginSupport_create_data();
|
|
}
|
|
|
|
Ex_ReportSupplyZone *
|
|
Ex_ReportSupplyZonePluginSupport_create_key(void)
|
|
{
|
|
return (Ex_ReportSupplyZone *) Ex_ReportSupplyZonePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePluginSupport_destroy_key(
|
|
Ex_ReportSupplyZoneKeyHolder *key)
|
|
{
|
|
Ex_ReportSupplyZonePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePluginSupport_destroy_key((Ex_ReportSupplyZoneKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
Ex_ReportSupplyZonePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Ex_ReportSupplyZone >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
Ex_ReportSupplyZonePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
Ex_ReportSupplyZonePluginSupport_create_dataI,
|
|
Ex_ReportSupplyZonePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePluginSupport_create_keyI , ::TrainingAreaBase::Ex_ReportSupplyZonePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::Ex_ReportSupplyZonePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = Ex_ReportSupplyZonePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::Ex_ReportSupplyZonePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReportSupplyZone *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"Ex_ReportSupplyZonePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Ex_ReportSupplyZone *dst,
|
|
const Ex_ReportSupplyZone *src)
|
|
{
|
|
return ::TrainingAreaBase::Ex_ReportSupplyZonePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
Ex_ReportSupplyZonePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Ex_ReportSupplyZone *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Ex_ReportSupplyZone >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Ex_ReportSupplyZone,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
Ex_ReportSupplyZonePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePlugin_deserialize_from_cdr_buffer(
|
|
Ex_ReportSupplyZone *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Ex_ReportSupplyZone >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Ex_ReportSupplyZone,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
Ex_ReportSupplyZonePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
Ex_ReportSupplyZonePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool Ex_ReportSupplyZonePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReportSupplyZone **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
Ex_ReportSupplyZonePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
Ex_ReportSupplyZonePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReportSupplyZoneKeyHolder *dst,
|
|
const Ex_ReportSupplyZone *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Ex_ReportSupplyZone *dst, const
|
|
Ex_ReportSupplyZoneKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
Ex_ReportSupplyZonePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
Ex_ReportSupplyZone * sample = NULL;
|
|
sample = (Ex_ReportSupplyZone *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *Ex_ReportSupplyZonePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
Ex_ReportSupplyZonePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
Ex_ReportSupplyZonePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
Ex_ReportSupplyZonePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
Ex_ReportSupplyZonePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
Ex_ReportSupplyZonePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
Ex_ReportSupplyZonePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Ex_ReportSupplyZone >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::Ex_ReportSupplyZonePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
Ex_ReportSupplyZonePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
Ex_ReportSupplyZonePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Ex_ReportSupplyZone";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
Ex_ReportSupplyZonePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type FireSmokeMarkerData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
FireSmokeMarkerDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
FireSmokeMarkerData *sample = new FireSmokeMarkerData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
FireSmokeMarkerData *
|
|
FireSmokeMarkerDataPluginSupport_create_data(void)
|
|
{
|
|
return (FireSmokeMarkerData *) FireSmokeMarkerDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPluginSupport_destroy_data(
|
|
FireSmokeMarkerData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::FireSmokeMarkerDataPluginSupport_destroy_data((FireSmokeMarkerData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPluginSupport_copy_data(
|
|
FireSmokeMarkerData *dst,
|
|
const FireSmokeMarkerData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
FireSmokeMarkerDataPluginSupport_create_keyI(void)
|
|
{
|
|
return FireSmokeMarkerDataPluginSupport_create_data();
|
|
}
|
|
|
|
FireSmokeMarkerData *
|
|
FireSmokeMarkerDataPluginSupport_create_key(void)
|
|
{
|
|
return (FireSmokeMarkerData *) FireSmokeMarkerDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPluginSupport_destroy_key(
|
|
FireSmokeMarkerDataKeyHolder *key)
|
|
{
|
|
FireSmokeMarkerDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::FireSmokeMarkerDataPluginSupport_destroy_key((FireSmokeMarkerDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
FireSmokeMarkerDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FireSmokeMarkerData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
FireSmokeMarkerDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
FireSmokeMarkerDataPluginSupport_create_dataI,
|
|
FireSmokeMarkerDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::FireSmokeMarkerDataPluginSupport_create_keyI , ::TrainingAreaBase::FireSmokeMarkerDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::FireSmokeMarkerDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = FireSmokeMarkerDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::FireSmokeMarkerDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FireSmokeMarkerData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"FireSmokeMarkerDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
FireSmokeMarkerData *dst,
|
|
const FireSmokeMarkerData *src)
|
|
{
|
|
return ::TrainingAreaBase::FireSmokeMarkerDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
FireSmokeMarkerDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const FireSmokeMarkerData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FireSmokeMarkerData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FireSmokeMarkerData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
FireSmokeMarkerDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPlugin_deserialize_from_cdr_buffer(
|
|
FireSmokeMarkerData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FireSmokeMarkerData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FireSmokeMarkerData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
FireSmokeMarkerDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
FireSmokeMarkerDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool FireSmokeMarkerDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FireSmokeMarkerData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
FireSmokeMarkerDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
FireSmokeMarkerDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FireSmokeMarkerDataKeyHolder *dst,
|
|
const FireSmokeMarkerData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FireSmokeMarkerData *dst, const
|
|
FireSmokeMarkerDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FireSmokeMarkerDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
FireSmokeMarkerData * sample = NULL;
|
|
sample = (FireSmokeMarkerData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *FireSmokeMarkerDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
FireSmokeMarkerDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
FireSmokeMarkerDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
FireSmokeMarkerDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
FireSmokeMarkerDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
FireSmokeMarkerDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
FireSmokeMarkerDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::FireSmokeMarkerData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::FireSmokeMarkerDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
FireSmokeMarkerDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
FireSmokeMarkerDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::FireSmokeMarkerData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
FireSmokeMarkerDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type FunctionalAreaEntry
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
FunctionalAreaEntryPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
FunctionalAreaEntry *sample = new FunctionalAreaEntry();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
FunctionalAreaEntry *
|
|
FunctionalAreaEntryPluginSupport_create_data(void)
|
|
{
|
|
return (FunctionalAreaEntry *) FunctionalAreaEntryPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPluginSupport_destroy_data(
|
|
FunctionalAreaEntry *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::FunctionalAreaEntryPluginSupport_destroy_data((FunctionalAreaEntry *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPluginSupport_copy_data(
|
|
FunctionalAreaEntry *dst,
|
|
const FunctionalAreaEntry *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
FunctionalAreaEntryPluginSupport_create_keyI(void)
|
|
{
|
|
return FunctionalAreaEntryPluginSupport_create_data();
|
|
}
|
|
|
|
FunctionalAreaEntry *
|
|
FunctionalAreaEntryPluginSupport_create_key(void)
|
|
{
|
|
return (FunctionalAreaEntry *) FunctionalAreaEntryPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPluginSupport_destroy_key(
|
|
FunctionalAreaEntryKeyHolder *key)
|
|
{
|
|
FunctionalAreaEntryPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::FunctionalAreaEntryPluginSupport_destroy_key((FunctionalAreaEntryKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
FunctionalAreaEntryPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FunctionalAreaEntry >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
FunctionalAreaEntryPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
FunctionalAreaEntryPluginSupport_create_dataI,
|
|
FunctionalAreaEntryPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::FunctionalAreaEntryPluginSupport_create_keyI , ::TrainingAreaBase::FunctionalAreaEntryPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::FunctionalAreaEntryPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = FunctionalAreaEntryPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::FunctionalAreaEntryPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FunctionalAreaEntry *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"FunctionalAreaEntryPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
FunctionalAreaEntry *dst,
|
|
const FunctionalAreaEntry *src)
|
|
{
|
|
return ::TrainingAreaBase::FunctionalAreaEntryPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
FunctionalAreaEntryPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const FunctionalAreaEntry *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FunctionalAreaEntry >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FunctionalAreaEntry,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
FunctionalAreaEntryPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPlugin_deserialize_from_cdr_buffer(
|
|
FunctionalAreaEntry *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< FunctionalAreaEntry >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FunctionalAreaEntry,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
FunctionalAreaEntryPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
FunctionalAreaEntryPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool FunctionalAreaEntryPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FunctionalAreaEntry **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
FunctionalAreaEntryPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
FunctionalAreaEntryPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FunctionalAreaEntryKeyHolder *dst,
|
|
const FunctionalAreaEntry *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FunctionalAreaEntry *dst, const
|
|
FunctionalAreaEntryKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FunctionalAreaEntryPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
FunctionalAreaEntry * sample = NULL;
|
|
sample = (FunctionalAreaEntry *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *FunctionalAreaEntryPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
FunctionalAreaEntryPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
FunctionalAreaEntryPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
FunctionalAreaEntryPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
FunctionalAreaEntryPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
FunctionalAreaEntryPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
FunctionalAreaEntryPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::FunctionalAreaEntry >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::FunctionalAreaEntryPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
FunctionalAreaEntryPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
FunctionalAreaEntryPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::FunctionalAreaEntry";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
FunctionalAreaEntryPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type GeopairingData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
GeopairingDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
GeopairingData *sample = new GeopairingData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
GeopairingData *
|
|
GeopairingDataPluginSupport_create_data(void)
|
|
{
|
|
return (GeopairingData *) GeopairingDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
GeopairingDataPluginSupport_destroy_data(
|
|
GeopairingData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
GeopairingDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::GeopairingDataPluginSupport_destroy_data((GeopairingData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
GeopairingDataPluginSupport_copy_data(
|
|
GeopairingData *dst,
|
|
const GeopairingData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
GeopairingDataPluginSupport_create_keyI(void)
|
|
{
|
|
return GeopairingDataPluginSupport_create_data();
|
|
}
|
|
|
|
GeopairingData *
|
|
GeopairingDataPluginSupport_create_key(void)
|
|
{
|
|
return (GeopairingData *) GeopairingDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
GeopairingDataPluginSupport_destroy_key(
|
|
GeopairingDataKeyHolder *key)
|
|
{
|
|
GeopairingDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
GeopairingDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::GeopairingDataPluginSupport_destroy_key((GeopairingDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
GeopairingDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< GeopairingData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GeopairingDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
GeopairingDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
GeopairingDataPluginSupport_create_dataI,
|
|
GeopairingDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::GeopairingDataPluginSupport_create_keyI , ::TrainingAreaBase::GeopairingDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::GeopairingDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = GeopairingDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::GeopairingDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GeopairingDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
GeopairingDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GeopairingData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"GeopairingDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
GeopairingDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
GeopairingData *dst,
|
|
const GeopairingData *src)
|
|
{
|
|
return ::TrainingAreaBase::GeopairingDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
GeopairingDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
GeopairingDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const GeopairingData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< GeopairingData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GeopairingData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
GeopairingDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GeopairingDataPlugin_deserialize_from_cdr_buffer(
|
|
GeopairingData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< GeopairingData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GeopairingData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
GeopairingDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
GeopairingDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool GeopairingDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GeopairingData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
GeopairingDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
GeopairingDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
GeopairingDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GeopairingDataKeyHolder *dst,
|
|
const GeopairingData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GeopairingDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GeopairingData *dst, const
|
|
GeopairingDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GeopairingDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
GeopairingData * sample = NULL;
|
|
sample = (GeopairingData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *GeopairingDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::GeopairingDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::GeopairingDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::GeopairingDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::GeopairingDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
GeopairingDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
GeopairingDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
GeopairingDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
GeopairingDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
GeopairingDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
GeopairingDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::GeopairingDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::GeopairingData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::GeopairingDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
GeopairingDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
GeopairingDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::GeopairingData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
GeopairingDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type LaserDesignation
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
LaserDesignationPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
LaserDesignation *sample = new LaserDesignation();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
LaserDesignation *
|
|
LaserDesignationPluginSupport_create_data(void)
|
|
{
|
|
return (LaserDesignation *) LaserDesignationPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
LaserDesignationPluginSupport_destroy_data(
|
|
LaserDesignation *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
LaserDesignationPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::LaserDesignationPluginSupport_destroy_data((LaserDesignation *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
LaserDesignationPluginSupport_copy_data(
|
|
LaserDesignation *dst,
|
|
const LaserDesignation *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
LaserDesignationPluginSupport_create_keyI(void)
|
|
{
|
|
return LaserDesignationPluginSupport_create_data();
|
|
}
|
|
|
|
LaserDesignation *
|
|
LaserDesignationPluginSupport_create_key(void)
|
|
{
|
|
return (LaserDesignation *) LaserDesignationPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
LaserDesignationPluginSupport_destroy_key(
|
|
LaserDesignationKeyHolder *key)
|
|
{
|
|
LaserDesignationPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
LaserDesignationPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::LaserDesignationPluginSupport_destroy_key((LaserDesignationKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
LaserDesignationPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< LaserDesignation >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
LaserDesignationPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
LaserDesignationPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
LaserDesignationPluginSupport_create_dataI,
|
|
LaserDesignationPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::LaserDesignationPluginSupport_create_keyI , ::TrainingAreaBase::LaserDesignationPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::LaserDesignationPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = LaserDesignationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::LaserDesignationPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
LaserDesignationPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
LaserDesignationPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LaserDesignation *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"LaserDesignationPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
LaserDesignationPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
LaserDesignation *dst,
|
|
const LaserDesignation *src)
|
|
{
|
|
return ::TrainingAreaBase::LaserDesignationPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
LaserDesignationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
LaserDesignationPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const LaserDesignation *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< LaserDesignation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LaserDesignation,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
LaserDesignationPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LaserDesignationPlugin_deserialize_from_cdr_buffer(
|
|
LaserDesignation *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< LaserDesignation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LaserDesignation,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
LaserDesignationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
LaserDesignationPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool LaserDesignationPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LaserDesignation **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
LaserDesignationPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
LaserDesignationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
LaserDesignationPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LaserDesignationKeyHolder *dst,
|
|
const LaserDesignation *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LaserDesignationPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LaserDesignation *dst, const
|
|
LaserDesignationKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LaserDesignationPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
LaserDesignation * sample = NULL;
|
|
sample = (LaserDesignation *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *LaserDesignationPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::LaserDesignationPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::LaserDesignationPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::LaserDesignationPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::LaserDesignationPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
LaserDesignationPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
LaserDesignationPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
LaserDesignationPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
LaserDesignationPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
LaserDesignationPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
LaserDesignationPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::LaserDesignationPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::LaserDesignation >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::LaserDesignationPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
LaserDesignationPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
LaserDesignationPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::LaserDesignation";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
LaserDesignationPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type MineTriggered
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
MineTriggeredPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
MineTriggered *sample = new MineTriggered();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
MineTriggered *
|
|
MineTriggeredPluginSupport_create_data(void)
|
|
{
|
|
return (MineTriggered *) MineTriggeredPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
MineTriggeredPluginSupport_destroy_data(
|
|
MineTriggered *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
MineTriggeredPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::MineTriggeredPluginSupport_destroy_data((MineTriggered *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
MineTriggeredPluginSupport_copy_data(
|
|
MineTriggered *dst,
|
|
const MineTriggered *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
MineTriggeredPluginSupport_create_keyI(void)
|
|
{
|
|
return MineTriggeredPluginSupport_create_data();
|
|
}
|
|
|
|
MineTriggered *
|
|
MineTriggeredPluginSupport_create_key(void)
|
|
{
|
|
return (MineTriggered *) MineTriggeredPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
MineTriggeredPluginSupport_destroy_key(
|
|
MineTriggeredKeyHolder *key)
|
|
{
|
|
MineTriggeredPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
MineTriggeredPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::MineTriggeredPluginSupport_destroy_key((MineTriggeredKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
MineTriggeredPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MineTriggered >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MineTriggeredPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
MineTriggeredPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
MineTriggeredPluginSupport_create_dataI,
|
|
MineTriggeredPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::MineTriggeredPluginSupport_create_keyI , ::TrainingAreaBase::MineTriggeredPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::MineTriggeredPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = MineTriggeredPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::MineTriggeredPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MineTriggeredPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
MineTriggeredPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MineTriggered *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"MineTriggeredPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
MineTriggeredPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
MineTriggered *dst,
|
|
const MineTriggered *src)
|
|
{
|
|
return ::TrainingAreaBase::MineTriggeredPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
MineTriggeredPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
MineTriggeredPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const MineTriggered *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MineTriggered >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MineTriggered,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
MineTriggeredPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MineTriggeredPlugin_deserialize_from_cdr_buffer(
|
|
MineTriggered *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MineTriggered >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MineTriggered,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
MineTriggeredPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
MineTriggeredPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool MineTriggeredPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MineTriggered **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MineTriggeredPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MineTriggeredPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
MineTriggeredPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MineTriggeredKeyHolder *dst,
|
|
const MineTriggered *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MineTriggeredPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MineTriggered *dst, const
|
|
MineTriggeredKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MineTriggeredPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
MineTriggered * sample = NULL;
|
|
sample = (MineTriggered *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *MineTriggeredPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::MineTriggeredPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::MineTriggeredPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::MineTriggeredPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::MineTriggeredPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
MineTriggeredPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
MineTriggeredPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
MineTriggeredPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
MineTriggeredPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
MineTriggeredPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
MineTriggeredPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::MineTriggeredPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::MineTriggered >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::MineTriggeredPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
MineTriggeredPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
MineTriggeredPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::MineTriggered";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
MineTriggeredPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type MinelayerTrailerData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
MinelayerTrailerDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
MinelayerTrailerData *sample = new MinelayerTrailerData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
MinelayerTrailerData *
|
|
MinelayerTrailerDataPluginSupport_create_data(void)
|
|
{
|
|
return (MinelayerTrailerData *) MinelayerTrailerDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPluginSupport_destroy_data(
|
|
MinelayerTrailerData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::MinelayerTrailerDataPluginSupport_destroy_data((MinelayerTrailerData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPluginSupport_copy_data(
|
|
MinelayerTrailerData *dst,
|
|
const MinelayerTrailerData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
MinelayerTrailerDataPluginSupport_create_keyI(void)
|
|
{
|
|
return MinelayerTrailerDataPluginSupport_create_data();
|
|
}
|
|
|
|
MinelayerTrailerData *
|
|
MinelayerTrailerDataPluginSupport_create_key(void)
|
|
{
|
|
return (MinelayerTrailerData *) MinelayerTrailerDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPluginSupport_destroy_key(
|
|
MinelayerTrailerDataKeyHolder *key)
|
|
{
|
|
MinelayerTrailerDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::MinelayerTrailerDataPluginSupport_destroy_key((MinelayerTrailerDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
MinelayerTrailerDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerTrailerData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
MinelayerTrailerDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
MinelayerTrailerDataPluginSupport_create_dataI,
|
|
MinelayerTrailerDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::MinelayerTrailerDataPluginSupport_create_keyI , ::TrainingAreaBase::MinelayerTrailerDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::MinelayerTrailerDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = MinelayerTrailerDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::MinelayerTrailerDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"MinelayerTrailerDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
MinelayerTrailerData *dst,
|
|
const MinelayerTrailerData *src)
|
|
{
|
|
return ::TrainingAreaBase::MinelayerTrailerDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
MinelayerTrailerDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const MinelayerTrailerData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerTrailerData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MinelayerTrailerData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
MinelayerTrailerDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPlugin_deserialize_from_cdr_buffer(
|
|
MinelayerTrailerData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerTrailerData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MinelayerTrailerData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerTrailerDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
MinelayerTrailerDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool MinelayerTrailerDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerTrailerDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerTrailerDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerDataKeyHolder *dst,
|
|
const MinelayerTrailerData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerData *dst, const
|
|
MinelayerTrailerDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
MinelayerTrailerData * sample = NULL;
|
|
sample = (MinelayerTrailerData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *MinelayerTrailerDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
MinelayerTrailerDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
MinelayerTrailerDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
MinelayerTrailerDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
MinelayerTrailerDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
MinelayerTrailerDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
MinelayerTrailerDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::MinelayerTrailerData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::MinelayerTrailerDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
MinelayerTrailerDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
MinelayerTrailerDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::MinelayerTrailerData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type MinelayerThrowerData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
MinelayerThrowerDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
MinelayerThrowerData *sample = new MinelayerThrowerData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
MinelayerThrowerData *
|
|
MinelayerThrowerDataPluginSupport_create_data(void)
|
|
{
|
|
return (MinelayerThrowerData *) MinelayerThrowerDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPluginSupport_destroy_data(
|
|
MinelayerThrowerData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::MinelayerThrowerDataPluginSupport_destroy_data((MinelayerThrowerData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPluginSupport_copy_data(
|
|
MinelayerThrowerData *dst,
|
|
const MinelayerThrowerData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
MinelayerThrowerDataPluginSupport_create_keyI(void)
|
|
{
|
|
return MinelayerThrowerDataPluginSupport_create_data();
|
|
}
|
|
|
|
MinelayerThrowerData *
|
|
MinelayerThrowerDataPluginSupport_create_key(void)
|
|
{
|
|
return (MinelayerThrowerData *) MinelayerThrowerDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPluginSupport_destroy_key(
|
|
MinelayerThrowerDataKeyHolder *key)
|
|
{
|
|
MinelayerThrowerDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::MinelayerThrowerDataPluginSupport_destroy_key((MinelayerThrowerDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
MinelayerThrowerDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerThrowerData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
MinelayerThrowerDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
MinelayerThrowerDataPluginSupport_create_dataI,
|
|
MinelayerThrowerDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::MinelayerThrowerDataPluginSupport_create_keyI , ::TrainingAreaBase::MinelayerThrowerDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::MinelayerThrowerDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = MinelayerThrowerDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::MinelayerThrowerDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerThrowerData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"MinelayerThrowerDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
MinelayerThrowerData *dst,
|
|
const MinelayerThrowerData *src)
|
|
{
|
|
return ::TrainingAreaBase::MinelayerThrowerDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
MinelayerThrowerDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const MinelayerThrowerData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerThrowerData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MinelayerThrowerData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
MinelayerThrowerDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPlugin_deserialize_from_cdr_buffer(
|
|
MinelayerThrowerData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerThrowerData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MinelayerThrowerData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerThrowerDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
MinelayerThrowerDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool MinelayerThrowerDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerThrowerData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerThrowerDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerThrowerDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerThrowerDataKeyHolder *dst,
|
|
const MinelayerThrowerData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::MinelayerTrailerDataPlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::MinelayerTrailerData *)dst,(const ::TrainingAreaBase::MinelayerTrailerData*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerThrowerData *dst, const
|
|
MinelayerThrowerDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::MinelayerTrailerDataPlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::MinelayerTrailerData*)dst,(const ::TrainingAreaBase::MinelayerTrailerData*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerThrowerDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
MinelayerThrowerData * sample = NULL;
|
|
sample = (MinelayerThrowerData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *MinelayerThrowerDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
MinelayerThrowerDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
MinelayerThrowerDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
MinelayerThrowerDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
MinelayerThrowerDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
MinelayerThrowerDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
MinelayerThrowerDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::MinelayerThrowerData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::MinelayerThrowerDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
MinelayerThrowerDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
MinelayerThrowerDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::MinelayerThrowerData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
MinelayerThrowerDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type MinelayerTrailerPosition
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
MinelayerTrailerPositionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
MinelayerTrailerPosition *sample = new MinelayerTrailerPosition();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
MinelayerTrailerPosition *
|
|
MinelayerTrailerPositionPluginSupport_create_data(void)
|
|
{
|
|
return (MinelayerTrailerPosition *) MinelayerTrailerPositionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPluginSupport_destroy_data(
|
|
MinelayerTrailerPosition *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::MinelayerTrailerPositionPluginSupport_destroy_data((MinelayerTrailerPosition *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPluginSupport_copy_data(
|
|
MinelayerTrailerPosition *dst,
|
|
const MinelayerTrailerPosition *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
MinelayerTrailerPositionPluginSupport_create_keyI(void)
|
|
{
|
|
return MinelayerTrailerPositionPluginSupport_create_data();
|
|
}
|
|
|
|
MinelayerTrailerPosition *
|
|
MinelayerTrailerPositionPluginSupport_create_key(void)
|
|
{
|
|
return (MinelayerTrailerPosition *) MinelayerTrailerPositionPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPluginSupport_destroy_key(
|
|
MinelayerTrailerPositionKeyHolder *key)
|
|
{
|
|
MinelayerTrailerPositionPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::MinelayerTrailerPositionPluginSupport_destroy_key((MinelayerTrailerPositionKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
MinelayerTrailerPositionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerTrailerPosition >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
MinelayerTrailerPositionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
MinelayerTrailerPositionPluginSupport_create_dataI,
|
|
MinelayerTrailerPositionPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::MinelayerTrailerPositionPluginSupport_create_keyI , ::TrainingAreaBase::MinelayerTrailerPositionPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::MinelayerTrailerPositionPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = MinelayerTrailerPositionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::MinelayerTrailerPositionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerPosition *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"MinelayerTrailerPositionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
MinelayerTrailerPosition *dst,
|
|
const MinelayerTrailerPosition *src)
|
|
{
|
|
return ::TrainingAreaBase::MinelayerTrailerPositionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
MinelayerTrailerPositionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const MinelayerTrailerPosition *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerTrailerPosition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MinelayerTrailerPosition,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
MinelayerTrailerPositionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPlugin_deserialize_from_cdr_buffer(
|
|
MinelayerTrailerPosition *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< MinelayerTrailerPosition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
MinelayerTrailerPosition,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerTrailerPositionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
MinelayerTrailerPositionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool MinelayerTrailerPositionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerPosition **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerTrailerPositionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
MinelayerTrailerPositionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerPositionKeyHolder *dst,
|
|
const MinelayerTrailerPosition *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
MinelayerTrailerPosition *dst, const
|
|
MinelayerTrailerPositionKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
MinelayerTrailerPositionPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
MinelayerTrailerPosition * sample = NULL;
|
|
sample = (MinelayerTrailerPosition *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *MinelayerTrailerPositionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
MinelayerTrailerPositionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
MinelayerTrailerPositionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
MinelayerTrailerPositionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
MinelayerTrailerPositionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
MinelayerTrailerPositionPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
MinelayerTrailerPositionPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::MinelayerTrailerPosition >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::MinelayerTrailerPositionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
MinelayerTrailerPositionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
MinelayerTrailerPositionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::MinelayerTrailerPosition";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
MinelayerTrailerPositionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type OcData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
OcDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
OcData *sample = new OcData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
OcData *
|
|
OcDataPluginSupport_create_data(void)
|
|
{
|
|
return (OcData *) OcDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
OcDataPluginSupport_destroy_data(
|
|
OcData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
OcDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::OcDataPluginSupport_destroy_data((OcData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
OcDataPluginSupport_copy_data(
|
|
OcData *dst,
|
|
const OcData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
OcDataPluginSupport_create_keyI(void)
|
|
{
|
|
return OcDataPluginSupport_create_data();
|
|
}
|
|
|
|
OcData *
|
|
OcDataPluginSupport_create_key(void)
|
|
{
|
|
return (OcData *) OcDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
OcDataPluginSupport_destroy_key(
|
|
OcDataKeyHolder *key)
|
|
{
|
|
OcDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
OcDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::OcDataPluginSupport_destroy_key((OcDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
OcDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< OcData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
OcDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
OcDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
OcDataPluginSupport_create_dataI,
|
|
OcDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::OcDataPluginSupport_create_keyI , ::TrainingAreaBase::OcDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::OcDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = OcDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::OcDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::OcDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
OcDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
OcDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OcData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"OcDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
OcDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
OcData *dst,
|
|
const OcData *src)
|
|
{
|
|
return ::TrainingAreaBase::OcDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
OcDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
OcDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const OcData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< OcData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
OcData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
OcDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
OcDataPlugin_deserialize_from_cdr_buffer(
|
|
OcData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< OcData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
OcData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
OcDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
OcDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool OcDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OcData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
OcDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
OcDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
OcDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OcDataKeyHolder *dst,
|
|
const OcData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
OcDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OcData *dst, const
|
|
OcDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
OcDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
OcData * sample = NULL;
|
|
sample = (OcData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *OcDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::OcDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::OcDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::OcDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::OcDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::OcDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
OcDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
OcDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::OcDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
OcDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
OcDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::OcDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::OcDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::OcDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::OcDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
OcDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
OcDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::OcDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::OcDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::OcData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::OcDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
OcDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
OcDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::OcData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
OcDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type OperatorAction
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
OperatorActionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
OperatorAction *sample = new OperatorAction();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
OperatorAction *
|
|
OperatorActionPluginSupport_create_data(void)
|
|
{
|
|
return (OperatorAction *) OperatorActionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
OperatorActionPluginSupport_destroy_data(
|
|
OperatorAction *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
OperatorActionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::OperatorActionPluginSupport_destroy_data((OperatorAction *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
OperatorActionPluginSupport_copy_data(
|
|
OperatorAction *dst,
|
|
const OperatorAction *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
OperatorActionPluginSupport_create_keyI(void)
|
|
{
|
|
return OperatorActionPluginSupport_create_data();
|
|
}
|
|
|
|
OperatorAction *
|
|
OperatorActionPluginSupport_create_key(void)
|
|
{
|
|
return (OperatorAction *) OperatorActionPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
OperatorActionPluginSupport_destroy_key(
|
|
OperatorActionKeyHolder *key)
|
|
{
|
|
OperatorActionPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
OperatorActionPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::OperatorActionPluginSupport_destroy_key((OperatorActionKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
OperatorActionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< OperatorAction >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
OperatorActionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
OperatorActionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
OperatorActionPluginSupport_create_dataI,
|
|
OperatorActionPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::OperatorActionPluginSupport_create_keyI , ::TrainingAreaBase::OperatorActionPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::OperatorActionPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = OperatorActionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::OperatorActionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
OperatorActionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
OperatorActionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OperatorAction *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"OperatorActionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
OperatorActionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
OperatorAction *dst,
|
|
const OperatorAction *src)
|
|
{
|
|
return ::TrainingAreaBase::OperatorActionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
OperatorActionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
OperatorActionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const OperatorAction *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< OperatorAction >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
OperatorAction,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
OperatorActionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
OperatorActionPlugin_deserialize_from_cdr_buffer(
|
|
OperatorAction *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< OperatorAction >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
OperatorAction,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
OperatorActionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
OperatorActionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool OperatorActionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OperatorAction **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
OperatorActionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
OperatorActionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
OperatorActionPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OperatorActionKeyHolder *dst,
|
|
const OperatorAction *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
OperatorActionPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
OperatorAction *dst, const
|
|
OperatorActionKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
OperatorActionPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
OperatorAction * sample = NULL;
|
|
sample = (OperatorAction *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *OperatorActionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::OperatorActionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::OperatorActionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::OperatorActionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::OperatorActionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
OperatorActionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
OperatorActionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
OperatorActionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
OperatorActionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
OperatorActionPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
OperatorActionPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::OperatorActionPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::OperatorAction >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::OperatorActionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
OperatorActionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
OperatorActionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::OperatorAction";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
OperatorActionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ParticipantConfigurationReport
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ParticipantConfigurationReportPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ParticipantConfigurationReport *sample = new ParticipantConfigurationReport();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ParticipantConfigurationReport *
|
|
ParticipantConfigurationReportPluginSupport_create_data(void)
|
|
{
|
|
return (ParticipantConfigurationReport *) ParticipantConfigurationReportPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPluginSupport_destroy_data(
|
|
ParticipantConfigurationReport *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ParticipantConfigurationReportPluginSupport_destroy_data((ParticipantConfigurationReport *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPluginSupport_copy_data(
|
|
ParticipantConfigurationReport *dst,
|
|
const ParticipantConfigurationReport *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ParticipantConfigurationReportPluginSupport_create_keyI(void)
|
|
{
|
|
return ParticipantConfigurationReportPluginSupport_create_data();
|
|
}
|
|
|
|
ParticipantConfigurationReport *
|
|
ParticipantConfigurationReportPluginSupport_create_key(void)
|
|
{
|
|
return (ParticipantConfigurationReport *) ParticipantConfigurationReportPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPluginSupport_destroy_key(
|
|
ParticipantConfigurationReportKeyHolder *key)
|
|
{
|
|
ParticipantConfigurationReportPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ParticipantConfigurationReportPluginSupport_destroy_key((ParticipantConfigurationReportKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ParticipantConfigurationReportPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantConfigurationReport >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ParticipantConfigurationReportPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ParticipantConfigurationReportPluginSupport_create_dataI,
|
|
ParticipantConfigurationReportPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ParticipantConfigurationReportPluginSupport_create_keyI , ::TrainingAreaBase::ParticipantConfigurationReportPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ParticipantConfigurationReportPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ParticipantConfigurationReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ParticipantConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantConfigurationReport *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ParticipantConfigurationReportPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ParticipantConfigurationReport *dst,
|
|
const ParticipantConfigurationReport *src)
|
|
{
|
|
return ::TrainingAreaBase::ParticipantConfigurationReportPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ParticipantConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ParticipantConfigurationReport *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantConfigurationReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantConfigurationReport,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ParticipantConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPlugin_deserialize_from_cdr_buffer(
|
|
ParticipantConfigurationReport *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantConfigurationReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantConfigurationReport,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantConfigurationReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ParticipantConfigurationReportPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ParticipantConfigurationReportPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantConfigurationReport **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantConfigurationReportPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantConfigurationReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantConfigurationReportKeyHolder *dst,
|
|
const ParticipantConfigurationReport *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantConfigurationReport *dst, const
|
|
ParticipantConfigurationReportKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantConfigurationReportPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ParticipantConfigurationReport * sample = NULL;
|
|
sample = (ParticipantConfigurationReport *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ParticipantConfigurationReportPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ParticipantConfigurationReportPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ParticipantConfigurationReportPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ParticipantConfigurationReportPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ParticipantConfigurationReportPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ParticipantConfigurationReportPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ParticipantConfigurationReportPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ParticipantConfigurationReport >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ParticipantConfigurationReportPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ParticipantConfigurationReportPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ParticipantConfigurationReportPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ParticipantConfigurationReport";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ParticipantConfigurationReportPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ParticipantModeReport
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ParticipantModeReportPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ParticipantModeReport *sample = new ParticipantModeReport();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ParticipantModeReport *
|
|
ParticipantModeReportPluginSupport_create_data(void)
|
|
{
|
|
return (ParticipantModeReport *) ParticipantModeReportPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPluginSupport_destroy_data(
|
|
ParticipantModeReport *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ParticipantModeReportPluginSupport_destroy_data((ParticipantModeReport *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantModeReportPluginSupport_copy_data(
|
|
ParticipantModeReport *dst,
|
|
const ParticipantModeReport *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ParticipantModeReportPluginSupport_create_keyI(void)
|
|
{
|
|
return ParticipantModeReportPluginSupport_create_data();
|
|
}
|
|
|
|
ParticipantModeReport *
|
|
ParticipantModeReportPluginSupport_create_key(void)
|
|
{
|
|
return (ParticipantModeReport *) ParticipantModeReportPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPluginSupport_destroy_key(
|
|
ParticipantModeReportKeyHolder *key)
|
|
{
|
|
ParticipantModeReportPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ParticipantModeReportPluginSupport_destroy_key((ParticipantModeReportKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ParticipantModeReportPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantModeReport >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ParticipantModeReportPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ParticipantModeReportPluginSupport_create_dataI,
|
|
ParticipantModeReportPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ParticipantModeReportPluginSupport_create_keyI , ::TrainingAreaBase::ParticipantModeReportPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ParticipantModeReportPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ParticipantModeReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ParticipantModeReportPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantModeReport *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ParticipantModeReportPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantModeReportPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ParticipantModeReport *dst,
|
|
const ParticipantModeReport *src)
|
|
{
|
|
return ::TrainingAreaBase::ParticipantModeReportPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ParticipantModeReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ParticipantModeReportPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ParticipantModeReport *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantModeReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantModeReport,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ParticipantModeReportPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantModeReportPlugin_deserialize_from_cdr_buffer(
|
|
ParticipantModeReport *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantModeReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantModeReport,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantModeReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ParticipantModeReportPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ParticipantModeReportPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantModeReport **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantModeReportPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantModeReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantModeReportPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantModeReportKeyHolder *dst,
|
|
const ParticipantModeReport *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantModeReportPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantModeReport *dst, const
|
|
ParticipantModeReportKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantModeReportPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ParticipantModeReport * sample = NULL;
|
|
sample = (ParticipantModeReport *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ParticipantModeReportPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ParticipantModeReportPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ParticipantModeReportPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ParticipantModeReportPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ParticipantModeReportPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ParticipantModeReportPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ParticipantModeReportPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ParticipantModeReport >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ParticipantModeReportPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ParticipantModeReportPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ParticipantModeReportPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ParticipantModeReport";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ParticipantModeReportPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ParticipantSanitaryMaterialStockReport
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ParticipantSanitaryMaterialStockReport *sample = new ParticipantSanitaryMaterialStockReport();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ParticipantSanitaryMaterialStockReport *
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_create_data(void)
|
|
{
|
|
return (ParticipantSanitaryMaterialStockReport *) ParticipantSanitaryMaterialStockReportPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_destroy_data(
|
|
ParticipantSanitaryMaterialStockReport *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPluginSupport_destroy_data((ParticipantSanitaryMaterialStockReport *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_copy_data(
|
|
ParticipantSanitaryMaterialStockReport *dst,
|
|
const ParticipantSanitaryMaterialStockReport *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_create_keyI(void)
|
|
{
|
|
return ParticipantSanitaryMaterialStockReportPluginSupport_create_data();
|
|
}
|
|
|
|
ParticipantSanitaryMaterialStockReport *
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_create_key(void)
|
|
{
|
|
return (ParticipantSanitaryMaterialStockReport *) ParticipantSanitaryMaterialStockReportPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_destroy_key(
|
|
ParticipantSanitaryMaterialStockReportKeyHolder *key)
|
|
{
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPluginSupport_destroy_key((ParticipantSanitaryMaterialStockReportKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ParticipantSanitaryMaterialStockReportPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitaryMaterialStockReport >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ParticipantSanitaryMaterialStockReportPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_create_dataI,
|
|
ParticipantSanitaryMaterialStockReportPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPluginSupport_create_keyI , ::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ParticipantSanitaryMaterialStockReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitaryMaterialStockReport *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ParticipantSanitaryMaterialStockReportPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ParticipantSanitaryMaterialStockReport *dst,
|
|
const ParticipantSanitaryMaterialStockReport *src)
|
|
{
|
|
return ::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ParticipantSanitaryMaterialStockReport *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitaryMaterialStockReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSanitaryMaterialStockReport,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPlugin_deserialize_from_cdr_buffer(
|
|
ParticipantSanitaryMaterialStockReport *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitaryMaterialStockReport >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSanitaryMaterialStockReport,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ParticipantSanitaryMaterialStockReportPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitaryMaterialStockReport **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitaryMaterialStockReportKeyHolder *dst,
|
|
const ParticipantSanitaryMaterialStockReport *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitaryMaterialStockReport *dst, const
|
|
ParticipantSanitaryMaterialStockReportKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitaryMaterialStockReportPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ParticipantSanitaryMaterialStockReport * sample = NULL;
|
|
sample = (ParticipantSanitaryMaterialStockReport *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ParticipantSanitaryMaterialStockReportPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ParticipantSanitaryMaterialStockReport >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ParticipantSanitaryMaterialStockReportPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ParticipantSanitaryMaterialStockReportPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ParticipantSanitaryMaterialStockReport";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ParticipantSanitaryMaterialStockReportPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ParticipantSanitation
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ParticipantSanitationPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ParticipantSanitation *sample = new ParticipantSanitation();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ParticipantSanitation *
|
|
ParticipantSanitationPluginSupport_create_data(void)
|
|
{
|
|
return (ParticipantSanitation *) ParticipantSanitationPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPluginSupport_destroy_data(
|
|
ParticipantSanitation *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ParticipantSanitationPluginSupport_destroy_data((ParticipantSanitation *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationPluginSupport_copy_data(
|
|
ParticipantSanitation *dst,
|
|
const ParticipantSanitation *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ParticipantSanitationPluginSupport_create_keyI(void)
|
|
{
|
|
return ParticipantSanitationPluginSupport_create_data();
|
|
}
|
|
|
|
ParticipantSanitation *
|
|
ParticipantSanitationPluginSupport_create_key(void)
|
|
{
|
|
return (ParticipantSanitation *) ParticipantSanitationPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPluginSupport_destroy_key(
|
|
ParticipantSanitationKeyHolder *key)
|
|
{
|
|
ParticipantSanitationPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ParticipantSanitationPluginSupport_destroy_key((ParticipantSanitationKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ParticipantSanitationPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitation >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ParticipantSanitationPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ParticipantSanitationPluginSupport_create_dataI,
|
|
ParticipantSanitationPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ParticipantSanitationPluginSupport_create_keyI , ::TrainingAreaBase::ParticipantSanitationPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ParticipantSanitationPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ParticipantSanitationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ParticipantSanitationPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitation *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ParticipantSanitationPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ParticipantSanitation *dst,
|
|
const ParticipantSanitation *src)
|
|
{
|
|
return ::TrainingAreaBase::ParticipantSanitationPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ParticipantSanitationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ParticipantSanitationPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ParticipantSanitation *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSanitation,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ParticipantSanitationPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationPlugin_deserialize_from_cdr_buffer(
|
|
ParticipantSanitation *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSanitation,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ParticipantSanitationPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ParticipantSanitationPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitation **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitationPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitationKeyHolder *dst,
|
|
const ParticipantSanitation *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitation *dst, const
|
|
ParticipantSanitationKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ParticipantSanitation * sample = NULL;
|
|
sample = (ParticipantSanitation *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ParticipantSanitationPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ParticipantSanitationPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ParticipantSanitationPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ParticipantSanitationPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ParticipantSanitationPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ParticipantSanitationPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ParticipantSanitationPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ParticipantSanitation >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ParticipantSanitationPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ParticipantSanitationPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ParticipantSanitationPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ParticipantSanitation";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ParticipantSanitationRepair
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ParticipantSanitationRepairPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ParticipantSanitationRepair *sample = new ParticipantSanitationRepair();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ParticipantSanitationRepair *
|
|
ParticipantSanitationRepairPluginSupport_create_data(void)
|
|
{
|
|
return (ParticipantSanitationRepair *) ParticipantSanitationRepairPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPluginSupport_destroy_data(
|
|
ParticipantSanitationRepair *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ParticipantSanitationRepairPluginSupport_destroy_data((ParticipantSanitationRepair *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPluginSupport_copy_data(
|
|
ParticipantSanitationRepair *dst,
|
|
const ParticipantSanitationRepair *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ParticipantSanitationRepairPluginSupport_create_keyI(void)
|
|
{
|
|
return ParticipantSanitationRepairPluginSupport_create_data();
|
|
}
|
|
|
|
ParticipantSanitationRepair *
|
|
ParticipantSanitationRepairPluginSupport_create_key(void)
|
|
{
|
|
return (ParticipantSanitationRepair *) ParticipantSanitationRepairPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPluginSupport_destroy_key(
|
|
ParticipantSanitationRepairKeyHolder *key)
|
|
{
|
|
ParticipantSanitationRepairPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ParticipantSanitationRepairPluginSupport_destroy_key((ParticipantSanitationRepairKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ParticipantSanitationRepairPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitationRepair >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ParticipantSanitationRepairPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ParticipantSanitationRepairPluginSupport_create_dataI,
|
|
ParticipantSanitationRepairPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ParticipantSanitationRepairPluginSupport_create_keyI , ::TrainingAreaBase::ParticipantSanitationRepairPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ParticipantSanitationRepairPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ParticipantSanitationRepairPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ParticipantSanitationRepairPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitationRepair *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ParticipantSanitationRepairPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ParticipantSanitationRepair *dst,
|
|
const ParticipantSanitationRepair *src)
|
|
{
|
|
return ::TrainingAreaBase::ParticipantSanitationRepairPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ParticipantSanitationRepairPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ParticipantSanitationRepair *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitationRepair >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSanitationRepair,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ParticipantSanitationRepairPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPlugin_deserialize_from_cdr_buffer(
|
|
ParticipantSanitationRepair *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSanitationRepair >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSanitationRepair,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitationRepairPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ParticipantSanitationRepairPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ParticipantSanitationRepairPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitationRepair **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitationRepairPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSanitationRepairPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitationRepairKeyHolder *dst,
|
|
const ParticipantSanitationRepair *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSanitationRepair *dst, const
|
|
ParticipantSanitationRepairKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSanitationRepairPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ParticipantSanitationRepair * sample = NULL;
|
|
sample = (ParticipantSanitationRepair *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ParticipantSanitationRepairPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ParticipantSanitationRepairPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ParticipantSanitationRepairPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ParticipantSanitationRepairPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ParticipantSanitationRepairPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ParticipantSanitationRepairPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ParticipantSanitationRepairPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ParticipantSanitationRepair >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ParticipantSanitationRepairPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ParticipantSanitationRepairPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ParticipantSanitationRepairPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ParticipantSanitationRepair";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ParticipantSanitationRepairPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ParticipantSwVersions
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ParticipantSwVersionsPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ParticipantSwVersions *sample = new ParticipantSwVersions();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ParticipantSwVersions *
|
|
ParticipantSwVersionsPluginSupport_create_data(void)
|
|
{
|
|
return (ParticipantSwVersions *) ParticipantSwVersionsPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPluginSupport_destroy_data(
|
|
ParticipantSwVersions *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ParticipantSwVersionsPluginSupport_destroy_data((ParticipantSwVersions *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPluginSupport_copy_data(
|
|
ParticipantSwVersions *dst,
|
|
const ParticipantSwVersions *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ParticipantSwVersionsPluginSupport_create_keyI(void)
|
|
{
|
|
return ParticipantSwVersionsPluginSupport_create_data();
|
|
}
|
|
|
|
ParticipantSwVersions *
|
|
ParticipantSwVersionsPluginSupport_create_key(void)
|
|
{
|
|
return (ParticipantSwVersions *) ParticipantSwVersionsPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPluginSupport_destroy_key(
|
|
ParticipantSwVersionsKeyHolder *key)
|
|
{
|
|
ParticipantSwVersionsPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ParticipantSwVersionsPluginSupport_destroy_key((ParticipantSwVersionsKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ParticipantSwVersionsPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSwVersions >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ParticipantSwVersionsPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ParticipantSwVersionsPluginSupport_create_dataI,
|
|
ParticipantSwVersionsPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ParticipantSwVersionsPluginSupport_create_keyI , ::TrainingAreaBase::ParticipantSwVersionsPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ParticipantSwVersionsPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ParticipantSwVersionsPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ParticipantSwVersionsPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSwVersions *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ParticipantSwVersionsPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ParticipantSwVersions *dst,
|
|
const ParticipantSwVersions *src)
|
|
{
|
|
return ::TrainingAreaBase::ParticipantSwVersionsPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ParticipantSwVersionsPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ParticipantSwVersions *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSwVersions >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSwVersions,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ParticipantSwVersionsPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPlugin_deserialize_from_cdr_buffer(
|
|
ParticipantSwVersions *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ParticipantSwVersions >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ParticipantSwVersions,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSwVersionsPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ParticipantSwVersionsPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ParticipantSwVersionsPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSwVersions **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSwVersionsPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ParticipantSwVersionsPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSwVersionsKeyHolder *dst,
|
|
const ParticipantSwVersions *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ParticipantSwVersions *dst, const
|
|
ParticipantSwVersionsKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ParticipantSwVersionsPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ParticipantSwVersions * sample = NULL;
|
|
sample = (ParticipantSwVersions *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ParticipantSwVersionsPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ParticipantSwVersionsPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ParticipantSwVersionsPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ParticipantSwVersionsPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ParticipantSwVersionsPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ParticipantSwVersionsPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ParticipantSwVersionsPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ParticipantSwVersions >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ParticipantSwVersionsPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ParticipantSwVersionsPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ParticipantSwVersionsPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ParticipantSwVersions";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ParticipantSwVersionsPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type Reammunition
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ReammunitionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
Reammunition *sample = new Reammunition();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
Reammunition *
|
|
ReammunitionPluginSupport_create_data(void)
|
|
{
|
|
return (Reammunition *) ReammunitionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ReammunitionPluginSupport_destroy_data(
|
|
Reammunition *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ReammunitionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ReammunitionPluginSupport_destroy_data((Reammunition *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ReammunitionPluginSupport_copy_data(
|
|
Reammunition *dst,
|
|
const Reammunition *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ReammunitionPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Reammunition >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ReammunitionPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ReammunitionPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ReammunitionPluginSupport_create_dataI,
|
|
ReammunitionPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ReammunitionPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ReammunitionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ReammunitionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ReammunitionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Reammunition *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ReammunitionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ReammunitionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
Reammunition *dst,
|
|
const Reammunition *src)
|
|
{
|
|
return ::TrainingAreaBase::ReammunitionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ReammunitionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ReammunitionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const Reammunition *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Reammunition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Reammunition,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ReammunitionPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ReammunitionPlugin_deserialize_from_cdr_buffer(
|
|
Reammunition *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< Reammunition >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
Reammunition,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ReammunitionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ReammunitionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool ReammunitionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
Reammunition **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ReammunitionPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ReammunitionPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ReammunitionPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ReammunitionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ReammunitionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ReammunitionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ReammunitionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ReammunitionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ReammunitionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ReammunitionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ReammunitionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ReammunitionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ReammunitionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ReammunitionPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::Reammunition >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ReammunitionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ReammunitionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ReammunitionPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::Reammunition";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ReammunitionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type RestoreRadioReadiness
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
RestoreRadioReadinessPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
RestoreRadioReadiness *sample = new RestoreRadioReadiness();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
RestoreRadioReadiness *
|
|
RestoreRadioReadinessPluginSupport_create_data(void)
|
|
{
|
|
return (RestoreRadioReadiness *) RestoreRadioReadinessPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPluginSupport_destroy_data(
|
|
RestoreRadioReadiness *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::RestoreRadioReadinessPluginSupport_destroy_data((RestoreRadioReadiness *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPluginSupport_copy_data(
|
|
RestoreRadioReadiness *dst,
|
|
const RestoreRadioReadiness *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
RestoreRadioReadinessPluginSupport_create_keyI(void)
|
|
{
|
|
return RestoreRadioReadinessPluginSupport_create_data();
|
|
}
|
|
|
|
RestoreRadioReadiness *
|
|
RestoreRadioReadinessPluginSupport_create_key(void)
|
|
{
|
|
return (RestoreRadioReadiness *) RestoreRadioReadinessPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPluginSupport_destroy_key(
|
|
RestoreRadioReadinessKeyHolder *key)
|
|
{
|
|
RestoreRadioReadinessPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::RestoreRadioReadinessPluginSupport_destroy_key((RestoreRadioReadinessKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
RestoreRadioReadinessPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< RestoreRadioReadiness >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
RestoreRadioReadinessPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
RestoreRadioReadinessPluginSupport_create_dataI,
|
|
RestoreRadioReadinessPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::RestoreRadioReadinessPluginSupport_create_keyI , ::TrainingAreaBase::RestoreRadioReadinessPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::RestoreRadioReadinessPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = RestoreRadioReadinessPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::RestoreRadioReadinessPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RestoreRadioReadiness *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"RestoreRadioReadinessPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
RestoreRadioReadiness *dst,
|
|
const RestoreRadioReadiness *src)
|
|
{
|
|
return ::TrainingAreaBase::RestoreRadioReadinessPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
RestoreRadioReadinessPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const RestoreRadioReadiness *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< RestoreRadioReadiness >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
RestoreRadioReadiness,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
RestoreRadioReadinessPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPlugin_deserialize_from_cdr_buffer(
|
|
RestoreRadioReadiness *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< RestoreRadioReadiness >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
RestoreRadioReadiness,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
RestoreRadioReadinessPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
RestoreRadioReadinessPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool RestoreRadioReadinessPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RestoreRadioReadiness **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
RestoreRadioReadinessPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
RestoreRadioReadinessPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RestoreRadioReadinessKeyHolder *dst,
|
|
const RestoreRadioReadiness *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RestoreRadioReadiness *dst, const
|
|
RestoreRadioReadinessKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
RestoreRadioReadinessPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
RestoreRadioReadiness * sample = NULL;
|
|
sample = (RestoreRadioReadiness *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *RestoreRadioReadinessPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
RestoreRadioReadinessPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
RestoreRadioReadinessPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
RestoreRadioReadinessPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
RestoreRadioReadinessPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
RestoreRadioReadinessPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
RestoreRadioReadinessPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::RestoreRadioReadiness >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::RestoreRadioReadinessPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
RestoreRadioReadinessPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
RestoreRadioReadinessPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::RestoreRadioReadiness";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
RestoreRadioReadinessPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendCesHitInformation
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendCesHitInformationPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendCesHitInformation *sample = new SendCesHitInformation();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendCesHitInformation *
|
|
SendCesHitInformationPluginSupport_create_data(void)
|
|
{
|
|
return (SendCesHitInformation *) SendCesHitInformationPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPluginSupport_destroy_data(
|
|
SendCesHitInformation *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendCesHitInformationPluginSupport_destroy_data((SendCesHitInformation *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitInformationPluginSupport_copy_data(
|
|
SendCesHitInformation *dst,
|
|
const SendCesHitInformation *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendCesHitInformationPluginSupport_create_keyI(void)
|
|
{
|
|
return SendCesHitInformationPluginSupport_create_data();
|
|
}
|
|
|
|
SendCesHitInformation *
|
|
SendCesHitInformationPluginSupport_create_key(void)
|
|
{
|
|
return (SendCesHitInformation *) SendCesHitInformationPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPluginSupport_destroy_key(
|
|
SendCesHitInformationKeyHolder *key)
|
|
{
|
|
SendCesHitInformationPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendCesHitInformationPluginSupport_destroy_key((SendCesHitInformationKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendCesHitInformationPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendCesHitInformation >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendCesHitInformationPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendCesHitInformationPluginSupport_create_dataI,
|
|
SendCesHitInformationPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendCesHitInformationPluginSupport_create_keyI , ::TrainingAreaBase::SendCesHitInformationPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendCesHitInformationPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendCesHitInformationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendCesHitInformationPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitInformation *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendCesHitInformationPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitInformationPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendCesHitInformation *dst,
|
|
const SendCesHitInformation *src)
|
|
{
|
|
return ::TrainingAreaBase::SendCesHitInformationPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendCesHitInformationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendCesHitInformationPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendCesHitInformation *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendCesHitInformation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendCesHitInformation,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendCesHitInformationPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitInformationPlugin_deserialize_from_cdr_buffer(
|
|
SendCesHitInformation *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendCesHitInformation >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendCesHitInformation,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendCesHitInformationPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendCesHitInformationPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendCesHitInformationPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitInformation **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendCesHitInformationPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendCesHitInformationPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitInformationPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitInformationKeyHolder *dst,
|
|
const SendCesHitInformation *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitInformationPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitInformation *dst, const
|
|
SendCesHitInformationKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitInformationPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendCesHitInformation * sample = NULL;
|
|
sample = (SendCesHitInformation *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendCesHitInformationPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendCesHitInformationPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendCesHitInformationPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendCesHitInformationPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendCesHitInformationPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendCesHitInformationPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendCesHitInformationPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendCesHitInformation >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendCesHitInformationPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendCesHitInformationPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendCesHitInformationPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendCesHitInformation";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendCesHitInformationPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendCesHitRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendCesHitRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendCesHitRequest *sample = new SendCesHitRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendCesHitRequest *
|
|
SendCesHitRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendCesHitRequest *) SendCesHitRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPluginSupport_destroy_data(
|
|
SendCesHitRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendCesHitRequestPluginSupport_destroy_data((SendCesHitRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitRequestPluginSupport_copy_data(
|
|
SendCesHitRequest *dst,
|
|
const SendCesHitRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendCesHitRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendCesHitRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendCesHitRequest *
|
|
SendCesHitRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendCesHitRequest *) SendCesHitRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPluginSupport_destroy_key(
|
|
SendCesHitRequestKeyHolder *key)
|
|
{
|
|
SendCesHitRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendCesHitRequestPluginSupport_destroy_key((SendCesHitRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendCesHitRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendCesHitRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendCesHitRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendCesHitRequestPluginSupport_create_dataI,
|
|
SendCesHitRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendCesHitRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendCesHitRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendCesHitRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendCesHitRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendCesHitRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendCesHitRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendCesHitRequest *dst,
|
|
const SendCesHitRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendCesHitRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendCesHitRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendCesHitRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendCesHitRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendCesHitRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendCesHitRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendCesHitRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendCesHitRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendCesHitRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendCesHitRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendCesHitRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendCesHitRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendCesHitRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendCesHitRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendCesHitRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitRequestKeyHolder *dst,
|
|
const SendCesHitRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendCesHitRequest *dst, const
|
|
SendCesHitRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendCesHitRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendCesHitRequest * sample = NULL;
|
|
sample = (SendCesHitRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendCesHitRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendCesHitRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendCesHitRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendCesHitRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendCesHitRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendCesHitRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendCesHitRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendCesHitRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendCesHitRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendCesHitRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendCesHitRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendCesHitRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendCesHitRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendControlDataRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendControlDataRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendControlDataRequest *sample = new SendControlDataRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendControlDataRequest *
|
|
SendControlDataRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendControlDataRequest *) SendControlDataRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPluginSupport_destroy_data(
|
|
SendControlDataRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendControlDataRequestPluginSupport_destroy_data((SendControlDataRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendControlDataRequestPluginSupport_copy_data(
|
|
SendControlDataRequest *dst,
|
|
const SendControlDataRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendControlDataRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendControlDataRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendControlDataRequest *
|
|
SendControlDataRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendControlDataRequest *) SendControlDataRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPluginSupport_destroy_key(
|
|
SendControlDataRequestKeyHolder *key)
|
|
{
|
|
SendControlDataRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendControlDataRequestPluginSupport_destroy_key((SendControlDataRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendControlDataRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendControlDataRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendControlDataRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendControlDataRequestPluginSupport_create_dataI,
|
|
SendControlDataRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendControlDataRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendControlDataRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendControlDataRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendControlDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendControlDataRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendControlDataRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendControlDataRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendControlDataRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendControlDataRequest *dst,
|
|
const SendControlDataRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendControlDataRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendControlDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendControlDataRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendControlDataRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendControlDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendControlDataRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendControlDataRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendControlDataRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendControlDataRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendControlDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendControlDataRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendControlDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendControlDataRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendControlDataRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendControlDataRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendControlDataRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendControlDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendControlDataRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendControlDataRequestKeyHolder *dst,
|
|
const SendControlDataRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendControlDataRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendControlDataRequest *dst, const
|
|
SendControlDataRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendControlDataRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendControlDataRequest * sample = NULL;
|
|
sample = (SendControlDataRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendControlDataRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendControlDataRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendControlDataRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendControlDataRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendControlDataRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendControlDataRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendControlDataRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendControlDataRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendControlDataRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendControlDataRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendControlDataRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendControlDataRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendControlDataRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendEquipmentMessageRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendEquipmentMessageRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendEquipmentMessageRequest *sample = new SendEquipmentMessageRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendEquipmentMessageRequest *
|
|
SendEquipmentMessageRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendEquipmentMessageRequest *) SendEquipmentMessageRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendEquipmentMessageRequestPluginSupport_destroy_data(
|
|
SendEquipmentMessageRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendEquipmentMessageRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPluginSupport_destroy_data((SendEquipmentMessageRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendEquipmentMessageRequestPluginSupport_copy_data(
|
|
SendEquipmentMessageRequest *dst,
|
|
const SendEquipmentMessageRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendEquipmentMessageRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendEquipmentMessageRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendEquipmentMessageRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendEquipmentMessageRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendEquipmentMessageRequestPluginSupport_create_dataI,
|
|
SendEquipmentMessageRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendEquipmentMessageRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendEquipmentMessageRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendEquipmentMessageRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendEquipmentMessageRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendEquipmentMessageRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendEquipmentMessageRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendEquipmentMessageRequest *dst,
|
|
const SendEquipmentMessageRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendEquipmentMessageRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendEquipmentMessageRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendEquipmentMessageRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendEquipmentMessageRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendEquipmentMessageRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendEquipmentMessageRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendEquipmentMessageRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendEquipmentMessageRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendEquipmentMessageRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendEquipmentMessageRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendEquipmentMessageRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendEquipmentMessageRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendEquipmentMessageRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool SendEquipmentMessageRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendEquipmentMessageRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendEquipmentMessageRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendEquipmentMessageRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendEquipmentMessageRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendEquipmentMessageRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendEquipmentMessageRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendEquipmentMessageRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendEquipmentMessageRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendEquipmentMessageRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendEquipmentMessageRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendEquipmentMessageRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendEquipmentMessageRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendEquipmentMessageRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendEquipmentMessageRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendExConfirmationReportRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendExConfirmationReportRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendExConfirmationReportRequest *sample = new SendExConfirmationReportRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendExConfirmationReportRequest *
|
|
SendExConfirmationReportRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendExConfirmationReportRequest *) SendExConfirmationReportRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPluginSupport_destroy_data(
|
|
SendExConfirmationReportRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPluginSupport_destroy_data((SendExConfirmationReportRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPluginSupport_copy_data(
|
|
SendExConfirmationReportRequest *dst,
|
|
const SendExConfirmationReportRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendExConfirmationReportRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendExConfirmationReportRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendExConfirmationReportRequest *
|
|
SendExConfirmationReportRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendExConfirmationReportRequest *) SendExConfirmationReportRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPluginSupport_destroy_key(
|
|
SendExConfirmationReportRequestKeyHolder *key)
|
|
{
|
|
SendExConfirmationReportRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPluginSupport_destroy_key((SendExConfirmationReportRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendExConfirmationReportRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExConfirmationReportRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendExConfirmationReportRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendExConfirmationReportRequestPluginSupport_create_dataI,
|
|
SendExConfirmationReportRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendExConfirmationReportRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendExConfirmationReportRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendExConfirmationReportRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendExConfirmationReportRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExConfirmationReportRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendExConfirmationReportRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendExConfirmationReportRequest *dst,
|
|
const SendExConfirmationReportRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendExConfirmationReportRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendExConfirmationReportRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendExConfirmationReportRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExConfirmationReportRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendExConfirmationReportRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendExConfirmationReportRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendExConfirmationReportRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExConfirmationReportRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendExConfirmationReportRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendExConfirmationReportRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendExConfirmationReportRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendExConfirmationReportRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExConfirmationReportRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendExConfirmationReportRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendExConfirmationReportRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExConfirmationReportRequestKeyHolder *dst,
|
|
const SendExConfirmationReportRequest *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->participantId = src->participantId;
|
|
dst->partyId = src->partyId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExConfirmationReportRequest *dst, const
|
|
SendExConfirmationReportRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->participantId = src->participantId;
|
|
dst->partyId = src->partyId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExConfirmationReportRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendExConfirmationReportRequest * sample = NULL;
|
|
sample = (SendExConfirmationReportRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendExConfirmationReportRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendExConfirmationReportRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendExConfirmationReportRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendExConfirmationReportRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendExConfirmationReportRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendExConfirmationReportRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendExConfirmationReportRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendExConfirmationReportRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendExConfirmationReportRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendExConfirmationReportRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendExConfirmationReportRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendExConfirmationReportRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendExConfirmationReportRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendExFireReadinessRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendExFireReadinessRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendExFireReadinessRequest *sample = new SendExFireReadinessRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendExFireReadinessRequest *
|
|
SendExFireReadinessRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendExFireReadinessRequest *) SendExFireReadinessRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPluginSupport_destroy_data(
|
|
SendExFireReadinessRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendExFireReadinessRequestPluginSupport_destroy_data((SendExFireReadinessRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPluginSupport_copy_data(
|
|
SendExFireReadinessRequest *dst,
|
|
const SendExFireReadinessRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendExFireReadinessRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendExFireReadinessRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendExFireReadinessRequest *
|
|
SendExFireReadinessRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendExFireReadinessRequest *) SendExFireReadinessRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPluginSupport_destroy_key(
|
|
SendExFireReadinessRequestKeyHolder *key)
|
|
{
|
|
SendExFireReadinessRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendExFireReadinessRequestPluginSupport_destroy_key((SendExFireReadinessRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendExFireReadinessRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExFireReadinessRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendExFireReadinessRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendExFireReadinessRequestPluginSupport_create_dataI,
|
|
SendExFireReadinessRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendExFireReadinessRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendExFireReadinessRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendExFireReadinessRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendExFireReadinessRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendExFireReadinessRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFireReadinessRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendExFireReadinessRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendExFireReadinessRequest *dst,
|
|
const SendExFireReadinessRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendExFireReadinessRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendExFireReadinessRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendExFireReadinessRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExFireReadinessRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendExFireReadinessRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendExFireReadinessRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendExFireReadinessRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExFireReadinessRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendExFireReadinessRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendExFireReadinessRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendExFireReadinessRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendExFireReadinessRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFireReadinessRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendExFireReadinessRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendExFireReadinessRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFireReadinessRequestKeyHolder *dst,
|
|
const SendExFireReadinessRequest *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->participantId = src->participantId;
|
|
dst->partyId = src->partyId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFireReadinessRequest *dst, const
|
|
SendExFireReadinessRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->participantId = src->participantId;
|
|
dst->partyId = src->partyId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExFireReadinessRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendExFireReadinessRequest * sample = NULL;
|
|
sample = (SendExFireReadinessRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendExFireReadinessRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendExFireReadinessRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendExFireReadinessRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendExFireReadinessRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendExFireReadinessRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendExFireReadinessRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendExFireReadinessRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendExFireReadinessRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendExFireReadinessRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendExFireReadinessRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendExFireReadinessRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendExFireReadinessRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendExFireReadinessRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendExFiredReportRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendExFiredReportRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendExFiredReportRequest *sample = new SendExFiredReportRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendExFiredReportRequest *
|
|
SendExFiredReportRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendExFiredReportRequest *) SendExFiredReportRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPluginSupport_destroy_data(
|
|
SendExFiredReportRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendExFiredReportRequestPluginSupport_destroy_data((SendExFiredReportRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPluginSupport_copy_data(
|
|
SendExFiredReportRequest *dst,
|
|
const SendExFiredReportRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendExFiredReportRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendExFiredReportRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendExFiredReportRequest *
|
|
SendExFiredReportRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendExFiredReportRequest *) SendExFiredReportRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPluginSupport_destroy_key(
|
|
SendExFiredReportRequestKeyHolder *key)
|
|
{
|
|
SendExFiredReportRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendExFiredReportRequestPluginSupport_destroy_key((SendExFiredReportRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendExFiredReportRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExFiredReportRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendExFiredReportRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendExFiredReportRequestPluginSupport_create_dataI,
|
|
SendExFiredReportRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendExFiredReportRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendExFiredReportRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendExFiredReportRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendExFiredReportRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendExFiredReportRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFiredReportRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendExFiredReportRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendExFiredReportRequest *dst,
|
|
const SendExFiredReportRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendExFiredReportRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendExFiredReportRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendExFiredReportRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExFiredReportRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendExFiredReportRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendExFiredReportRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendExFiredReportRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendExFiredReportRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendExFiredReportRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendExFiredReportRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendExFiredReportRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendExFiredReportRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFiredReportRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendExFiredReportRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendExFiredReportRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFiredReportRequestKeyHolder *dst,
|
|
const SendExFiredReportRequest *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->participantId = src->participantId;
|
|
dst->partyId = src->partyId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendExFiredReportRequest *dst, const
|
|
SendExFiredReportRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->participantId = src->participantId;
|
|
dst->partyId = src->partyId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendExFiredReportRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendExFiredReportRequest * sample = NULL;
|
|
sample = (SendExFiredReportRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendExFiredReportRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendExFiredReportRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendExFiredReportRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendExFiredReportRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendExFiredReportRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendExFiredReportRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendExFiredReportRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendExFiredReportRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendExFiredReportRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendExFiredReportRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendExFiredReportRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendExFiredReportRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendExFiredReportRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendFireSmokeMarkerDataRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendFireSmokeMarkerDataRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendFireSmokeMarkerDataRequest *sample = new SendFireSmokeMarkerDataRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendFireSmokeMarkerDataRequest *
|
|
SendFireSmokeMarkerDataRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendFireSmokeMarkerDataRequest *) SendFireSmokeMarkerDataRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPluginSupport_destroy_data(
|
|
SendFireSmokeMarkerDataRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPluginSupport_destroy_data((SendFireSmokeMarkerDataRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPluginSupport_copy_data(
|
|
SendFireSmokeMarkerDataRequest *dst,
|
|
const SendFireSmokeMarkerDataRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendFireSmokeMarkerDataRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendFireSmokeMarkerDataRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendFireSmokeMarkerDataRequest *
|
|
SendFireSmokeMarkerDataRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendFireSmokeMarkerDataRequest *) SendFireSmokeMarkerDataRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPluginSupport_destroy_key(
|
|
SendFireSmokeMarkerDataRequestKeyHolder *key)
|
|
{
|
|
SendFireSmokeMarkerDataRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPluginSupport_destroy_key((SendFireSmokeMarkerDataRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendFireSmokeMarkerDataRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendFireSmokeMarkerDataRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendFireSmokeMarkerDataRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendFireSmokeMarkerDataRequestPluginSupport_create_dataI,
|
|
SendFireSmokeMarkerDataRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendFireSmokeMarkerDataRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendFireSmokeMarkerDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendFireSmokeMarkerDataRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendFireSmokeMarkerDataRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendFireSmokeMarkerDataRequest *dst,
|
|
const SendFireSmokeMarkerDataRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendFireSmokeMarkerDataRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendFireSmokeMarkerDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendFireSmokeMarkerDataRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendFireSmokeMarkerDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendFireSmokeMarkerDataRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendFireSmokeMarkerDataRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendFireSmokeMarkerDataRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendFireSmokeMarkerDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendFireSmokeMarkerDataRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendFireSmokeMarkerDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendFireSmokeMarkerDataRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendFireSmokeMarkerDataRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendFireSmokeMarkerDataRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendFireSmokeMarkerDataRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendFireSmokeMarkerDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendFireSmokeMarkerDataRequestKeyHolder *dst,
|
|
const SendFireSmokeMarkerDataRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendFireSmokeMarkerDataRequest *dst, const
|
|
SendFireSmokeMarkerDataRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendFireSmokeMarkerDataRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendFireSmokeMarkerDataRequest * sample = NULL;
|
|
sample = (SendFireSmokeMarkerDataRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendFireSmokeMarkerDataRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendFireSmokeMarkerDataRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendFireSmokeMarkerDataRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendFireSmokeMarkerDataRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendFireSmokeMarkerDataRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendFireSmokeMarkerDataRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendGeopairingDataRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendGeopairingDataRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendGeopairingDataRequest *sample = new SendGeopairingDataRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendGeopairingDataRequest *
|
|
SendGeopairingDataRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendGeopairingDataRequest *) SendGeopairingDataRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPluginSupport_destroy_data(
|
|
SendGeopairingDataRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendGeopairingDataRequestPluginSupport_destroy_data((SendGeopairingDataRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPluginSupport_copy_data(
|
|
SendGeopairingDataRequest *dst,
|
|
const SendGeopairingDataRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendGeopairingDataRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendGeopairingDataRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendGeopairingDataRequest *
|
|
SendGeopairingDataRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendGeopairingDataRequest *) SendGeopairingDataRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPluginSupport_destroy_key(
|
|
SendGeopairingDataRequestKeyHolder *key)
|
|
{
|
|
SendGeopairingDataRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendGeopairingDataRequestPluginSupport_destroy_key((SendGeopairingDataRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendGeopairingDataRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendGeopairingDataRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendGeopairingDataRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendGeopairingDataRequestPluginSupport_create_dataI,
|
|
SendGeopairingDataRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendGeopairingDataRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendGeopairingDataRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendGeopairingDataRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendGeopairingDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendGeopairingDataRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendGeopairingDataRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendGeopairingDataRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendGeopairingDataRequest *dst,
|
|
const SendGeopairingDataRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendGeopairingDataRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendGeopairingDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendGeopairingDataRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendGeopairingDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendGeopairingDataRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendGeopairingDataRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendGeopairingDataRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendGeopairingDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendGeopairingDataRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendGeopairingDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendGeopairingDataRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendGeopairingDataRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendGeopairingDataRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendGeopairingDataRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendGeopairingDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendGeopairingDataRequestKeyHolder *dst,
|
|
const SendGeopairingDataRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendGeopairingDataRequest *dst, const
|
|
SendGeopairingDataRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendGeopairingDataRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendGeopairingDataRequest * sample = NULL;
|
|
sample = (SendGeopairingDataRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendGeopairingDataRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendGeopairingDataRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendGeopairingDataRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendGeopairingDataRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendGeopairingDataRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendGeopairingDataRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendGeopairingDataRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendGeopairingDataRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendGeopairingDataRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendGeopairingDataRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendGeopairingDataRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendGeopairingDataRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendGeopairingDataRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendLanguageSelectionRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendLanguageSelectionRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendLanguageSelectionRequest *sample = new SendLanguageSelectionRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendLanguageSelectionRequest *
|
|
SendLanguageSelectionRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendLanguageSelectionRequest *) SendLanguageSelectionRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPluginSupport_destroy_data(
|
|
SendLanguageSelectionRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPluginSupport_destroy_data((SendLanguageSelectionRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPluginSupport_copy_data(
|
|
SendLanguageSelectionRequest *dst,
|
|
const SendLanguageSelectionRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendLanguageSelectionRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendLanguageSelectionRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendLanguageSelectionRequest *
|
|
SendLanguageSelectionRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendLanguageSelectionRequest *) SendLanguageSelectionRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPluginSupport_destroy_key(
|
|
SendLanguageSelectionRequestKeyHolder *key)
|
|
{
|
|
SendLanguageSelectionRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPluginSupport_destroy_key((SendLanguageSelectionRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendLanguageSelectionRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendLanguageSelectionRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendLanguageSelectionRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendLanguageSelectionRequestPluginSupport_create_dataI,
|
|
SendLanguageSelectionRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendLanguageSelectionRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendLanguageSelectionRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendLanguageSelectionRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendLanguageSelectionRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendLanguageSelectionRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendLanguageSelectionRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendLanguageSelectionRequest *dst,
|
|
const SendLanguageSelectionRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendLanguageSelectionRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendLanguageSelectionRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendLanguageSelectionRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendLanguageSelectionRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendLanguageSelectionRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendLanguageSelectionRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendLanguageSelectionRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendLanguageSelectionRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendLanguageSelectionRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendLanguageSelectionRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendLanguageSelectionRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendLanguageSelectionRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendLanguageSelectionRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendLanguageSelectionRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendLanguageSelectionRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendLanguageSelectionRequestKeyHolder *dst,
|
|
const SendLanguageSelectionRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendLanguageSelectionRequest *dst, const
|
|
SendLanguageSelectionRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendLanguageSelectionRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendLanguageSelectionRequest * sample = NULL;
|
|
sample = (SendLanguageSelectionRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendLanguageSelectionRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendLanguageSelectionRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendLanguageSelectionRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendLanguageSelectionRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendLanguageSelectionRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendLanguageSelectionRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendLanguageSelectionRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendLanguageSelectionRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendLanguageSelectionRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendLanguageSelectionRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendLanguageSelectionRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendLanguageSelectionRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendLanguageSelectionRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendModifyUasStateRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendModifyUasStateRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendModifyUasStateRequest *sample = new SendModifyUasStateRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendModifyUasStateRequest *
|
|
SendModifyUasStateRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendModifyUasStateRequest *) SendModifyUasStateRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPluginSupport_destroy_data(
|
|
SendModifyUasStateRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendModifyUasStateRequestPluginSupport_destroy_data((SendModifyUasStateRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPluginSupport_copy_data(
|
|
SendModifyUasStateRequest *dst,
|
|
const SendModifyUasStateRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendModifyUasStateRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendModifyUasStateRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendModifyUasStateRequest *
|
|
SendModifyUasStateRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendModifyUasStateRequest *) SendModifyUasStateRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPluginSupport_destroy_key(
|
|
SendModifyUasStateRequestKeyHolder *key)
|
|
{
|
|
SendModifyUasStateRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendModifyUasStateRequestPluginSupport_destroy_key((SendModifyUasStateRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendModifyUasStateRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendModifyUasStateRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendModifyUasStateRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendModifyUasStateRequestPluginSupport_create_dataI,
|
|
SendModifyUasStateRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendModifyUasStateRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendModifyUasStateRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendModifyUasStateRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendModifyUasStateRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendModifyUasStateRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendModifyUasStateRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendModifyUasStateRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendModifyUasStateRequest *dst,
|
|
const SendModifyUasStateRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendModifyUasStateRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendModifyUasStateRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendModifyUasStateRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendModifyUasStateRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendModifyUasStateRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendModifyUasStateRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendModifyUasStateRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendModifyUasStateRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendModifyUasStateRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendModifyUasStateRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendModifyUasStateRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendModifyUasStateRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendModifyUasStateRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendModifyUasStateRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendModifyUasStateRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendModifyUasStateRequestKeyHolder *dst,
|
|
const SendModifyUasStateRequest *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->uasId = src->uasId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendModifyUasStateRequest *dst, const
|
|
SendModifyUasStateRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->uasId = src->uasId;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendModifyUasStateRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendModifyUasStateRequest * sample = NULL;
|
|
sample = (SendModifyUasStateRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendModifyUasStateRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendModifyUasStateRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendModifyUasStateRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendModifyUasStateRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendModifyUasStateRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendModifyUasStateRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendModifyUasStateRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendModifyUasStateRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendModifyUasStateRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendModifyUasStateRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendModifyUasStateRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendModifyUasStateRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendModifyUasStateRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendOcCommandRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendOcCommandRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendOcCommandRequest *sample = new SendOcCommandRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendOcCommandRequest *
|
|
SendOcCommandRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendOcCommandRequest *) SendOcCommandRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendOcCommandRequestPluginSupport_destroy_data(
|
|
SendOcCommandRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendOcCommandRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendOcCommandRequestPluginSupport_destroy_data((SendOcCommandRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendOcCommandRequestPluginSupport_copy_data(
|
|
SendOcCommandRequest *dst,
|
|
const SendOcCommandRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendOcCommandRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendOcCommandRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendOcCommandRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendOcCommandRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendOcCommandRequestPluginSupport_create_dataI,
|
|
SendOcCommandRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendOcCommandRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendOcCommandRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendOcCommandRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendOcCommandRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendOcCommandRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendOcCommandRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendOcCommandRequest *dst,
|
|
const SendOcCommandRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendOcCommandRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendOcCommandRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendOcCommandRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendOcCommandRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendOcCommandRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendOcCommandRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendOcCommandRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendOcCommandRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendOcCommandRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendOcCommandRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendOcCommandRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendOcCommandRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendOcCommandRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool SendOcCommandRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendOcCommandRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendOcCommandRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendOcCommandRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendOcCommandRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendOcCommandRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendOcCommandRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendOcCommandRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendOcCommandRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendOcCommandRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendOcCommandRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendOcCommandRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendOcCommandRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendOcCommandRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendOcCommandRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendOcDataRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendOcDataRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendOcDataRequest *sample = new SendOcDataRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendOcDataRequest *
|
|
SendOcDataRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendOcDataRequest *) SendOcDataRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPluginSupport_destroy_data(
|
|
SendOcDataRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendOcDataRequestPluginSupport_destroy_data((SendOcDataRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendOcDataRequestPluginSupport_copy_data(
|
|
SendOcDataRequest *dst,
|
|
const SendOcDataRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendOcDataRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendOcDataRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendOcDataRequest *
|
|
SendOcDataRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendOcDataRequest *) SendOcDataRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPluginSupport_destroy_key(
|
|
SendOcDataRequestKeyHolder *key)
|
|
{
|
|
SendOcDataRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendOcDataRequestPluginSupport_destroy_key((SendOcDataRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendOcDataRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendOcDataRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendOcDataRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendOcDataRequestPluginSupport_create_dataI,
|
|
SendOcDataRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendOcDataRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendOcDataRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendOcDataRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendOcDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendOcDataRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendOcDataRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendOcDataRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendOcDataRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendOcDataRequest *dst,
|
|
const SendOcDataRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendOcDataRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendOcDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendOcDataRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendOcDataRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendOcDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendOcDataRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendOcDataRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendOcDataRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendOcDataRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendOcDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendOcDataRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendOcDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendOcDataRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendOcDataRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendOcDataRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendOcDataRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendOcDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendOcDataRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendOcDataRequestKeyHolder *dst,
|
|
const SendOcDataRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendOcDataRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendOcDataRequest *dst, const
|
|
SendOcDataRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendOcDataRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendOcDataRequest * sample = NULL;
|
|
sample = (SendOcDataRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendOcDataRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendOcDataRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendOcDataRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendOcDataRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendOcDataRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendOcDataRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendOcDataRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendOcDataRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendOcDataRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendOcDataRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendOcDataRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendOcDataRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendOcDataRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendParticipantBeStillWarningRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendParticipantBeStillWarningRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendParticipantBeStillWarningRequest *sample = new SendParticipantBeStillWarningRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendParticipantBeStillWarningRequest *
|
|
SendParticipantBeStillWarningRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendParticipantBeStillWarningRequest *) SendParticipantBeStillWarningRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPluginSupport_destroy_data(
|
|
SendParticipantBeStillWarningRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPluginSupport_destroy_data((SendParticipantBeStillWarningRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPluginSupport_copy_data(
|
|
SendParticipantBeStillWarningRequest *dst,
|
|
const SendParticipantBeStillWarningRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendParticipantBeStillWarningRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendParticipantBeStillWarningRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendParticipantBeStillWarningRequest *
|
|
SendParticipantBeStillWarningRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendParticipantBeStillWarningRequest *) SendParticipantBeStillWarningRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPluginSupport_destroy_key(
|
|
SendParticipantBeStillWarningRequestKeyHolder *key)
|
|
{
|
|
SendParticipantBeStillWarningRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPluginSupport_destroy_key((SendParticipantBeStillWarningRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendParticipantBeStillWarningRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantBeStillWarningRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendParticipantBeStillWarningRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendParticipantBeStillWarningRequestPluginSupport_create_dataI,
|
|
SendParticipantBeStillWarningRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendParticipantBeStillWarningRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendParticipantBeStillWarningRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBeStillWarningRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendParticipantBeStillWarningRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendParticipantBeStillWarningRequest *dst,
|
|
const SendParticipantBeStillWarningRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendParticipantBeStillWarningRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendParticipantBeStillWarningRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendParticipantBeStillWarningRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantBeStillWarningRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantBeStillWarningRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendParticipantBeStillWarningRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendParticipantBeStillWarningRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantBeStillWarningRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantBeStillWarningRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantBeStillWarningRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendParticipantBeStillWarningRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendParticipantBeStillWarningRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBeStillWarningRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantBeStillWarningRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantBeStillWarningRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBeStillWarningRequestKeyHolder *dst,
|
|
const SendParticipantBeStillWarningRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBeStillWarningRequest *dst, const
|
|
SendParticipantBeStillWarningRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBeStillWarningRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendParticipantBeStillWarningRequest * sample = NULL;
|
|
sample = (SendParticipantBeStillWarningRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendParticipantBeStillWarningRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendParticipantBeStillWarningRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendParticipantBeStillWarningRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendParticipantBeStillWarningRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendParticipantBeStillWarningRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendParticipantBeStillWarningRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendParticipantBlockedAreaRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendParticipantBlockedAreaRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendParticipantBlockedAreaRequest *sample = new SendParticipantBlockedAreaRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendParticipantBlockedAreaRequest *
|
|
SendParticipantBlockedAreaRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendParticipantBlockedAreaRequest *) SendParticipantBlockedAreaRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPluginSupport_destroy_data(
|
|
SendParticipantBlockedAreaRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPluginSupport_destroy_data((SendParticipantBlockedAreaRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPluginSupport_copy_data(
|
|
SendParticipantBlockedAreaRequest *dst,
|
|
const SendParticipantBlockedAreaRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendParticipantBlockedAreaRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendParticipantBlockedAreaRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendParticipantBlockedAreaRequest *
|
|
SendParticipantBlockedAreaRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendParticipantBlockedAreaRequest *) SendParticipantBlockedAreaRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPluginSupport_destroy_key(
|
|
SendParticipantBlockedAreaRequestKeyHolder *key)
|
|
{
|
|
SendParticipantBlockedAreaRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPluginSupport_destroy_key((SendParticipantBlockedAreaRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendParticipantBlockedAreaRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantBlockedAreaRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendParticipantBlockedAreaRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendParticipantBlockedAreaRequestPluginSupport_create_dataI,
|
|
SendParticipantBlockedAreaRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendParticipantBlockedAreaRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendParticipantBlockedAreaRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBlockedAreaRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendParticipantBlockedAreaRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendParticipantBlockedAreaRequest *dst,
|
|
const SendParticipantBlockedAreaRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendParticipantBlockedAreaRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendParticipantBlockedAreaRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendParticipantBlockedAreaRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantBlockedAreaRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantBlockedAreaRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendParticipantBlockedAreaRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendParticipantBlockedAreaRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantBlockedAreaRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantBlockedAreaRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantBlockedAreaRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendParticipantBlockedAreaRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendParticipantBlockedAreaRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBlockedAreaRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantBlockedAreaRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantBlockedAreaRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBlockedAreaRequestKeyHolder *dst,
|
|
const SendParticipantBlockedAreaRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantBlockedAreaRequest *dst, const
|
|
SendParticipantBlockedAreaRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantBlockedAreaRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendParticipantBlockedAreaRequest * sample = NULL;
|
|
sample = (SendParticipantBlockedAreaRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendParticipantBlockedAreaRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendParticipantBlockedAreaRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendParticipantBlockedAreaRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendParticipantBlockedAreaRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendParticipantBlockedAreaRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendParticipantBlockedAreaRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendParticipantConfigurationRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendParticipantConfigurationRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendParticipantConfigurationRequest *sample = new SendParticipantConfigurationRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendParticipantConfigurationRequest *
|
|
SendParticipantConfigurationRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendParticipantConfigurationRequest *) SendParticipantConfigurationRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPluginSupport_destroy_data(
|
|
SendParticipantConfigurationRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPluginSupport_destroy_data((SendParticipantConfigurationRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPluginSupport_copy_data(
|
|
SendParticipantConfigurationRequest *dst,
|
|
const SendParticipantConfigurationRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendParticipantConfigurationRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendParticipantConfigurationRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendParticipantConfigurationRequest *
|
|
SendParticipantConfigurationRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendParticipantConfigurationRequest *) SendParticipantConfigurationRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPluginSupport_destroy_key(
|
|
SendParticipantConfigurationRequestKeyHolder *key)
|
|
{
|
|
SendParticipantConfigurationRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPluginSupport_destroy_key((SendParticipantConfigurationRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendParticipantConfigurationRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantConfigurationRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendParticipantConfigurationRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendParticipantConfigurationRequestPluginSupport_create_dataI,
|
|
SendParticipantConfigurationRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendParticipantConfigurationRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendParticipantConfigurationRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantConfigurationRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendParticipantConfigurationRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendParticipantConfigurationRequest *dst,
|
|
const SendParticipantConfigurationRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendParticipantConfigurationRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendParticipantConfigurationRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantConfigurationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantConfigurationRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendParticipantConfigurationRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantConfigurationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantConfigurationRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantConfigurationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendParticipantConfigurationRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendParticipantConfigurationRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantConfigurationRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantConfigurationRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantConfigurationRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantConfigurationRequestKeyHolder *dst,
|
|
const SendParticipantConfigurationRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantConfigurationRequest *dst, const
|
|
SendParticipantConfigurationRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantConfigurationRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendParticipantConfigurationRequest * sample = NULL;
|
|
sample = (SendParticipantConfigurationRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendParticipantConfigurationRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendParticipantConfigurationRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendParticipantConfigurationRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendParticipantConfigurationRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendParticipantConfigurationRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendParticipantConfigurationRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendParticipantConfigurationRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendParticipantConfigurationRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendParticipantConfigurationRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendParticipantConfigurationRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendParticipantConfigurationRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendParticipantConfigurationRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendParticipantConfigurationRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendParticipantModeRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendParticipantModeRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendParticipantModeRequest *sample = new SendParticipantModeRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendParticipantModeRequest *
|
|
SendParticipantModeRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendParticipantModeRequest *) SendParticipantModeRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPluginSupport_destroy_data(
|
|
SendParticipantModeRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendParticipantModeRequestPluginSupport_destroy_data((SendParticipantModeRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPluginSupport_copy_data(
|
|
SendParticipantModeRequest *dst,
|
|
const SendParticipantModeRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendParticipantModeRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendParticipantModeRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendParticipantModeRequest *
|
|
SendParticipantModeRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendParticipantModeRequest *) SendParticipantModeRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPluginSupport_destroy_key(
|
|
SendParticipantModeRequestKeyHolder *key)
|
|
{
|
|
SendParticipantModeRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendParticipantModeRequestPluginSupport_destroy_key((SendParticipantModeRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendParticipantModeRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantModeRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendParticipantModeRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendParticipantModeRequestPluginSupport_create_dataI,
|
|
SendParticipantModeRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendParticipantModeRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendParticipantModeRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendParticipantModeRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendParticipantModeRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantModeRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendParticipantModeRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendParticipantModeRequest *dst,
|
|
const SendParticipantModeRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendParticipantModeRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendParticipantModeRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantModeRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantModeRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendParticipantModeRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantModeRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantModeRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantModeRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendParticipantModeRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendParticipantModeRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantModeRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantModeRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantModeRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantModeRequestKeyHolder *dst,
|
|
const SendParticipantModeRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantModeRequest *dst, const
|
|
SendParticipantModeRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantModeRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendParticipantModeRequest * sample = NULL;
|
|
sample = (SendParticipantModeRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendParticipantModeRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendParticipantModeRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendParticipantModeRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendParticipantModeRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendParticipantModeRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendParticipantModeRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendParticipantModeRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendParticipantModeRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendParticipantModeRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendParticipantModeRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendParticipantModeRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendParticipantModeRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendParticipantModeRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendParticipantSwVerionsRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendParticipantSwVerionsRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendParticipantSwVerionsRequest *sample = new SendParticipantSwVerionsRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendParticipantSwVerionsRequest *
|
|
SendParticipantSwVerionsRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendParticipantSwVerionsRequest *) SendParticipantSwVerionsRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPluginSupport_destroy_data(
|
|
SendParticipantSwVerionsRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPluginSupport_destroy_data((SendParticipantSwVerionsRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPluginSupport_copy_data(
|
|
SendParticipantSwVerionsRequest *dst,
|
|
const SendParticipantSwVerionsRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendParticipantSwVerionsRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendParticipantSwVerionsRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendParticipantSwVerionsRequest *
|
|
SendParticipantSwVerionsRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendParticipantSwVerionsRequest *) SendParticipantSwVerionsRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPluginSupport_destroy_key(
|
|
SendParticipantSwVerionsRequestKeyHolder *key)
|
|
{
|
|
SendParticipantSwVerionsRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPluginSupport_destroy_key((SendParticipantSwVerionsRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendParticipantSwVerionsRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantSwVerionsRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendParticipantSwVerionsRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendParticipantSwVerionsRequestPluginSupport_create_dataI,
|
|
SendParticipantSwVerionsRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendParticipantSwVerionsRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendParticipantSwVerionsRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantSwVerionsRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendParticipantSwVerionsRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendParticipantSwVerionsRequest *dst,
|
|
const SendParticipantSwVerionsRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendParticipantSwVerionsRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendParticipantSwVerionsRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendParticipantSwVerionsRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantSwVerionsRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantSwVerionsRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendParticipantSwVerionsRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendParticipantSwVerionsRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendParticipantSwVerionsRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendParticipantSwVerionsRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantSwVerionsRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendParticipantSwVerionsRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendParticipantSwVerionsRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantSwVerionsRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantSwVerionsRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendParticipantSwVerionsRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantSwVerionsRequestKeyHolder *dst,
|
|
const SendParticipantSwVerionsRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendParticipantSwVerionsRequest *dst, const
|
|
SendParticipantSwVerionsRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendParticipantSwVerionsRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendParticipantSwVerionsRequest * sample = NULL;
|
|
sample = (SendParticipantSwVerionsRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendParticipantSwVerionsRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendParticipantSwVerionsRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendParticipantSwVerionsRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendParticipantSwVerionsRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendParticipantSwVerionsRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendParticipantSwVerionsRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendParticipantSwVerionsRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendParticipantSwVerionsRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendParticipantSwVerionsRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendParticipantSwVerionsRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendParticipantSwVerionsRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendParticipantSwVerionsRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendParticipantSwVerionsRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendResetAllDusMinesRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendResetAllDusMinesRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendResetAllDusMinesRequest *sample = new SendResetAllDusMinesRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendResetAllDusMinesRequest *
|
|
SendResetAllDusMinesRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendResetAllDusMinesRequest *) SendResetAllDusMinesRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPluginSupport_destroy_data(
|
|
SendResetAllDusMinesRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPluginSupport_destroy_data((SendResetAllDusMinesRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPluginSupport_copy_data(
|
|
SendResetAllDusMinesRequest *dst,
|
|
const SendResetAllDusMinesRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendResetAllDusMinesRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendResetAllDusMinesRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendResetAllDusMinesRequest *
|
|
SendResetAllDusMinesRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendResetAllDusMinesRequest *) SendResetAllDusMinesRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPluginSupport_destroy_key(
|
|
SendResetAllDusMinesRequestKeyHolder *key)
|
|
{
|
|
SendResetAllDusMinesRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPluginSupport_destroy_key((SendResetAllDusMinesRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendResetAllDusMinesRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendResetAllDusMinesRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendResetAllDusMinesRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendResetAllDusMinesRequestPluginSupport_create_dataI,
|
|
SendResetAllDusMinesRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendResetAllDusMinesRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendResetAllDusMinesRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendResetAllDusMinesRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendResetAllDusMinesRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendResetAllDusMinesRequest *dst,
|
|
const SendResetAllDusMinesRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendResetAllDusMinesRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendResetAllDusMinesRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendResetAllDusMinesRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendResetAllDusMinesRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendResetAllDusMinesRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendResetAllDusMinesRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendResetAllDusMinesRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendResetAllDusMinesRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendResetAllDusMinesRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendResetAllDusMinesRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendResetAllDusMinesRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendResetAllDusMinesRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendResetAllDusMinesRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendResetAllDusMinesRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendResetAllDusMinesRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendResetAllDusMinesRequestKeyHolder *dst,
|
|
const SendResetAllDusMinesRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendResetAllDusMinesRequest *dst, const
|
|
SendResetAllDusMinesRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendResetAllDusMinesRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendResetAllDusMinesRequest * sample = NULL;
|
|
sample = (SendResetAllDusMinesRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendResetAllDusMinesRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendResetAllDusMinesRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendResetAllDusMinesRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendResetAllDusMinesRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendResetAllDusMinesRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendResetAllDusMinesRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendResetAllDusMinesRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendResetAllDusMinesRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendResetAllDusMinesRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendResetAllDusMinesRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendResetAllDusMinesRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendResetAllDusMinesRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendResetAllDusMinesRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendSelectiveReammunitionRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendSelectiveReammunitionRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendSelectiveReammunitionRequest *sample = new SendSelectiveReammunitionRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendSelectiveReammunitionRequest *
|
|
SendSelectiveReammunitionRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendSelectiveReammunitionRequest *) SendSelectiveReammunitionRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPluginSupport_destroy_data(
|
|
SendSelectiveReammunitionRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPluginSupport_destroy_data((SendSelectiveReammunitionRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPluginSupport_copy_data(
|
|
SendSelectiveReammunitionRequest *dst,
|
|
const SendSelectiveReammunitionRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendSelectiveReammunitionRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendSelectiveReammunitionRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendSelectiveReammunitionRequest *
|
|
SendSelectiveReammunitionRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendSelectiveReammunitionRequest *) SendSelectiveReammunitionRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPluginSupport_destroy_key(
|
|
SendSelectiveReammunitionRequestKeyHolder *key)
|
|
{
|
|
SendSelectiveReammunitionRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPluginSupport_destroy_key((SendSelectiveReammunitionRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendSelectiveReammunitionRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSelectiveReammunitionRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendSelectiveReammunitionRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendSelectiveReammunitionRequestPluginSupport_create_dataI,
|
|
SendSelectiveReammunitionRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendSelectiveReammunitionRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendSelectiveReammunitionRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSelectiveReammunitionRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendSelectiveReammunitionRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendSelectiveReammunitionRequest *dst,
|
|
const SendSelectiveReammunitionRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendSelectiveReammunitionRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendSelectiveReammunitionRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendSelectiveReammunitionRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSelectiveReammunitionRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendSelectiveReammunitionRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendSelectiveReammunitionRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendSelectiveReammunitionRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSelectiveReammunitionRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendSelectiveReammunitionRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendSelectiveReammunitionRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendSelectiveReammunitionRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendSelectiveReammunitionRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSelectiveReammunitionRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendSelectiveReammunitionRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendSelectiveReammunitionRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSelectiveReammunitionRequestKeyHolder *dst,
|
|
const SendSelectiveReammunitionRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSelectiveReammunitionRequest *dst, const
|
|
SendSelectiveReammunitionRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSelectiveReammunitionRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendSelectiveReammunitionRequest * sample = NULL;
|
|
sample = (SendSelectiveReammunitionRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendSelectiveReammunitionRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendSelectiveReammunitionRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendSelectiveReammunitionRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendSelectiveReammunitionRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendSelectiveReammunitionRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendSelectiveReammunitionRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendSelectiveReammunitionRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendSelectiveReammunitionRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendSelectiveReammunitionRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendSelectiveReammunitionRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendSelectiveReammunitionRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendSelectiveReammunitionRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendSelectiveReammunitionRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendSetSanitationRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendSetSanitationRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendSetSanitationRequest *sample = new SendSetSanitationRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendSetSanitationRequest *
|
|
SendSetSanitationRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendSetSanitationRequest *) SendSetSanitationRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPluginSupport_destroy_data(
|
|
SendSetSanitationRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendSetSanitationRequestPluginSupport_destroy_data((SendSetSanitationRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPluginSupport_copy_data(
|
|
SendSetSanitationRequest *dst,
|
|
const SendSetSanitationRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendSetSanitationRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendSetSanitationRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendSetSanitationRequest *
|
|
SendSetSanitationRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendSetSanitationRequest *) SendSetSanitationRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPluginSupport_destroy_key(
|
|
SendSetSanitationRequestKeyHolder *key)
|
|
{
|
|
SendSetSanitationRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendSetSanitationRequestPluginSupport_destroy_key((SendSetSanitationRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendSetSanitationRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSetSanitationRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendSetSanitationRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendSetSanitationRequestPluginSupport_create_dataI,
|
|
SendSetSanitationRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendSetSanitationRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendSetSanitationRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendSetSanitationRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendSetSanitationRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendSetSanitationRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetSanitationRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendSetSanitationRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendSetSanitationRequest *dst,
|
|
const SendSetSanitationRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendSetSanitationRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendSetSanitationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendSetSanitationRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSetSanitationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendSetSanitationRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendSetSanitationRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendSetSanitationRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSetSanitationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendSetSanitationRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendSetSanitationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendSetSanitationRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendSetSanitationRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetSanitationRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendSetSanitationRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendSetSanitationRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetSanitationRequestKeyHolder *dst,
|
|
const SendSetSanitationRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetSanitationRequest *dst, const
|
|
SendSetSanitationRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSetSanitationRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendSetSanitationRequest * sample = NULL;
|
|
sample = (SendSetSanitationRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendSetSanitationRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendSetSanitationRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendSetSanitationRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendSetSanitationRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendSetSanitationRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendSetSanitationRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendSetSanitationRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendSetSanitationRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendSetSanitationRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendSetSanitationRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendSetSanitationRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendSetSanitationRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendSetSanitationRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendSetVulnerabilityModelRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendSetVulnerabilityModelRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendSetVulnerabilityModelRequest *sample = new SendSetVulnerabilityModelRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendSetVulnerabilityModelRequest *
|
|
SendSetVulnerabilityModelRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendSetVulnerabilityModelRequest *) SendSetVulnerabilityModelRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPluginSupport_destroy_data(
|
|
SendSetVulnerabilityModelRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPluginSupport_destroy_data((SendSetVulnerabilityModelRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPluginSupport_copy_data(
|
|
SendSetVulnerabilityModelRequest *dst,
|
|
const SendSetVulnerabilityModelRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendSetVulnerabilityModelRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendSetVulnerabilityModelRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendSetVulnerabilityModelRequest *
|
|
SendSetVulnerabilityModelRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendSetVulnerabilityModelRequest *) SendSetVulnerabilityModelRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPluginSupport_destroy_key(
|
|
SendSetVulnerabilityModelRequestKeyHolder *key)
|
|
{
|
|
SendSetVulnerabilityModelRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPluginSupport_destroy_key((SendSetVulnerabilityModelRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendSetVulnerabilityModelRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSetVulnerabilityModelRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendSetVulnerabilityModelRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendSetVulnerabilityModelRequestPluginSupport_create_dataI,
|
|
SendSetVulnerabilityModelRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendSetVulnerabilityModelRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendSetVulnerabilityModelRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetVulnerabilityModelRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendSetVulnerabilityModelRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendSetVulnerabilityModelRequest *dst,
|
|
const SendSetVulnerabilityModelRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendSetVulnerabilityModelRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendSetVulnerabilityModelRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendSetVulnerabilityModelRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSetVulnerabilityModelRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendSetVulnerabilityModelRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendSetVulnerabilityModelRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendSetVulnerabilityModelRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendSetVulnerabilityModelRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendSetVulnerabilityModelRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendSetVulnerabilityModelRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendSetVulnerabilityModelRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendSetVulnerabilityModelRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetVulnerabilityModelRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendSetVulnerabilityModelRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendSetVulnerabilityModelRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetVulnerabilityModelRequestKeyHolder *dst,
|
|
const SendSetVulnerabilityModelRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendSetVulnerabilityModelRequest *dst, const
|
|
SendSetVulnerabilityModelRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendSetVulnerabilityModelRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendSetVulnerabilityModelRequest * sample = NULL;
|
|
sample = (SendSetVulnerabilityModelRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendSetVulnerabilityModelRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendSetVulnerabilityModelRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendSetVulnerabilityModelRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendSetVulnerabilityModelRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendSetVulnerabilityModelRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendSetVulnerabilityModelRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendTargetDataRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendTargetDataRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendTargetDataRequest *sample = new SendTargetDataRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendTargetDataRequest *
|
|
SendTargetDataRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendTargetDataRequest *) SendTargetDataRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPluginSupport_destroy_data(
|
|
SendTargetDataRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendTargetDataRequestPluginSupport_destroy_data((SendTargetDataRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPluginSupport_copy_data(
|
|
SendTargetDataRequest *dst,
|
|
const SendTargetDataRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendTargetDataRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendTargetDataRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendTargetDataRequest *
|
|
SendTargetDataRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendTargetDataRequest *) SendTargetDataRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPluginSupport_destroy_key(
|
|
SendTargetDataRequestKeyHolder *key)
|
|
{
|
|
SendTargetDataRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendTargetDataRequestPluginSupport_destroy_key((SendTargetDataRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendTargetDataRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendTargetDataRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendTargetDataRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendTargetDataRequestPluginSupport_create_dataI,
|
|
SendTargetDataRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendTargetDataRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendTargetDataRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendTargetDataRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendTargetDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendTargetDataRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendTargetDataRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendTargetDataRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendTargetDataRequest *dst,
|
|
const SendTargetDataRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendTargetDataRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendTargetDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendTargetDataRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendTargetDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendTargetDataRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendTargetDataRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendTargetDataRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendTargetDataRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendTargetDataRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendTargetDataRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendTargetDataRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendTargetDataRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendTargetDataRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendTargetDataRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendTargetDataRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendTargetDataRequestKeyHolder *dst,
|
|
const SendTargetDataRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendTargetDataRequest *dst, const
|
|
SendTargetDataRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendTargetDataRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendTargetDataRequest * sample = NULL;
|
|
sample = (SendTargetDataRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendTargetDataRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendTargetDataRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendTargetDataRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendTargetDataRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendTargetDataRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendTargetDataRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendTargetDataRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendTargetDataRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendTargetDataRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendTargetDataRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendTargetDataRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendTargetDataRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendTargetDataRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SendUasWaypointRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SendUasWaypointRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SendUasWaypointRequest *sample = new SendUasWaypointRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SendUasWaypointRequest *
|
|
SendUasWaypointRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SendUasWaypointRequest *) SendUasWaypointRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPluginSupport_destroy_data(
|
|
SendUasWaypointRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SendUasWaypointRequestPluginSupport_destroy_data((SendUasWaypointRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPluginSupport_copy_data(
|
|
SendUasWaypointRequest *dst,
|
|
const SendUasWaypointRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SendUasWaypointRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SendUasWaypointRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SendUasWaypointRequest *
|
|
SendUasWaypointRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SendUasWaypointRequest *) SendUasWaypointRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPluginSupport_destroy_key(
|
|
SendUasWaypointRequestKeyHolder *key)
|
|
{
|
|
SendUasWaypointRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SendUasWaypointRequestPluginSupport_destroy_key((SendUasWaypointRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SendUasWaypointRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendUasWaypointRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SendUasWaypointRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SendUasWaypointRequestPluginSupport_create_dataI,
|
|
SendUasWaypointRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SendUasWaypointRequestPluginSupport_create_keyI , ::TrainingAreaBase::SendUasWaypointRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SendUasWaypointRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SendUasWaypointRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SendUasWaypointRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendUasWaypointRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SendUasWaypointRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SendUasWaypointRequest *dst,
|
|
const SendUasWaypointRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SendUasWaypointRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SendUasWaypointRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SendUasWaypointRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendUasWaypointRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendUasWaypointRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SendUasWaypointRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPlugin_deserialize_from_cdr_buffer(
|
|
SendUasWaypointRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SendUasWaypointRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SendUasWaypointRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SendUasWaypointRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SendUasWaypointRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SendUasWaypointRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendUasWaypointRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendUasWaypointRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SendUasWaypointRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendUasWaypointRequestKeyHolder *dst,
|
|
const SendUasWaypointRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SendUasWaypointRequest *dst, const
|
|
SendUasWaypointRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SendUasWaypointRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SendUasWaypointRequest * sample = NULL;
|
|
sample = (SendUasWaypointRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SendUasWaypointRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SendUasWaypointRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SendUasWaypointRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SendUasWaypointRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SendUasWaypointRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SendUasWaypointRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SendUasWaypointRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SendUasWaypointRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SendUasWaypointRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SendUasWaypointRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SendUasWaypointRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SendUasWaypointRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SendUasWaypointRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ServiceControl
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ServiceControlPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ServiceControl *sample = new ServiceControl();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ServiceControl *
|
|
ServiceControlPluginSupport_create_data(void)
|
|
{
|
|
return (ServiceControl *) ServiceControlPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ServiceControlPluginSupport_destroy_data(
|
|
ServiceControl *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ServiceControlPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::ServiceControlPluginSupport_destroy_data((ServiceControl *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ServiceControlPluginSupport_copy_data(
|
|
ServiceControl *dst,
|
|
const ServiceControl *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ServiceControlPluginSupport_create_keyI(void)
|
|
{
|
|
return ServiceControlPluginSupport_create_data();
|
|
}
|
|
|
|
ServiceControl *
|
|
ServiceControlPluginSupport_create_key(void)
|
|
{
|
|
return (ServiceControl *) ServiceControlPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ServiceControlPluginSupport_destroy_key(
|
|
ServiceControlKeyHolder *key)
|
|
{
|
|
ServiceControlPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ServiceControlPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::ServiceControlPluginSupport_destroy_key((ServiceControlKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ServiceControlPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ServiceControl >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ServiceControlPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
ServiceControlPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
ServiceControlPluginSupport_create_dataI,
|
|
ServiceControlPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::ServiceControlPluginSupport_create_keyI , ::TrainingAreaBase::ServiceControlPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::ServiceControlPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ServiceControlPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::ServiceControlPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ServiceControlPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ServiceControlPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ServiceControl *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ServiceControlPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ServiceControlPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ServiceControl *dst,
|
|
const ServiceControl *src)
|
|
{
|
|
return ::TrainingAreaBase::ServiceControlPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ServiceControlPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ServiceControlPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ServiceControl *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ServiceControl >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ServiceControl,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
ServiceControlPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ServiceControlPlugin_deserialize_from_cdr_buffer(
|
|
ServiceControl *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< ServiceControl >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ServiceControl,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
ServiceControlPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
ServiceControlPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ServiceControlPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ServiceControl **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ServiceControlPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
ServiceControlPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
ServiceControlPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ServiceControlKeyHolder *dst,
|
|
const ServiceControl *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ServiceControlPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ServiceControl *dst, const
|
|
ServiceControlKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ServiceControlPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ServiceControl * sample = NULL;
|
|
sample = (ServiceControl *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *ServiceControlPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::ServiceControlPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::ServiceControlPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::ServiceControlPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::ServiceControlPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ServiceControlPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ServiceControlPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ServiceControlPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ServiceControlPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ServiceControlPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ServiceControlPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::ServiceControlPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::ServiceControl >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::ServiceControlPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ServiceControlPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ServiceControlPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::ServiceControl";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ServiceControlPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SetDevicePowerRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SetDevicePowerRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SetDevicePowerRequest *sample = new SetDevicePowerRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SetDevicePowerRequest *
|
|
SetDevicePowerRequestPluginSupport_create_data(void)
|
|
{
|
|
return (SetDevicePowerRequest *) SetDevicePowerRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPluginSupport_destroy_data(
|
|
SetDevicePowerRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SetDevicePowerRequestPluginSupport_destroy_data((SetDevicePowerRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPluginSupport_copy_data(
|
|
SetDevicePowerRequest *dst,
|
|
const SetDevicePowerRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SetDevicePowerRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return SetDevicePowerRequestPluginSupport_create_data();
|
|
}
|
|
|
|
SetDevicePowerRequest *
|
|
SetDevicePowerRequestPluginSupport_create_key(void)
|
|
{
|
|
return (SetDevicePowerRequest *) SetDevicePowerRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPluginSupport_destroy_key(
|
|
SetDevicePowerRequestKeyHolder *key)
|
|
{
|
|
SetDevicePowerRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SetDevicePowerRequestPluginSupport_destroy_key((SetDevicePowerRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SetDevicePowerRequestPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SetDevicePowerRequest >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SetDevicePowerRequestPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SetDevicePowerRequestPluginSupport_create_dataI,
|
|
SetDevicePowerRequestPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SetDevicePowerRequestPluginSupport_create_keyI , ::TrainingAreaBase::SetDevicePowerRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SetDevicePowerRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SetDevicePowerRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SetDevicePowerRequestPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SetDevicePowerRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SetDevicePowerRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SetDevicePowerRequest *dst,
|
|
const SetDevicePowerRequest *src)
|
|
{
|
|
return ::TrainingAreaBase::SetDevicePowerRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SetDevicePowerRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SetDevicePowerRequest *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SetDevicePowerRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SetDevicePowerRequest,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SetDevicePowerRequestPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPlugin_deserialize_from_cdr_buffer(
|
|
SetDevicePowerRequest *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SetDevicePowerRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SetDevicePowerRequest,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SetDevicePowerRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SetDevicePowerRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SetDevicePowerRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SetDevicePowerRequest **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SetDevicePowerRequestPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SetDevicePowerRequestPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SetDevicePowerRequestKeyHolder *dst,
|
|
const SetDevicePowerRequest *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::FtEquipmentBase *)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SetDevicePowerRequest *dst, const
|
|
SetDevicePowerRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::FtEquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::FtEquipmentBase*)dst,(const ::TrainingAreaBase::FtEquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SetDevicePowerRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SetDevicePowerRequest * sample = NULL;
|
|
sample = (SetDevicePowerRequest *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SetDevicePowerRequestPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SetDevicePowerRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SetDevicePowerRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SetDevicePowerRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SetDevicePowerRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SetDevicePowerRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SetDevicePowerRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SetDevicePowerRequest >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SetDevicePowerRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SetDevicePowerRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SetDevicePowerRequestPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SetDevicePowerRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SetDevicePowerRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SpecialSensorData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SpecialSensorDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SpecialSensorData *sample = new SpecialSensorData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SpecialSensorData *
|
|
SpecialSensorDataPluginSupport_create_data(void)
|
|
{
|
|
return (SpecialSensorData *) SpecialSensorDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPluginSupport_destroy_data(
|
|
SpecialSensorData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::SpecialSensorDataPluginSupport_destroy_data((SpecialSensorData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SpecialSensorDataPluginSupport_copy_data(
|
|
SpecialSensorData *dst,
|
|
const SpecialSensorData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SpecialSensorDataPluginSupport_create_keyI(void)
|
|
{
|
|
return SpecialSensorDataPluginSupport_create_data();
|
|
}
|
|
|
|
SpecialSensorData *
|
|
SpecialSensorDataPluginSupport_create_key(void)
|
|
{
|
|
return (SpecialSensorData *) SpecialSensorDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPluginSupport_destroy_key(
|
|
SpecialSensorDataKeyHolder *key)
|
|
{
|
|
SpecialSensorDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::SpecialSensorDataPluginSupport_destroy_key((SpecialSensorDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SpecialSensorDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SpecialSensorData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
SpecialSensorDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
SpecialSensorDataPluginSupport_create_dataI,
|
|
SpecialSensorDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::SpecialSensorDataPluginSupport_create_keyI , ::TrainingAreaBase::SpecialSensorDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::SpecialSensorDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SpecialSensorDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::SpecialSensorDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SpecialSensorData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SpecialSensorDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SpecialSensorDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SpecialSensorData *dst,
|
|
const SpecialSensorData *src)
|
|
{
|
|
return ::TrainingAreaBase::SpecialSensorDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SpecialSensorDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SpecialSensorDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SpecialSensorData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SpecialSensorData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SpecialSensorData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
SpecialSensorDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SpecialSensorDataPlugin_deserialize_from_cdr_buffer(
|
|
SpecialSensorData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< SpecialSensorData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SpecialSensorData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
SpecialSensorDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
SpecialSensorDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SpecialSensorDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SpecialSensorData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SpecialSensorDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
SpecialSensorDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
SpecialSensorDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SpecialSensorDataKeyHolder *dst,
|
|
const SpecialSensorData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SpecialSensorDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SpecialSensorData *dst, const
|
|
SpecialSensorDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SpecialSensorDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SpecialSensorData * sample = NULL;
|
|
sample = (SpecialSensorData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *SpecialSensorDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SpecialSensorDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SpecialSensorDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SpecialSensorDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SpecialSensorDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SpecialSensorDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SpecialSensorDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::SpecialSensorData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::SpecialSensorDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SpecialSensorDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SpecialSensorDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::SpecialSensorData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SpecialSensorDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type StateIed
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
StateIedPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
StateIed *sample = new StateIed();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
StateIed *
|
|
StateIedPluginSupport_create_data(void)
|
|
{
|
|
return (StateIed *) StateIedPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
StateIedPluginSupport_destroy_data(
|
|
StateIed *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
StateIedPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::StateIedPluginSupport_destroy_data((StateIed *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
StateIedPluginSupport_copy_data(
|
|
StateIed *dst,
|
|
const StateIed *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
StateIedPluginSupport_create_keyI(void)
|
|
{
|
|
return StateIedPluginSupport_create_data();
|
|
}
|
|
|
|
StateIed *
|
|
StateIedPluginSupport_create_key(void)
|
|
{
|
|
return (StateIed *) StateIedPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
StateIedPluginSupport_destroy_key(
|
|
StateIedKeyHolder *key)
|
|
{
|
|
StateIedPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
StateIedPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::StateIedPluginSupport_destroy_key((StateIedKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
StateIedPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< StateIed >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
StateIedPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
StateIedPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
StateIedPluginSupport_create_dataI,
|
|
StateIedPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::StateIedPluginSupport_create_keyI , ::TrainingAreaBase::StateIedPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::StateIedPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = StateIedPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::StateIedPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::StateIedPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
StateIedPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
StateIedPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
StateIed *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"StateIedPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
StateIedPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
StateIed *dst,
|
|
const StateIed *src)
|
|
{
|
|
return ::TrainingAreaBase::StateIedPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
StateIedPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
StateIedPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const StateIed *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< StateIed >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
StateIed,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
StateIedPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
StateIedPlugin_deserialize_from_cdr_buffer(
|
|
StateIed *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< StateIed >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
StateIed,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
StateIedPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
StateIedPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool StateIedPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
StateIed **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
StateIedPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
StateIedPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
StateIedPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
StateIedKeyHolder *dst,
|
|
const StateIed *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::IedBaseDataPlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::IedBaseData *)dst,(const ::TrainingAreaBase::IedBaseData*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
StateIedPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
StateIed *dst, const
|
|
StateIedKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::IedBaseDataPlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::IedBaseData*)dst,(const ::TrainingAreaBase::IedBaseData*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
StateIedPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
StateIed * sample = NULL;
|
|
sample = (StateIed *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *StateIedPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::StateIedPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::StateIedPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::StateIedPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::StateIedPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::StateIedPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
StateIedPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
StateIedPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::StateIedPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
StateIedPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
StateIedPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::StateIedPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::StateIedPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::StateIedPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::StateIedPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
StateIedPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
StateIedPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::StateIedPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::StateIedPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::StateIed >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::StateIedPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
StateIedPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
StateIedPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::StateIed";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
StateIedPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TargetData
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TargetDataPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TargetData *sample = new TargetData();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TargetData *
|
|
TargetDataPluginSupport_create_data(void)
|
|
{
|
|
return (TargetData *) TargetDataPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TargetDataPluginSupport_destroy_data(
|
|
TargetData *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TargetDataPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::TargetDataPluginSupport_destroy_data((TargetData *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TargetDataPluginSupport_copy_data(
|
|
TargetData *dst,
|
|
const TargetData *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
TargetDataPluginSupport_create_keyI(void)
|
|
{
|
|
return TargetDataPluginSupport_create_data();
|
|
}
|
|
|
|
TargetData *
|
|
TargetDataPluginSupport_create_key(void)
|
|
{
|
|
return (TargetData *) TargetDataPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
TargetDataPluginSupport_destroy_key(
|
|
TargetDataKeyHolder *key)
|
|
{
|
|
TargetDataPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
TargetDataPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::TargetDataPluginSupport_destroy_key((TargetDataKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TargetDataPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TargetData >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TargetDataPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
TargetDataPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
TargetDataPluginSupport_create_dataI,
|
|
TargetDataPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::TargetDataPluginSupport_create_keyI , ::TrainingAreaBase::TargetDataPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::TargetDataPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = TargetDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::TargetDataPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TargetDataPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TargetDataPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetData *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TargetDataPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TargetDataPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TargetData *dst,
|
|
const TargetData *src)
|
|
{
|
|
return ::TrainingAreaBase::TargetDataPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TargetDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TargetDataPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TargetData *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TargetData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetData,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
TargetDataPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetDataPlugin_deserialize_from_cdr_buffer(
|
|
TargetData *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TargetData >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetData,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
TargetDataPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
TargetDataPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool TargetDataPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetData **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TargetDataPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TargetDataPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
TargetDataPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetDataKeyHolder *dst,
|
|
const TargetData *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetDataPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetData *dst, const
|
|
TargetDataKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetDataPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
TargetData * sample = NULL;
|
|
sample = (TargetData *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *TargetDataPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::TargetDataPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::TargetDataPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::TargetDataPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::TargetDataPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TargetDataPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TargetDataPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TargetDataPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TargetDataPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
TargetDataPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
TargetDataPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::TargetDataPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::TargetData >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::TargetDataPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TargetDataPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TargetDataPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::TargetData";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TargetDataPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TrajectoryAdler
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TrajectoryAdlerPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TrajectoryAdler *sample = new TrajectoryAdler();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TrajectoryAdler *
|
|
TrajectoryAdlerPluginSupport_create_data(void)
|
|
{
|
|
return (TrajectoryAdler *) TrajectoryAdlerPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TrajectoryAdlerPluginSupport_destroy_data(
|
|
TrajectoryAdler *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TrajectoryAdlerPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::TrajectoryAdlerPluginSupport_destroy_data((TrajectoryAdler *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TrajectoryAdlerPluginSupport_copy_data(
|
|
TrajectoryAdler *dst,
|
|
const TrajectoryAdler *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TrajectoryAdlerPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TrajectoryAdler >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TrajectoryAdlerPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
TrajectoryAdlerPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
TrajectoryAdlerPluginSupport_create_dataI,
|
|
TrajectoryAdlerPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::TrajectoryAdlerPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TrajectoryAdlerPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TrajectoryAdlerPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TrajectoryAdler *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TrajectoryAdlerPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TrajectoryAdlerPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TrajectoryAdler *dst,
|
|
const TrajectoryAdler *src)
|
|
{
|
|
return ::TrainingAreaBase::TrajectoryAdlerPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TrajectoryAdlerPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TrajectoryAdlerPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TrajectoryAdler *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TrajectoryAdler >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TrajectoryAdler,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
TrajectoryAdlerPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TrajectoryAdlerPlugin_deserialize_from_cdr_buffer(
|
|
TrajectoryAdler *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< TrajectoryAdler >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TrajectoryAdler,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
TrajectoryAdlerPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
TrajectoryAdlerPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool TrajectoryAdlerPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TrajectoryAdler **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TrajectoryAdlerPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
TrajectoryAdlerPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *TrajectoryAdlerPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TrajectoryAdlerPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TrajectoryAdlerPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TrajectoryAdlerPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TrajectoryAdlerPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_get_key_kind;
|
|
|
|
/* These functions are only used for keyed types. As this is not a keyed
|
|
type they are all set to NULL
|
|
*/
|
|
plugin->serializeKeyFnc = NULL ;
|
|
plugin->deserializeKeyFnc = NULL;
|
|
plugin->getKeyFnc = NULL;
|
|
plugin->returnKeyFnc = NULL;
|
|
plugin->instanceToKeyFnc = NULL;
|
|
plugin->keyToInstanceFnc = NULL;
|
|
plugin->getSerializedKeyMaxSizeFnc = NULL;
|
|
plugin->instanceToKeyHashFnc = NULL;
|
|
plugin->serializedSampleToKeyHashFnc = NULL;
|
|
plugin->serializedKeyToKeyHashFnc = NULL;
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::TrajectoryAdler >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::TrajectoryAdlerPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TrajectoryAdlerPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TrajectoryAdlerPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::TrajectoryAdler";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TrajectoryAdlerPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type UASMissionStatus
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
UASMissionStatusPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
UASMissionStatus *sample = new UASMissionStatus();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
UASMissionStatus *
|
|
UASMissionStatusPluginSupport_create_data(void)
|
|
{
|
|
return (UASMissionStatus *) UASMissionStatusPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPluginSupport_destroy_data(
|
|
UASMissionStatus *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::UASMissionStatusPluginSupport_destroy_data((UASMissionStatus *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
UASMissionStatusPluginSupport_copy_data(
|
|
UASMissionStatus *dst,
|
|
const UASMissionStatus *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
UASMissionStatusPluginSupport_create_keyI(void)
|
|
{
|
|
return UASMissionStatusPluginSupport_create_data();
|
|
}
|
|
|
|
UASMissionStatus *
|
|
UASMissionStatusPluginSupport_create_key(void)
|
|
{
|
|
return (UASMissionStatus *) UASMissionStatusPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPluginSupport_destroy_key(
|
|
UASMissionStatusKeyHolder *key)
|
|
{
|
|
UASMissionStatusPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::UASMissionStatusPluginSupport_destroy_key((UASMissionStatusKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
UASMissionStatusPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASMissionStatus >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
UASMissionStatusPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
UASMissionStatusPluginSupport_create_dataI,
|
|
UASMissionStatusPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::UASMissionStatusPluginSupport_create_keyI , ::TrainingAreaBase::UASMissionStatusPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::UASMissionStatusPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = UASMissionStatusPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::UASMissionStatusPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASMissionStatus *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"UASMissionStatusPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
UASMissionStatusPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
UASMissionStatus *dst,
|
|
const UASMissionStatus *src)
|
|
{
|
|
return ::TrainingAreaBase::UASMissionStatusPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
UASMissionStatusPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
UASMissionStatusPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const UASMissionStatus *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASMissionStatus >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UASMissionStatus,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
UASMissionStatusPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASMissionStatusPlugin_deserialize_from_cdr_buffer(
|
|
UASMissionStatus *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASMissionStatus >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UASMissionStatus,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
UASMissionStatusPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
UASMissionStatusPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool UASMissionStatusPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASMissionStatus **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
UASMissionStatusPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
UASMissionStatusPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
UASMissionStatusPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASMissionStatusKeyHolder *dst,
|
|
const UASMissionStatus *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASMissionStatusPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASMissionStatus *dst, const
|
|
UASMissionStatusKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASMissionStatusPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
UASMissionStatus * sample = NULL;
|
|
sample = (UASMissionStatus *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *UASMissionStatusPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
UASMissionStatusPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
UASMissionStatusPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
UASMissionStatusPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
UASMissionStatusPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
UASMissionStatusPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
UASMissionStatusPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::UASMissionStatusPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::UASMissionStatus >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::UASMissionStatusPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
UASMissionStatusPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
UASMissionStatusPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::UASMissionStatus";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
UASMissionStatusPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type UASRadioLinkConnectionState
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
UASRadioLinkConnectionStatePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
UASRadioLinkConnectionState *sample = new UASRadioLinkConnectionState();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
UASRadioLinkConnectionState *
|
|
UASRadioLinkConnectionStatePluginSupport_create_data(void)
|
|
{
|
|
return (UASRadioLinkConnectionState *) UASRadioLinkConnectionStatePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePluginSupport_destroy_data(
|
|
UASRadioLinkConnectionState *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePluginSupport_destroy_data((UASRadioLinkConnectionState *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePluginSupport_copy_data(
|
|
UASRadioLinkConnectionState *dst,
|
|
const UASRadioLinkConnectionState *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
UASRadioLinkConnectionStatePluginSupport_create_keyI(void)
|
|
{
|
|
return UASRadioLinkConnectionStatePluginSupport_create_data();
|
|
}
|
|
|
|
UASRadioLinkConnectionState *
|
|
UASRadioLinkConnectionStatePluginSupport_create_key(void)
|
|
{
|
|
return (UASRadioLinkConnectionState *) UASRadioLinkConnectionStatePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePluginSupport_destroy_key(
|
|
UASRadioLinkConnectionStateKeyHolder *key)
|
|
{
|
|
UASRadioLinkConnectionStatePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePluginSupport_destroy_key((UASRadioLinkConnectionStateKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
UASRadioLinkConnectionStatePlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASRadioLinkConnectionState >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
UASRadioLinkConnectionStatePlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
UASRadioLinkConnectionStatePluginSupport_create_dataI,
|
|
UASRadioLinkConnectionStatePluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePluginSupport_create_keyI , ::TrainingAreaBase::UASRadioLinkConnectionStatePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = UASRadioLinkConnectionStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASRadioLinkConnectionState *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"UASRadioLinkConnectionStatePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
UASRadioLinkConnectionState *dst,
|
|
const UASRadioLinkConnectionState *src)
|
|
{
|
|
return ::TrainingAreaBase::UASRadioLinkConnectionStatePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
UASRadioLinkConnectionStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const UASRadioLinkConnectionState *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASRadioLinkConnectionState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UASRadioLinkConnectionState,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
UASRadioLinkConnectionStatePlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePlugin_deserialize_from_cdr_buffer(
|
|
UASRadioLinkConnectionState *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASRadioLinkConnectionState >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UASRadioLinkConnectionState,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
UASRadioLinkConnectionStatePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
UASRadioLinkConnectionStatePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool UASRadioLinkConnectionStatePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASRadioLinkConnectionState **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
UASRadioLinkConnectionStatePlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
UASRadioLinkConnectionStatePlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASRadioLinkConnectionStateKeyHolder *dst,
|
|
const UASRadioLinkConnectionState *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASRadioLinkConnectionState *dst, const
|
|
UASRadioLinkConnectionStateKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASRadioLinkConnectionStatePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
UASRadioLinkConnectionState * sample = NULL;
|
|
sample = (UASRadioLinkConnectionState *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *UASRadioLinkConnectionStatePlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
UASRadioLinkConnectionStatePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
UASRadioLinkConnectionStatePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
UASRadioLinkConnectionStatePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
UASRadioLinkConnectionStatePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
UASRadioLinkConnectionStatePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
UASRadioLinkConnectionStatePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::UASRadioLinkConnectionState >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::UASRadioLinkConnectionStatePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
UASRadioLinkConnectionStatePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
UASRadioLinkConnectionStatePlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::UASRadioLinkConnectionState";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
UASRadioLinkConnectionStatePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type UASStatus
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
UASStatusPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
UASStatus *sample = new UASStatus();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
UASStatus *
|
|
UASStatusPluginSupport_create_data(void)
|
|
{
|
|
return (UASStatus *) UASStatusPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
UASStatusPluginSupport_destroy_data(
|
|
UASStatus *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
UASStatusPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::TrainingAreaBase::UASStatusPluginSupport_destroy_data((UASStatus *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
UASStatusPluginSupport_copy_data(
|
|
UASStatus *dst,
|
|
const UASStatus *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
UASStatusPluginSupport_create_keyI(void)
|
|
{
|
|
return UASStatusPluginSupport_create_data();
|
|
}
|
|
|
|
UASStatus *
|
|
UASStatusPluginSupport_create_key(void)
|
|
{
|
|
return (UASStatus *) UASStatusPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
UASStatusPluginSupport_destroy_key(
|
|
UASStatusKeyHolder *key)
|
|
{
|
|
UASStatusPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
UASStatusPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::TrainingAreaBase::UASStatusPluginSupport_destroy_key((UASStatusKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
UASStatusPlugin_on_participant_attached(
|
|
void *registration_data,
|
|
const struct PRESTypePluginParticipantInfo *participant_info,
|
|
RTIBool top_level_registration,
|
|
void *container_plugin_context,
|
|
RTICdrTypeCode *type_code)
|
|
{
|
|
try {
|
|
struct RTIXCdrInterpreterPrograms *programs = NULL;
|
|
struct PRESTypePluginDefaultParticipantData *pd = NULL;
|
|
struct RTIXCdrInterpreterProgramsGenProperty programProperty =
|
|
RTIXCdrInterpreterProgramsGenProperty_INITIALIZER;
|
|
RTIOsapiUtility_unusedParameter(registration_data);
|
|
RTIOsapiUtility_unusedParameter(participant_info);
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(container_plugin_context);
|
|
RTIOsapiUtility_unusedParameter(type_code);
|
|
|
|
if (!RTIXCdrXTypesComplianceMask_verifyGeneratedXTypesMask(0x0000018C)) {
|
|
return NULL;
|
|
}
|
|
|
|
pd = (struct PRESTypePluginDefaultParticipantData *)
|
|
PRESTypePluginDefaultParticipantData_new(participant_info);
|
|
|
|
programProperty.generateV1Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.generateV2Encapsulation = RTI_XCDR_TRUE;
|
|
programProperty.resolveAlias = RTI_XCDR_TRUE;
|
|
programProperty.inlineStruct = RTI_XCDR_TRUE;
|
|
programProperty.optimizeEnum = RTI_XCDR_TRUE;
|
|
programProperty.unboundedSize = RTIXCdrLong_MAX;
|
|
|
|
programProperty.externalReferenceSize =
|
|
(RTIXCdrUnsignedShort) sizeof(::dds::core::external<char>);
|
|
programProperty.getExternalRefPointerFcn =
|
|
::rti::topic::interpreter::get_external_value_pointer;
|
|
|
|
programs = DDS_TypeCodeFactory_assert_programs_in_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
(DDS_TypeCode *) (RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASStatus >::get().native()
|
|
,
|
|
&programProperty,
|
|
RTI_XCDR_PROGRAM_MASK_TYPEPLUGIN);
|
|
|
|
if (programs == NULL) {
|
|
PRESTypePluginDefaultParticipantData_delete(
|
|
(PRESTypePluginParticipantData)pd);
|
|
return NULL;
|
|
}
|
|
|
|
pd->programs = programs;
|
|
return (PRESTypePluginParticipantData)pd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UASStatusPlugin_on_participant_detached(
|
|
PRESTypePluginParticipantData participant_data)
|
|
{
|
|
if (participant_data != NULL) {
|
|
struct PRESTypePluginDefaultParticipantData *pd =
|
|
(struct PRESTypePluginDefaultParticipantData *)participant_data;
|
|
|
|
if (pd->programs != NULL) {
|
|
DDS_TypeCodeFactory_remove_programs_from_global_list(
|
|
DDS_TypeCodeFactory_get_instance(),
|
|
pd->programs);
|
|
pd->programs = NULL;
|
|
}
|
|
PRESTypePluginDefaultParticipantData_delete(participant_data);
|
|
}
|
|
}
|
|
|
|
PRESTypePluginEndpointData
|
|
UASStatusPlugin_on_endpoint_attached(
|
|
PRESTypePluginParticipantData participant_data,
|
|
const struct PRESTypePluginEndpointInfo *endpoint_info,
|
|
RTIBool top_level_registration,
|
|
void *containerPluginContext)
|
|
{
|
|
try {
|
|
PRESTypePluginEndpointData epd = NULL;
|
|
unsigned int serializedSampleMaxSize = 0;
|
|
|
|
unsigned int serializedKeyMaxSize = 0;
|
|
unsigned int serializedKeyMaxSizeV2 = 0;
|
|
|
|
RTIOsapiUtility_unusedParameter(top_level_registration);
|
|
RTIOsapiUtility_unusedParameter(containerPluginContext);
|
|
|
|
if (participant_data == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
epd = PRESTypePluginDefaultEndpointData_new(
|
|
participant_data,
|
|
endpoint_info,
|
|
UASStatusPluginSupport_create_dataI,
|
|
UASStatusPluginSupport_destroy_dataI,
|
|
::TrainingAreaBase::UASStatusPluginSupport_create_keyI , ::TrainingAreaBase::UASStatusPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::TrainingAreaBase::UASStatusPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = UASStatusPlugin_get_serialized_key_max_size_for_keyhash(
|
|
epd,
|
|
RTI_CDR_ENCAPSULATION_ID_CDR2_BE,
|
|
0);
|
|
|
|
if(!PRESTypePluginDefaultEndpointData_createMD5StreamWithInfo(
|
|
epd,
|
|
endpoint_info,
|
|
serializedKeyMaxSize,
|
|
serializedKeyMaxSizeV2))
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::TrainingAreaBase::UASStatusPlugin_get_serialized_sample_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
PRESTypePluginDefaultEndpointData_setMaxSizeSerializedSample(epd, serializedSampleMaxSize);
|
|
|
|
if (PRESTypePluginDefaultEndpointData_createWriterPool(
|
|
epd,
|
|
endpoint_info,
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UASStatusPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
UASStatusPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASStatus *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"UASStatusPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
UASStatusPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
UASStatus *dst,
|
|
const UASStatus *src)
|
|
{
|
|
return ::TrainingAreaBase::UASStatusPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
UASStatusPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
UASStatusPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const UASStatus *sample,
|
|
::dds::core::policy::DataRepresentationId representation)
|
|
{
|
|
using namespace ::dds::core::policy;
|
|
|
|
try{
|
|
RTIEncapsulationId encapsulationId = RTI_CDR_ENCAPSULATION_ID_INVALID;
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
RTIBool result;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin = PRES_TYPEPLUGIN_DEFAULT;
|
|
|
|
if (length == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
RTIOsapiMemory_zero(&epd, sizeof(struct PRESTypePluginDefaultEndpointData));
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASStatus >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UASStatus,
|
|
true, true, true>();
|
|
|
|
encapsulationId = DDS_TypeCode_get_native_encapsulation(
|
|
(DDS_TypeCode *) plugin.typeCode,
|
|
representation);
|
|
|
|
if (encapsulationId == RTI_CDR_ENCAPSULATION_ID_INVALID) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
epd._maxSizeSerializedSample =
|
|
UASStatusPlugin_get_serialized_sample_max_size(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0);
|
|
|
|
if (buffer == NULL) {
|
|
*length =
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
0,
|
|
sample);
|
|
|
|
if (*length == 0) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
RTICdrStream_set(&cdrStream, buffer, *length);
|
|
|
|
result = PRESTypePlugin_interpretedSerialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
encapsulationId,
|
|
RTI_TRUE,
|
|
NULL);
|
|
|
|
*length = (unsigned int) RTICdrStream_getCurrentPositionOffset(&cdrStream);
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASStatusPlugin_deserialize_from_cdr_buffer(
|
|
UASStatus *sample,
|
|
const char * buffer,
|
|
unsigned int length)
|
|
{
|
|
struct RTICdrStream cdrStream;
|
|
struct PRESTypePluginDefaultParticipantData pd;
|
|
struct RTIXCdrTypePluginProgramContext defaultProgramContext =
|
|
RTIXCdrTypePluginProgramContext_INTIALIZER;
|
|
struct PRESTypePlugin plugin;
|
|
struct PRESTypePluginDefaultEndpointData epd;
|
|
|
|
RTICdrStream_init(&cdrStream);
|
|
/*
|
|
* The buffer is constant because this is a deserialization function
|
|
* (the buffer is an input parameter, not an output parameter).
|
|
* However, the buffer member in the stream is a (char *) so coverity
|
|
* complains in case something else modifies the buffer's contents later.
|
|
*
|
|
* We don't currently have a stream type with a constant buffer.
|
|
* Therefore, we suppress the warning after making sure that this function
|
|
* doesn't modify the contents of the stream's buffer.
|
|
*/
|
|
/* coverity[cert_exp40_c_violation : FALSE] */
|
|
RTICdrStream_set(&cdrStream, (char *) buffer, length);
|
|
|
|
epd.programContext = defaultProgramContext;
|
|
epd._participantData = &pd;
|
|
epd.typePlugin = &plugin;
|
|
epd.programContext.endpointPluginData = &epd;
|
|
try {
|
|
plugin.typeCode = (struct RTICdrTypeCode *)
|
|
(RTIXCdrTypeCode *)&::rti::topic::dynamic_type< UASStatus >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UASStatus,
|
|
true, true, true>();
|
|
|
|
RTIXCdrSampleAssignabilityProperty_setFromGlobalComplianceMask(
|
|
&epd._assignabilityProperty);
|
|
|
|
::rti::topic::reset_sample(*sample);
|
|
|
|
return PRESTypePlugin_interpretedDeserialize(
|
|
(PRESTypePluginEndpointData)&epd,
|
|
sample,
|
|
&cdrStream,
|
|
RTI_TRUE,
|
|
RTI_TRUE,
|
|
NULL);
|
|
}
|
|
|
|
unsigned int
|
|
UASStatusPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedSampleMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* --------------------------------------------------------------------------------------
|
|
Key Management functions:
|
|
* -------------------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginKeyKind
|
|
UASStatusPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool UASStatusPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASStatus **sample,
|
|
RTIBool * drop_sample,
|
|
struct RTICdrStream *cdrStream,
|
|
RTIBool deserialize_encapsulation,
|
|
RTIBool deserialize_key,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
try {
|
|
RTIBool result;
|
|
RTIOsapiUtility_unusedParameter(drop_sample);
|
|
cdrStream->_xTypesState.unassignable = RTI_FALSE;
|
|
/* This is code generated without the interpreter that is deprecated and
|
|
should not be used */
|
|
/* coverity[var_deref_model : FALSE] */
|
|
result= PRESTypePlugin_interpretedDeserializeKey(
|
|
endpoint_data, (sample != NULL)?*sample:NULL, cdrStream,
|
|
deserialize_encapsulation, deserialize_key, endpoint_plugin_qos);
|
|
if (result) {
|
|
if (cdrStream->_xTypesState.unassignable) {
|
|
result = RTI_FALSE;
|
|
}
|
|
}
|
|
return result;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
UASStatusPlugin_get_serialized_key_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
try {
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSize(
|
|
endpoint_data,&overflow,include_encapsulation,encapsulation_id,current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
unsigned int
|
|
UASStatusPlugin_get_serialized_key_max_size_for_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment)
|
|
{
|
|
unsigned int size;
|
|
RTIBool overflow = RTI_FALSE;
|
|
|
|
size = PRESTypePlugin_interpretedGetSerializedKeyMaxSizeForKeyhash(
|
|
endpoint_data,
|
|
&overflow,
|
|
encapsulation_id,
|
|
current_alignment);
|
|
if (overflow) {
|
|
size = RTI_CDR_MAX_SERIALIZED_SIZE;
|
|
}
|
|
|
|
return size;
|
|
}
|
|
|
|
RTIBool
|
|
UASStatusPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASStatusKeyHolder *dst,
|
|
const UASStatus *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_instance_to_key(endpoint_data,(::TrainingAreaBase::EquipmentBase *)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASStatusPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UASStatus *dst, const
|
|
UASStatusKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::TrainingAreaBase::EquipmentBasePlugin_key_to_instance(endpoint_data,(::TrainingAreaBase::EquipmentBase*)dst,(const ::TrainingAreaBase::EquipmentBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UASStatusPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
UASStatus * sample = NULL;
|
|
sample = (UASStatus *)
|
|
PRESTypePluginDefaultEndpointData_getTempSample(endpoint_data);
|
|
if (sample == NULL) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedSerializedSampleToKey(
|
|
endpoint_data,
|
|
sample,
|
|
cdrStream,
|
|
deserialize_encapsulation,
|
|
RTI_TRUE,
|
|
endpoint_plugin_qos)) {
|
|
return RTI_FALSE;
|
|
}
|
|
if (!PRESTypePlugin_interpretedInstanceToKeyHash(
|
|
endpoint_data,
|
|
keyhash,
|
|
sample,
|
|
RTICdrStream_getEncapsulationKind(cdrStream))) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ------------------------------------------------------------------------
|
|
* Plug-in Installation Methods
|
|
* ------------------------------------------------------------------------ */
|
|
struct PRESTypePlugin *UASStatusPlugin_new(void)
|
|
{
|
|
struct PRESTypePlugin *plugin = NULL;
|
|
const struct PRESTypePluginVersion PLUGIN_VERSION =
|
|
PRES_TYPE_PLUGIN_VERSION_2_0;
|
|
|
|
RTIOsapiHeap_allocateStructure(
|
|
&plugin, struct PRESTypePlugin);
|
|
if (plugin == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
plugin->version = PLUGIN_VERSION;
|
|
|
|
/* set up parent's function pointers */
|
|
plugin->onParticipantAttached =
|
|
(PRESTypePluginOnParticipantAttachedCallback)
|
|
::TrainingAreaBase::UASStatusPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::TrainingAreaBase::UASStatusPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::TrainingAreaBase::UASStatusPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::TrainingAreaBase::UASStatusPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
UASStatusPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
UASStatusPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
UASStatusPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
UASStatusPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
UASStatusPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
UASStatusPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::TrainingAreaBase::UASStatusPlugin_key_to_instance;
|
|
plugin->serializedKeyToKeyHashFnc = NULL; /* Not supported yet */
|
|
#ifdef NDDS_STANDALONE_TYPE
|
|
plugin->typeCode = NULL;
|
|
#else
|
|
try {
|
|
plugin->typeCode = (struct RTICdrTypeCode *)
|
|
&::rti::topic::dynamic_type< ::TrainingAreaBase::UASStatus >::get().native();
|
|
} catch (...) {
|
|
::TrainingAreaBase::UASStatusPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
UASStatusPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
UASStatusPlugin_return_buffer;
|
|
plugin->getBufferWithParams = NULL;
|
|
plugin->returnBufferWithParams = NULL;
|
|
plugin->getSerializedSampleSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize;
|
|
|
|
plugin->getWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFnc = NULL;
|
|
plugin->returnWriterLoanedSampleFromCookieFnc = NULL;
|
|
plugin->validateWriterLoanedSampleFnc = NULL;
|
|
plugin->setWriterLoanedSampleSerializedStateFnc = NULL;
|
|
|
|
static const char * TYPE_NAME = "TrainingAreaBase::UASStatus";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
UASStatusPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
} /* namespace TrainingAreaBase */
|
|
|
|
#undef RTI_CDR_CURRENT_SUBMODULE
|