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>
24964 lines
881 KiB
C++
24964 lines
881 KiB
C++
|
|
|
|
/*
|
|
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
|
|
|
|
This file was generated from pdm.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 "pdmPlugin.hpp"
|
|
|
|
#include <ProjectDataManagement/pdm_export.h> // #define NDDSUSERDllExport for linux
|
|
#include "pdm_enums.hpp"
|
|
#include </workspace/qt-migration-legatus/qt6-after/qt6-migrated-legatus/build4/Lts/DDS/Core/core.hpp>
|
|
namespace ProjectDataManagement {
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type PdmBase
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
PdmBasePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
PdmBase *sample = new PdmBase();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
PdmBase *
|
|
PdmBasePluginSupport_create_data(void)
|
|
{
|
|
return (PdmBase *) PdmBasePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
PdmBasePluginSupport_destroy_data(
|
|
PdmBase *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
PdmBasePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::PdmBasePluginSupport_destroy_data((PdmBase *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
PdmBasePluginSupport_copy_data(
|
|
PdmBase *dst,
|
|
const PdmBase *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
PdmBasePluginSupport_create_keyI(void)
|
|
{
|
|
return PdmBasePluginSupport_create_data();
|
|
}
|
|
|
|
PdmBase *
|
|
PdmBasePluginSupport_create_key(void)
|
|
{
|
|
return (PdmBase *) PdmBasePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
PdmBasePluginSupport_destroy_key(
|
|
PdmBaseKeyHolder *key)
|
|
{
|
|
PdmBasePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
PdmBasePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::PdmBasePluginSupport_destroy_key((PdmBaseKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
PdmBasePlugin_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< PdmBase >::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
|
|
PdmBasePlugin_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
|
|
PdmBasePlugin_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,
|
|
PdmBasePluginSupport_create_dataI,
|
|
PdmBasePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::PdmBasePluginSupport_create_keyI , ::ProjectDataManagement::PdmBasePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::PdmBasePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = PdmBasePlugin_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 = ::ProjectDataManagement::PdmBasePlugin_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)
|
|
::ProjectDataManagement::PdmBasePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
PdmBasePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
PdmBasePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBase *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"PdmBasePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
PdmBasePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
PdmBase *dst,
|
|
const PdmBase *src)
|
|
{
|
|
return ::ProjectDataManagement::PdmBasePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
PdmBasePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
PdmBasePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const PdmBase *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< PdmBase >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
PdmBase,
|
|
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 =
|
|
PdmBasePlugin_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
|
|
PdmBasePlugin_deserialize_from_cdr_buffer(
|
|
PdmBase *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< PdmBase >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
PdmBase,
|
|
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
|
|
PdmBasePlugin_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
|
|
PdmBasePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool PdmBasePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBase **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
|
|
PdmBasePlugin_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
|
|
PdmBasePlugin_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
|
|
PdmBasePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBaseKeyHolder *dst,
|
|
const PdmBase *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
|
|
dst->id = src->id;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
PdmBasePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBase *dst, const
|
|
PdmBaseKeyHolder *src)
|
|
{
|
|
try {
|
|
RTIOsapiUtility_unusedParameter(endpoint_data);
|
|
dst->id = src->id;
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
PdmBasePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
PdmBase * sample = NULL;
|
|
sample = (PdmBase *)
|
|
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 *PdmBasePlugin_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)
|
|
::ProjectDataManagement::PdmBasePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::PdmBasePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::PdmBasePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::PdmBasePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
PdmBasePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
PdmBasePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
PdmBasePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
PdmBasePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
PdmBasePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
PdmBasePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::PdmBasePlugin_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< ::ProjectDataManagement::PdmBase >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::PdmBasePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
PdmBasePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
PdmBasePlugin_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 = "ProjectDataManagement::PdmBase";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
PdmBasePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type PdmBaseName
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
PdmBaseNamePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
PdmBaseName *sample = new PdmBaseName();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
PdmBaseName *
|
|
PdmBaseNamePluginSupport_create_data(void)
|
|
{
|
|
return (PdmBaseName *) PdmBaseNamePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePluginSupport_destroy_data(
|
|
PdmBaseName *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::PdmBaseNamePluginSupport_destroy_data((PdmBaseName *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
PdmBaseNamePluginSupport_copy_data(
|
|
PdmBaseName *dst,
|
|
const PdmBaseName *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
PdmBaseNamePluginSupport_create_keyI(void)
|
|
{
|
|
return PdmBaseNamePluginSupport_create_data();
|
|
}
|
|
|
|
PdmBaseName *
|
|
PdmBaseNamePluginSupport_create_key(void)
|
|
{
|
|
return (PdmBaseName *) PdmBaseNamePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePluginSupport_destroy_key(
|
|
PdmBaseNameKeyHolder *key)
|
|
{
|
|
PdmBaseNamePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::PdmBaseNamePluginSupport_destroy_key((PdmBaseNameKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
PdmBaseNamePlugin_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< PdmBaseName >::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
|
|
PdmBaseNamePlugin_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
|
|
PdmBaseNamePlugin_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,
|
|
PdmBaseNamePluginSupport_create_dataI,
|
|
PdmBaseNamePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::PdmBaseNamePluginSupport_create_keyI , ::ProjectDataManagement::PdmBaseNamePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::PdmBaseNamePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = PdmBaseNamePlugin_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 = ::ProjectDataManagement::PdmBaseNamePlugin_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)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBaseName *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"PdmBaseNamePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
PdmBaseNamePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
PdmBaseName *dst,
|
|
const PdmBaseName *src)
|
|
{
|
|
return ::ProjectDataManagement::PdmBaseNamePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
PdmBaseNamePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
PdmBaseNamePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const PdmBaseName *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< PdmBaseName >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
PdmBaseName,
|
|
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 =
|
|
PdmBaseNamePlugin_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
|
|
PdmBaseNamePlugin_deserialize_from_cdr_buffer(
|
|
PdmBaseName *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< PdmBaseName >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
PdmBaseName,
|
|
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
|
|
PdmBaseNamePlugin_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
|
|
PdmBaseNamePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool PdmBaseNamePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBaseName **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
|
|
PdmBaseNamePlugin_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
|
|
PdmBaseNamePlugin_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
|
|
PdmBaseNamePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBaseNameKeyHolder *dst,
|
|
const PdmBaseName *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
PdmBaseNamePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
PdmBaseName *dst, const
|
|
PdmBaseNameKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
PdmBaseNamePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
PdmBaseName * sample = NULL;
|
|
sample = (PdmBaseName *)
|
|
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 *PdmBaseNamePlugin_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)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
PdmBaseNamePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
PdmBaseNamePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
PdmBaseNamePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
PdmBaseNamePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
PdmBaseNamePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
PdmBaseNamePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::PdmBaseNamePlugin_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< ::ProjectDataManagement::PdmBaseName >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::PdmBaseNamePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
PdmBaseNamePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
PdmBaseNamePlugin_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 = "ProjectDataManagement::PdmBaseName";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
PdmBaseNamePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type BiteComponentText
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
BiteComponentTextPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
BiteComponentText *sample = new BiteComponentText();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
BiteComponentText *
|
|
BiteComponentTextPluginSupport_create_data(void)
|
|
{
|
|
return (BiteComponentText *) BiteComponentTextPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPluginSupport_destroy_data(
|
|
BiteComponentText *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::BiteComponentTextPluginSupport_destroy_data((BiteComponentText *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
BiteComponentTextPluginSupport_copy_data(
|
|
BiteComponentText *dst,
|
|
const BiteComponentText *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
BiteComponentTextPluginSupport_create_keyI(void)
|
|
{
|
|
return BiteComponentTextPluginSupport_create_data();
|
|
}
|
|
|
|
BiteComponentText *
|
|
BiteComponentTextPluginSupport_create_key(void)
|
|
{
|
|
return (BiteComponentText *) BiteComponentTextPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPluginSupport_destroy_key(
|
|
BiteComponentTextKeyHolder *key)
|
|
{
|
|
BiteComponentTextPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::BiteComponentTextPluginSupport_destroy_key((BiteComponentTextKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
BiteComponentTextPlugin_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< BiteComponentText >::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
|
|
BiteComponentTextPlugin_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
|
|
BiteComponentTextPlugin_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,
|
|
BiteComponentTextPluginSupport_create_dataI,
|
|
BiteComponentTextPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::BiteComponentTextPluginSupport_create_keyI , ::ProjectDataManagement::BiteComponentTextPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::BiteComponentTextPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = BiteComponentTextPlugin_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 = ::ProjectDataManagement::BiteComponentTextPlugin_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)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BiteComponentText *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"BiteComponentTextPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
BiteComponentTextPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
BiteComponentText *dst,
|
|
const BiteComponentText *src)
|
|
{
|
|
return ::ProjectDataManagement::BiteComponentTextPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
BiteComponentTextPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
BiteComponentTextPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const BiteComponentText *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< BiteComponentText >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BiteComponentText,
|
|
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 =
|
|
BiteComponentTextPlugin_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
|
|
BiteComponentTextPlugin_deserialize_from_cdr_buffer(
|
|
BiteComponentText *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< BiteComponentText >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BiteComponentText,
|
|
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
|
|
BiteComponentTextPlugin_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
|
|
BiteComponentTextPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool BiteComponentTextPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BiteComponentText **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
|
|
BiteComponentTextPlugin_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
|
|
BiteComponentTextPlugin_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
|
|
BiteComponentTextPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BiteComponentTextKeyHolder *dst,
|
|
const BiteComponentText *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BiteComponentTextPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BiteComponentText *dst, const
|
|
BiteComponentTextKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BiteComponentTextPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
BiteComponentText * sample = NULL;
|
|
sample = (BiteComponentText *)
|
|
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 *BiteComponentTextPlugin_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)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
BiteComponentTextPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
BiteComponentTextPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
BiteComponentTextPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
BiteComponentTextPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
BiteComponentTextPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
BiteComponentTextPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::BiteComponentTextPlugin_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< ::ProjectDataManagement::BiteComponentText >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::BiteComponentTextPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
BiteComponentTextPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
BiteComponentTextPlugin_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 = "ProjectDataManagement::BiteComponentText";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
BiteComponentTextPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type BuildingChargeEffect
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
BuildingChargeEffectPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
BuildingChargeEffect *sample = new BuildingChargeEffect();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
BuildingChargeEffect *
|
|
BuildingChargeEffectPluginSupport_create_data(void)
|
|
{
|
|
return (BuildingChargeEffect *) BuildingChargeEffectPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPluginSupport_destroy_data(
|
|
BuildingChargeEffect *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::BuildingChargeEffectPluginSupport_destroy_data((BuildingChargeEffect *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
BuildingChargeEffectPluginSupport_copy_data(
|
|
BuildingChargeEffect *dst,
|
|
const BuildingChargeEffect *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
BuildingChargeEffectPluginSupport_create_keyI(void)
|
|
{
|
|
return BuildingChargeEffectPluginSupport_create_data();
|
|
}
|
|
|
|
BuildingChargeEffect *
|
|
BuildingChargeEffectPluginSupport_create_key(void)
|
|
{
|
|
return (BuildingChargeEffect *) BuildingChargeEffectPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPluginSupport_destroy_key(
|
|
BuildingChargeEffectKeyHolder *key)
|
|
{
|
|
BuildingChargeEffectPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::BuildingChargeEffectPluginSupport_destroy_key((BuildingChargeEffectKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
BuildingChargeEffectPlugin_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< BuildingChargeEffect >::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
|
|
BuildingChargeEffectPlugin_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
|
|
BuildingChargeEffectPlugin_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,
|
|
BuildingChargeEffectPluginSupport_create_dataI,
|
|
BuildingChargeEffectPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::BuildingChargeEffectPluginSupport_create_keyI , ::ProjectDataManagement::BuildingChargeEffectPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::BuildingChargeEffectPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = BuildingChargeEffectPlugin_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 = ::ProjectDataManagement::BuildingChargeEffectPlugin_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)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BuildingChargeEffect *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"BuildingChargeEffectPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
BuildingChargeEffectPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
BuildingChargeEffect *dst,
|
|
const BuildingChargeEffect *src)
|
|
{
|
|
return ::ProjectDataManagement::BuildingChargeEffectPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
BuildingChargeEffectPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
BuildingChargeEffectPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const BuildingChargeEffect *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< BuildingChargeEffect >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BuildingChargeEffect,
|
|
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 =
|
|
BuildingChargeEffectPlugin_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
|
|
BuildingChargeEffectPlugin_deserialize_from_cdr_buffer(
|
|
BuildingChargeEffect *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< BuildingChargeEffect >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
BuildingChargeEffect,
|
|
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
|
|
BuildingChargeEffectPlugin_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
|
|
BuildingChargeEffectPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool BuildingChargeEffectPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BuildingChargeEffect **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
|
|
BuildingChargeEffectPlugin_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
|
|
BuildingChargeEffectPlugin_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
|
|
BuildingChargeEffectPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BuildingChargeEffectKeyHolder *dst,
|
|
const BuildingChargeEffect *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BuildingChargeEffectPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
BuildingChargeEffect *dst, const
|
|
BuildingChargeEffectKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
BuildingChargeEffectPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
BuildingChargeEffect * sample = NULL;
|
|
sample = (BuildingChargeEffect *)
|
|
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 *BuildingChargeEffectPlugin_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)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
BuildingChargeEffectPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
BuildingChargeEffectPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
BuildingChargeEffectPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
BuildingChargeEffectPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
BuildingChargeEffectPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
BuildingChargeEffectPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_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< ::ProjectDataManagement::BuildingChargeEffect >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::BuildingChargeEffectPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
BuildingChargeEffectPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
BuildingChargeEffectPlugin_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 = "ProjectDataManagement::BuildingChargeEffect";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
BuildingChargeEffectPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type CanComponentString
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
CanComponentStringPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
CanComponentString *sample = new CanComponentString();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
CanComponentString *
|
|
CanComponentStringPluginSupport_create_data(void)
|
|
{
|
|
return (CanComponentString *) CanComponentStringPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
CanComponentStringPluginSupport_destroy_data(
|
|
CanComponentString *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
CanComponentStringPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::CanComponentStringPluginSupport_destroy_data((CanComponentString *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
CanComponentStringPluginSupport_copy_data(
|
|
CanComponentString *dst,
|
|
const CanComponentString *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
CanComponentStringPluginSupport_create_keyI(void)
|
|
{
|
|
return CanComponentStringPluginSupport_create_data();
|
|
}
|
|
|
|
CanComponentString *
|
|
CanComponentStringPluginSupport_create_key(void)
|
|
{
|
|
return (CanComponentString *) CanComponentStringPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
CanComponentStringPluginSupport_destroy_key(
|
|
CanComponentStringKeyHolder *key)
|
|
{
|
|
CanComponentStringPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
CanComponentStringPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::CanComponentStringPluginSupport_destroy_key((CanComponentStringKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
CanComponentStringPlugin_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< CanComponentString >::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
|
|
CanComponentStringPlugin_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
|
|
CanComponentStringPlugin_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,
|
|
CanComponentStringPluginSupport_create_dataI,
|
|
CanComponentStringPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::CanComponentStringPluginSupport_create_keyI , ::ProjectDataManagement::CanComponentStringPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::CanComponentStringPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = CanComponentStringPlugin_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 = ::ProjectDataManagement::CanComponentStringPlugin_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)
|
|
::ProjectDataManagement::CanComponentStringPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
CanComponentStringPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
CanComponentStringPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CanComponentString *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"CanComponentStringPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
CanComponentStringPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
CanComponentString *dst,
|
|
const CanComponentString *src)
|
|
{
|
|
return ::ProjectDataManagement::CanComponentStringPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
CanComponentStringPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
CanComponentStringPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const CanComponentString *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< CanComponentString >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
CanComponentString,
|
|
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 =
|
|
CanComponentStringPlugin_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
|
|
CanComponentStringPlugin_deserialize_from_cdr_buffer(
|
|
CanComponentString *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< CanComponentString >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
CanComponentString,
|
|
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
|
|
CanComponentStringPlugin_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
|
|
CanComponentStringPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool CanComponentStringPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CanComponentString **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
|
|
CanComponentStringPlugin_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
|
|
CanComponentStringPlugin_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
|
|
CanComponentStringPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CanComponentStringKeyHolder *dst,
|
|
const CanComponentString *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
CanComponentStringPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CanComponentString *dst, const
|
|
CanComponentStringKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
CanComponentStringPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
CanComponentString * sample = NULL;
|
|
sample = (CanComponentString *)
|
|
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 *CanComponentStringPlugin_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)
|
|
::ProjectDataManagement::CanComponentStringPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::CanComponentStringPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::CanComponentStringPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::CanComponentStringPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
CanComponentStringPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
CanComponentStringPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
CanComponentStringPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
CanComponentStringPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
CanComponentStringPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
CanComponentStringPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::CanComponentStringPlugin_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< ::ProjectDataManagement::CanComponentString >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::CanComponentStringPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
CanComponentStringPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
CanComponentStringPlugin_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 = "ProjectDataManagement::CanComponentString";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
CanComponentStringPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type CasEffect
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
CasEffectPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
CasEffect *sample = new CasEffect();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
CasEffect *
|
|
CasEffectPluginSupport_create_data(void)
|
|
{
|
|
return (CasEffect *) CasEffectPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
CasEffectPluginSupport_destroy_data(
|
|
CasEffect *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
CasEffectPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::CasEffectPluginSupport_destroy_data((CasEffect *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
CasEffectPluginSupport_copy_data(
|
|
CasEffect *dst,
|
|
const CasEffect *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
CasEffectPlugin_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< CasEffect >::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
|
|
CasEffectPlugin_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
|
|
CasEffectPlugin_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,
|
|
CasEffectPluginSupport_create_dataI,
|
|
CasEffectPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::ProjectDataManagement::CasEffectPlugin_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)
|
|
::ProjectDataManagement::CasEffectPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
CasEffectPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
CasEffectPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CasEffect *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"CasEffectPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
CasEffectPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
CasEffect *dst,
|
|
const CasEffect *src)
|
|
{
|
|
return ::ProjectDataManagement::CasEffectPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
CasEffectPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
CasEffectPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const CasEffect *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< CasEffect >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
CasEffect,
|
|
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 =
|
|
CasEffectPlugin_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
|
|
CasEffectPlugin_deserialize_from_cdr_buffer(
|
|
CasEffect *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< CasEffect >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
CasEffect,
|
|
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
|
|
CasEffectPlugin_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
|
|
CasEffectPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool CasEffectPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
CasEffect **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
|
|
CasEffectPlugin_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
|
|
CasEffectPlugin_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 *CasEffectPlugin_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)
|
|
::ProjectDataManagement::CasEffectPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::CasEffectPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::CasEffectPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::CasEffectPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::CasEffectPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
CasEffectPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
CasEffectPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::CasEffectPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
CasEffectPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
CasEffectPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::CasEffectPlugin_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< ::ProjectDataManagement::CasEffect >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::CasEffectPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
CasEffectPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
CasEffectPlugin_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 = "ProjectDataManagement::CasEffect";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
CasEffectPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ChargeType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ChargeTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ChargeType *sample = new ChargeType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ChargeType *
|
|
ChargeTypePluginSupport_create_data(void)
|
|
{
|
|
return (ChargeType *) ChargeTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ChargeTypePluginSupport_destroy_data(
|
|
ChargeType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ChargeTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::ChargeTypePluginSupport_destroy_data((ChargeType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypePluginSupport_copy_data(
|
|
ChargeType *dst,
|
|
const ChargeType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ChargeTypePluginSupport_create_keyI(void)
|
|
{
|
|
return ChargeTypePluginSupport_create_data();
|
|
}
|
|
|
|
ChargeType *
|
|
ChargeTypePluginSupport_create_key(void)
|
|
{
|
|
return (ChargeType *) ChargeTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ChargeTypePluginSupport_destroy_key(
|
|
ChargeTypeKeyHolder *key)
|
|
{
|
|
ChargeTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ChargeTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::ChargeTypePluginSupport_destroy_key((ChargeTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ChargeTypePlugin_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< ChargeType >::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
|
|
ChargeTypePlugin_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
|
|
ChargeTypePlugin_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,
|
|
ChargeTypePluginSupport_create_dataI,
|
|
ChargeTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::ChargeTypePluginSupport_create_keyI , ::ProjectDataManagement::ChargeTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::ChargeTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ChargeTypePlugin_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 = ::ProjectDataManagement::ChargeTypePlugin_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)
|
|
::ProjectDataManagement::ChargeTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ChargeTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ChargeTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ChargeTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ChargeType *dst,
|
|
const ChargeType *src)
|
|
{
|
|
return ::ProjectDataManagement::ChargeTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ChargeTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ChargeTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ChargeType *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< ChargeType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ChargeType,
|
|
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 =
|
|
ChargeTypePlugin_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
|
|
ChargeTypePlugin_deserialize_from_cdr_buffer(
|
|
ChargeType *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< ChargeType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ChargeType,
|
|
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
|
|
ChargeTypePlugin_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
|
|
ChargeTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ChargeTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeType **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
|
|
ChargeTypePlugin_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
|
|
ChargeTypePlugin_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
|
|
ChargeTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeKeyHolder *dst,
|
|
const ChargeType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeType *dst, const
|
|
ChargeTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ChargeType * sample = NULL;
|
|
sample = (ChargeType *)
|
|
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 *ChargeTypePlugin_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)
|
|
::ProjectDataManagement::ChargeTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::ChargeTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::ChargeTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::ChargeTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ChargeTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ChargeTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ChargeTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ChargeTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ChargeTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ChargeTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::ChargeTypePlugin_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< ::ProjectDataManagement::ChargeType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::ChargeTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ChargeTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ChargeTypePlugin_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 = "ProjectDataManagement::ChargeType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ChargeTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ChargeTypeIgniterTypeIgniterFunction
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ChargeTypeIgniterTypeIgniterFunction *sample = new ChargeTypeIgniterTypeIgniterFunction();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ChargeTypeIgniterTypeIgniterFunction *
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_data(void)
|
|
{
|
|
return (ChargeTypeIgniterTypeIgniterFunction *) ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_data(
|
|
ChargeTypeIgniterTypeIgniterFunction *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_data((ChargeTypeIgniterTypeIgniterFunction *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_copy_data(
|
|
ChargeTypeIgniterTypeIgniterFunction *dst,
|
|
const ChargeTypeIgniterTypeIgniterFunction *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_keyI(void)
|
|
{
|
|
return ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_data();
|
|
}
|
|
|
|
ChargeTypeIgniterTypeIgniterFunction *
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_key(void)
|
|
{
|
|
return (ChargeTypeIgniterTypeIgniterFunction *) ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_key(
|
|
ChargeTypeIgniterTypeIgniterFunctionKeyHolder *key)
|
|
{
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_key((ChargeTypeIgniterTypeIgniterFunctionKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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< ChargeTypeIgniterTypeIgniterFunction >::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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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,
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_dataI,
|
|
ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPluginSupport_create_keyI , ::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ChargeTypeIgniterTypeIgniterFunctionPlugin_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 = ::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_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)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeIgniterTypeIgniterFunction *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ChargeTypeIgniterTypeIgniterFunctionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ChargeTypeIgniterTypeIgniterFunction *dst,
|
|
const ChargeTypeIgniterTypeIgniterFunction *src)
|
|
{
|
|
return ::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ChargeTypeIgniterTypeIgniterFunction *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< ChargeTypeIgniterTypeIgniterFunction >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ChargeTypeIgniterTypeIgniterFunction,
|
|
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 =
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_deserialize_from_cdr_buffer(
|
|
ChargeTypeIgniterTypeIgniterFunction *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< ChargeTypeIgniterTypeIgniterFunction >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ChargeTypeIgniterTypeIgniterFunction,
|
|
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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ChargeTypeIgniterTypeIgniterFunctionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeIgniterTypeIgniterFunction **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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeIgniterTypeIgniterFunctionKeyHolder *dst,
|
|
const ChargeTypeIgniterTypeIgniterFunction *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeIgniterTypeIgniterFunction *dst, const
|
|
ChargeTypeIgniterTypeIgniterFunctionKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ChargeTypeIgniterTypeIgniterFunction * sample = NULL;
|
|
sample = (ChargeTypeIgniterTypeIgniterFunction *)
|
|
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 *ChargeTypeIgniterTypeIgniterFunctionPlugin_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)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_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< ::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunction >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunctionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_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 = "ProjectDataManagement::ChargeTypeIgniterTypeIgniterFunction";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ChargeTypeIgniterTypeIgniterFunctionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type ChargeTypeLoadType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
ChargeTypeLoadTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
ChargeTypeLoadType *sample = new ChargeTypeLoadType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
ChargeTypeLoadType *
|
|
ChargeTypeLoadTypePluginSupport_create_data(void)
|
|
{
|
|
return (ChargeTypeLoadType *) ChargeTypeLoadTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePluginSupport_destroy_data(
|
|
ChargeTypeLoadType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::ChargeTypeLoadTypePluginSupport_destroy_data((ChargeTypeLoadType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeLoadTypePluginSupport_copy_data(
|
|
ChargeTypeLoadType *dst,
|
|
const ChargeTypeLoadType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
ChargeTypeLoadTypePluginSupport_create_keyI(void)
|
|
{
|
|
return ChargeTypeLoadTypePluginSupport_create_data();
|
|
}
|
|
|
|
ChargeTypeLoadType *
|
|
ChargeTypeLoadTypePluginSupport_create_key(void)
|
|
{
|
|
return (ChargeTypeLoadType *) ChargeTypeLoadTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePluginSupport_destroy_key(
|
|
ChargeTypeLoadTypeKeyHolder *key)
|
|
{
|
|
ChargeTypeLoadTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::ChargeTypeLoadTypePluginSupport_destroy_key((ChargeTypeLoadTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
ChargeTypeLoadTypePlugin_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< ChargeTypeLoadType >::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
|
|
ChargeTypeLoadTypePlugin_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
|
|
ChargeTypeLoadTypePlugin_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,
|
|
ChargeTypeLoadTypePluginSupport_create_dataI,
|
|
ChargeTypeLoadTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::ChargeTypeLoadTypePluginSupport_create_keyI , ::ProjectDataManagement::ChargeTypeLoadTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::ChargeTypeLoadTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = ChargeTypeLoadTypePlugin_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 = ::ProjectDataManagement::ChargeTypeLoadTypePlugin_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)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeLoadType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"ChargeTypeLoadTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeLoadTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
ChargeTypeLoadType *dst,
|
|
const ChargeTypeLoadType *src)
|
|
{
|
|
return ::ProjectDataManagement::ChargeTypeLoadTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
ChargeTypeLoadTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
ChargeTypeLoadTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const ChargeTypeLoadType *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< ChargeTypeLoadType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ChargeTypeLoadType,
|
|
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 =
|
|
ChargeTypeLoadTypePlugin_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
|
|
ChargeTypeLoadTypePlugin_deserialize_from_cdr_buffer(
|
|
ChargeTypeLoadType *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< ChargeTypeLoadType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
ChargeTypeLoadType,
|
|
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
|
|
ChargeTypeLoadTypePlugin_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
|
|
ChargeTypeLoadTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool ChargeTypeLoadTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeLoadType **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
|
|
ChargeTypeLoadTypePlugin_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
|
|
ChargeTypeLoadTypePlugin_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
|
|
ChargeTypeLoadTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeLoadTypeKeyHolder *dst,
|
|
const ChargeTypeLoadType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeLoadTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
ChargeTypeLoadType *dst, const
|
|
ChargeTypeLoadTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
ChargeTypeLoadTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
ChargeTypeLoadType * sample = NULL;
|
|
sample = (ChargeTypeLoadType *)
|
|
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 *ChargeTypeLoadTypePlugin_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)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
ChargeTypeLoadTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
ChargeTypeLoadTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
ChargeTypeLoadTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
ChargeTypeLoadTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
ChargeTypeLoadTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
ChargeTypeLoadTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_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< ::ProjectDataManagement::ChargeTypeLoadType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::ChargeTypeLoadTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
ChargeTypeLoadTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
ChargeTypeLoadTypePlugin_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 = "ProjectDataManagement::ChargeTypeLoadType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
ChargeTypeLoadTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EquipmentSystemEventFilter
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EquipmentSystemEventFilterPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EquipmentSystemEventFilter *sample = new EquipmentSystemEventFilter();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EquipmentSystemEventFilter *
|
|
EquipmentSystemEventFilterPluginSupport_create_data(void)
|
|
{
|
|
return (EquipmentSystemEventFilter *) EquipmentSystemEventFilterPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPluginSupport_destroy_data(
|
|
EquipmentSystemEventFilter *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPluginSupport_destroy_data((EquipmentSystemEventFilter *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSystemEventFilterPluginSupport_copy_data(
|
|
EquipmentSystemEventFilter *dst,
|
|
const EquipmentSystemEventFilter *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EquipmentSystemEventFilterPluginSupport_create_keyI(void)
|
|
{
|
|
return EquipmentSystemEventFilterPluginSupport_create_data();
|
|
}
|
|
|
|
EquipmentSystemEventFilter *
|
|
EquipmentSystemEventFilterPluginSupport_create_key(void)
|
|
{
|
|
return (EquipmentSystemEventFilter *) EquipmentSystemEventFilterPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPluginSupport_destroy_key(
|
|
EquipmentSystemEventFilterKeyHolder *key)
|
|
{
|
|
EquipmentSystemEventFilterPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPluginSupport_destroy_key((EquipmentSystemEventFilterKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EquipmentSystemEventFilterPlugin_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< EquipmentSystemEventFilter >::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
|
|
EquipmentSystemEventFilterPlugin_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
|
|
EquipmentSystemEventFilterPlugin_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,
|
|
EquipmentSystemEventFilterPluginSupport_create_dataI,
|
|
EquipmentSystemEventFilterPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPluginSupport_create_keyI , ::ProjectDataManagement::EquipmentSystemEventFilterPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::EquipmentSystemEventFilterPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EquipmentSystemEventFilterPlugin_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 = ::ProjectDataManagement::EquipmentSystemEventFilterPlugin_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)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentSystemEventFilter *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EquipmentSystemEventFilterPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSystemEventFilterPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EquipmentSystemEventFilter *dst,
|
|
const EquipmentSystemEventFilter *src)
|
|
{
|
|
return ::ProjectDataManagement::EquipmentSystemEventFilterPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EquipmentSystemEventFilterPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EquipmentSystemEventFilterPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EquipmentSystemEventFilter *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< EquipmentSystemEventFilter >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentSystemEventFilter,
|
|
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 =
|
|
EquipmentSystemEventFilterPlugin_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
|
|
EquipmentSystemEventFilterPlugin_deserialize_from_cdr_buffer(
|
|
EquipmentSystemEventFilter *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< EquipmentSystemEventFilter >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EquipmentSystemEventFilter,
|
|
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
|
|
EquipmentSystemEventFilterPlugin_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
|
|
EquipmentSystemEventFilterPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EquipmentSystemEventFilterPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentSystemEventFilter **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
|
|
EquipmentSystemEventFilterPlugin_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
|
|
EquipmentSystemEventFilterPlugin_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
|
|
EquipmentSystemEventFilterPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentSystemEventFilterKeyHolder *dst,
|
|
const EquipmentSystemEventFilter *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSystemEventFilterPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EquipmentSystemEventFilter *dst, const
|
|
EquipmentSystemEventFilterKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EquipmentSystemEventFilterPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EquipmentSystemEventFilter * sample = NULL;
|
|
sample = (EquipmentSystemEventFilter *)
|
|
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 *EquipmentSystemEventFilterPlugin_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)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EquipmentSystemEventFilterPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EquipmentSystemEventFilterPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EquipmentSystemEventFilterPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EquipmentSystemEventFilterPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EquipmentSystemEventFilterPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EquipmentSystemEventFilterPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_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< ::ProjectDataManagement::EquipmentSystemEventFilter >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::EquipmentSystemEventFilterPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EquipmentSystemEventFilterPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EquipmentSystemEventFilterPlugin_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 = "ProjectDataManagement::EquipmentSystemEventFilter";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EquipmentSystemEventFilterPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type EventFilterHgrMineSearch
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
EventFilterHgrMineSearchPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
EventFilterHgrMineSearch *sample = new EventFilterHgrMineSearch();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
EventFilterHgrMineSearch *
|
|
EventFilterHgrMineSearchPluginSupport_create_data(void)
|
|
{
|
|
return (EventFilterHgrMineSearch *) EventFilterHgrMineSearchPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPluginSupport_destroy_data(
|
|
EventFilterHgrMineSearch *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPluginSupport_destroy_data((EventFilterHgrMineSearch *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
EventFilterHgrMineSearchPluginSupport_copy_data(
|
|
EventFilterHgrMineSearch *dst,
|
|
const EventFilterHgrMineSearch *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
EventFilterHgrMineSearchPluginSupport_create_keyI(void)
|
|
{
|
|
return EventFilterHgrMineSearchPluginSupport_create_data();
|
|
}
|
|
|
|
EventFilterHgrMineSearch *
|
|
EventFilterHgrMineSearchPluginSupport_create_key(void)
|
|
{
|
|
return (EventFilterHgrMineSearch *) EventFilterHgrMineSearchPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPluginSupport_destroy_key(
|
|
EventFilterHgrMineSearchKeyHolder *key)
|
|
{
|
|
EventFilterHgrMineSearchPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPluginSupport_destroy_key((EventFilterHgrMineSearchKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
EventFilterHgrMineSearchPlugin_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< EventFilterHgrMineSearch >::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
|
|
EventFilterHgrMineSearchPlugin_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
|
|
EventFilterHgrMineSearchPlugin_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,
|
|
EventFilterHgrMineSearchPluginSupport_create_dataI,
|
|
EventFilterHgrMineSearchPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPluginSupport_create_keyI , ::ProjectDataManagement::EventFilterHgrMineSearchPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::EventFilterHgrMineSearchPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = EventFilterHgrMineSearchPlugin_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 = ::ProjectDataManagement::EventFilterHgrMineSearchPlugin_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)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EventFilterHgrMineSearch *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"EventFilterHgrMineSearchPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
EventFilterHgrMineSearchPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
EventFilterHgrMineSearch *dst,
|
|
const EventFilterHgrMineSearch *src)
|
|
{
|
|
return ::ProjectDataManagement::EventFilterHgrMineSearchPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
EventFilterHgrMineSearchPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
EventFilterHgrMineSearchPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const EventFilterHgrMineSearch *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< EventFilterHgrMineSearch >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EventFilterHgrMineSearch,
|
|
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 =
|
|
EventFilterHgrMineSearchPlugin_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
|
|
EventFilterHgrMineSearchPlugin_deserialize_from_cdr_buffer(
|
|
EventFilterHgrMineSearch *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< EventFilterHgrMineSearch >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
EventFilterHgrMineSearch,
|
|
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
|
|
EventFilterHgrMineSearchPlugin_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
|
|
EventFilterHgrMineSearchPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool EventFilterHgrMineSearchPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EventFilterHgrMineSearch **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
|
|
EventFilterHgrMineSearchPlugin_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
|
|
EventFilterHgrMineSearchPlugin_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
|
|
EventFilterHgrMineSearchPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EventFilterHgrMineSearchKeyHolder *dst,
|
|
const EventFilterHgrMineSearch *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EventFilterHgrMineSearchPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
EventFilterHgrMineSearch *dst, const
|
|
EventFilterHgrMineSearchKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
EventFilterHgrMineSearchPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
EventFilterHgrMineSearch * sample = NULL;
|
|
sample = (EventFilterHgrMineSearch *)
|
|
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 *EventFilterHgrMineSearchPlugin_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)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
EventFilterHgrMineSearchPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
EventFilterHgrMineSearchPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
EventFilterHgrMineSearchPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
EventFilterHgrMineSearchPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
EventFilterHgrMineSearchPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
EventFilterHgrMineSearchPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_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< ::ProjectDataManagement::EventFilterHgrMineSearch >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::EventFilterHgrMineSearchPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
EventFilterHgrMineSearchPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
EventFilterHgrMineSearchPlugin_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 = "ProjectDataManagement::EventFilterHgrMineSearch";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
EventFilterHgrMineSearchPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type FirePurpose
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
FirePurposePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
FirePurpose *sample = new FirePurpose();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
FirePurpose *
|
|
FirePurposePluginSupport_create_data(void)
|
|
{
|
|
return (FirePurpose *) FirePurposePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
FirePurposePluginSupport_destroy_data(
|
|
FirePurpose *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
FirePurposePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::FirePurposePluginSupport_destroy_data((FirePurpose *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
FirePurposePluginSupport_copy_data(
|
|
FirePurpose *dst,
|
|
const FirePurpose *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
FirePurposePluginSupport_create_keyI(void)
|
|
{
|
|
return FirePurposePluginSupport_create_data();
|
|
}
|
|
|
|
FirePurpose *
|
|
FirePurposePluginSupport_create_key(void)
|
|
{
|
|
return (FirePurpose *) FirePurposePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
FirePurposePluginSupport_destroy_key(
|
|
FirePurposeKeyHolder *key)
|
|
{
|
|
FirePurposePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
FirePurposePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::FirePurposePluginSupport_destroy_key((FirePurposeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
FirePurposePlugin_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< FirePurpose >::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
|
|
FirePurposePlugin_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
|
|
FirePurposePlugin_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,
|
|
FirePurposePluginSupport_create_dataI,
|
|
FirePurposePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::FirePurposePluginSupport_create_keyI , ::ProjectDataManagement::FirePurposePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::FirePurposePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = FirePurposePlugin_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 = ::ProjectDataManagement::FirePurposePlugin_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)
|
|
::ProjectDataManagement::FirePurposePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
FirePurposePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
FirePurposePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FirePurpose *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"FirePurposePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
FirePurposePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
FirePurpose *dst,
|
|
const FirePurpose *src)
|
|
{
|
|
return ::ProjectDataManagement::FirePurposePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
FirePurposePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
FirePurposePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const FirePurpose *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< FirePurpose >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FirePurpose,
|
|
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 =
|
|
FirePurposePlugin_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
|
|
FirePurposePlugin_deserialize_from_cdr_buffer(
|
|
FirePurpose *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< FirePurpose >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
FirePurpose,
|
|
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
|
|
FirePurposePlugin_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
|
|
FirePurposePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool FirePurposePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FirePurpose **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
|
|
FirePurposePlugin_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
|
|
FirePurposePlugin_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
|
|
FirePurposePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FirePurposeKeyHolder *dst,
|
|
const FirePurpose *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FirePurposePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
FirePurpose *dst, const
|
|
FirePurposeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
FirePurposePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
FirePurpose * sample = NULL;
|
|
sample = (FirePurpose *)
|
|
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 *FirePurposePlugin_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)
|
|
::ProjectDataManagement::FirePurposePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::FirePurposePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::FirePurposePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::FirePurposePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
FirePurposePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
FirePurposePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
FirePurposePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
FirePurposePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
FirePurposePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
FirePurposePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::FirePurposePlugin_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< ::ProjectDataManagement::FirePurpose >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::FirePurposePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
FirePurposePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
FirePurposePlugin_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 = "ProjectDataManagement::FirePurpose";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
FirePurposePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type GearType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
GearTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
GearType *sample = new GearType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
GearType *
|
|
GearTypePluginSupport_create_data(void)
|
|
{
|
|
return (GearType *) GearTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
GearTypePluginSupport_destroy_data(
|
|
GearType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
GearTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::GearTypePluginSupport_destroy_data((GearType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
GearTypePluginSupport_copy_data(
|
|
GearType *dst,
|
|
const GearType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
GearTypePluginSupport_create_keyI(void)
|
|
{
|
|
return GearTypePluginSupport_create_data();
|
|
}
|
|
|
|
GearType *
|
|
GearTypePluginSupport_create_key(void)
|
|
{
|
|
return (GearType *) GearTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
GearTypePluginSupport_destroy_key(
|
|
GearTypeKeyHolder *key)
|
|
{
|
|
GearTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
GearTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::GearTypePluginSupport_destroy_key((GearTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
GearTypePlugin_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< GearType >::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
|
|
GearTypePlugin_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
|
|
GearTypePlugin_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,
|
|
GearTypePluginSupport_create_dataI,
|
|
GearTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::GearTypePluginSupport_create_keyI , ::ProjectDataManagement::GearTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::GearTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = GearTypePlugin_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 = ::ProjectDataManagement::GearTypePlugin_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)
|
|
::ProjectDataManagement::GearTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GearTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
GearTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"GearTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
GearTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
GearType *dst,
|
|
const GearType *src)
|
|
{
|
|
return ::ProjectDataManagement::GearTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
GearTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
GearTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const GearType *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< GearType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GearType,
|
|
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 =
|
|
GearTypePlugin_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
|
|
GearTypePlugin_deserialize_from_cdr_buffer(
|
|
GearType *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< GearType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GearType,
|
|
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
|
|
GearTypePlugin_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
|
|
GearTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool GearTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearType **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
|
|
GearTypePlugin_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
|
|
GearTypePlugin_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
|
|
GearTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearTypeKeyHolder *dst,
|
|
const GearType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GearTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearType *dst, const
|
|
GearTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GearTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
GearType * sample = NULL;
|
|
sample = (GearType *)
|
|
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 *GearTypePlugin_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)
|
|
::ProjectDataManagement::GearTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::GearTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::GearTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::GearTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::GearTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
GearTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
GearTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::GearTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
GearTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
GearTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::GearTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::GearTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::GearTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::GearTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
GearTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
GearTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::GearTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::GearTypePlugin_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< ::ProjectDataManagement::GearType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::GearTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
GearTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
GearTypePlugin_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 = "ProjectDataManagement::GearType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
GearTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type GearTypeChargeType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
GearTypeChargeTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
GearTypeChargeType *sample = new GearTypeChargeType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
GearTypeChargeType *
|
|
GearTypeChargeTypePluginSupport_create_data(void)
|
|
{
|
|
return (GearTypeChargeType *) GearTypeChargeTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePluginSupport_destroy_data(
|
|
GearTypeChargeType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::GearTypeChargeTypePluginSupport_destroy_data((GearTypeChargeType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
GearTypeChargeTypePluginSupport_copy_data(
|
|
GearTypeChargeType *dst,
|
|
const GearTypeChargeType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
GearTypeChargeTypePluginSupport_create_keyI(void)
|
|
{
|
|
return GearTypeChargeTypePluginSupport_create_data();
|
|
}
|
|
|
|
GearTypeChargeType *
|
|
GearTypeChargeTypePluginSupport_create_key(void)
|
|
{
|
|
return (GearTypeChargeType *) GearTypeChargeTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePluginSupport_destroy_key(
|
|
GearTypeChargeTypeKeyHolder *key)
|
|
{
|
|
GearTypeChargeTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::GearTypeChargeTypePluginSupport_destroy_key((GearTypeChargeTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
GearTypeChargeTypePlugin_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< GearTypeChargeType >::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
|
|
GearTypeChargeTypePlugin_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
|
|
GearTypeChargeTypePlugin_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,
|
|
GearTypeChargeTypePluginSupport_create_dataI,
|
|
GearTypeChargeTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::GearTypeChargeTypePluginSupport_create_keyI , ::ProjectDataManagement::GearTypeChargeTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::GearTypeChargeTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = GearTypeChargeTypePlugin_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 = ::ProjectDataManagement::GearTypeChargeTypePlugin_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)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearTypeChargeType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"GearTypeChargeTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
GearTypeChargeTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
GearTypeChargeType *dst,
|
|
const GearTypeChargeType *src)
|
|
{
|
|
return ::ProjectDataManagement::GearTypeChargeTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
GearTypeChargeTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
GearTypeChargeTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const GearTypeChargeType *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< GearTypeChargeType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GearTypeChargeType,
|
|
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 =
|
|
GearTypeChargeTypePlugin_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
|
|
GearTypeChargeTypePlugin_deserialize_from_cdr_buffer(
|
|
GearTypeChargeType *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< GearTypeChargeType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
GearTypeChargeType,
|
|
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
|
|
GearTypeChargeTypePlugin_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
|
|
GearTypeChargeTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool GearTypeChargeTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearTypeChargeType **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
|
|
GearTypeChargeTypePlugin_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
|
|
GearTypeChargeTypePlugin_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
|
|
GearTypeChargeTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearTypeChargeTypeKeyHolder *dst,
|
|
const GearTypeChargeType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GearTypeChargeTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
GearTypeChargeType *dst, const
|
|
GearTypeChargeTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
GearTypeChargeTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
GearTypeChargeType * sample = NULL;
|
|
sample = (GearTypeChargeType *)
|
|
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 *GearTypeChargeTypePlugin_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)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
GearTypeChargeTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
GearTypeChargeTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
GearTypeChargeTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
GearTypeChargeTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
GearTypeChargeTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
GearTypeChargeTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_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< ::ProjectDataManagement::GearTypeChargeType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::GearTypeChargeTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
GearTypeChargeTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
GearTypeChargeTypePlugin_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 = "ProjectDataManagement::GearTypeChargeType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
GearTypeChargeTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type IgniterFunction
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
IgniterFunctionPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
IgniterFunction *sample = new IgniterFunction();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
IgniterFunction *
|
|
IgniterFunctionPluginSupport_create_data(void)
|
|
{
|
|
return (IgniterFunction *) IgniterFunctionPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPluginSupport_destroy_data(
|
|
IgniterFunction *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::IgniterFunctionPluginSupport_destroy_data((IgniterFunction *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
IgniterFunctionPluginSupport_copy_data(
|
|
IgniterFunction *dst,
|
|
const IgniterFunction *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
IgniterFunctionPluginSupport_create_keyI(void)
|
|
{
|
|
return IgniterFunctionPluginSupport_create_data();
|
|
}
|
|
|
|
IgniterFunction *
|
|
IgniterFunctionPluginSupport_create_key(void)
|
|
{
|
|
return (IgniterFunction *) IgniterFunctionPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPluginSupport_destroy_key(
|
|
IgniterFunctionKeyHolder *key)
|
|
{
|
|
IgniterFunctionPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::IgniterFunctionPluginSupport_destroy_key((IgniterFunctionKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
IgniterFunctionPlugin_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< IgniterFunction >::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
|
|
IgniterFunctionPlugin_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
|
|
IgniterFunctionPlugin_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,
|
|
IgniterFunctionPluginSupport_create_dataI,
|
|
IgniterFunctionPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::IgniterFunctionPluginSupport_create_keyI , ::ProjectDataManagement::IgniterFunctionPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::IgniterFunctionPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = IgniterFunctionPlugin_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 = ::ProjectDataManagement::IgniterFunctionPlugin_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)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterFunction *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"IgniterFunctionPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
IgniterFunctionPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
IgniterFunction *dst,
|
|
const IgniterFunction *src)
|
|
{
|
|
return ::ProjectDataManagement::IgniterFunctionPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
IgniterFunctionPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
IgniterFunctionPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const IgniterFunction *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< IgniterFunction >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
IgniterFunction,
|
|
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 =
|
|
IgniterFunctionPlugin_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
|
|
IgniterFunctionPlugin_deserialize_from_cdr_buffer(
|
|
IgniterFunction *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< IgniterFunction >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
IgniterFunction,
|
|
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
|
|
IgniterFunctionPlugin_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
|
|
IgniterFunctionPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool IgniterFunctionPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterFunction **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
|
|
IgniterFunctionPlugin_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
|
|
IgniterFunctionPlugin_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
|
|
IgniterFunctionPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterFunctionKeyHolder *dst,
|
|
const IgniterFunction *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IgniterFunctionPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterFunction *dst, const
|
|
IgniterFunctionKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IgniterFunctionPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
IgniterFunction * sample = NULL;
|
|
sample = (IgniterFunction *)
|
|
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 *IgniterFunctionPlugin_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)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
IgniterFunctionPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
IgniterFunctionPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
IgniterFunctionPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
IgniterFunctionPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
IgniterFunctionPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
IgniterFunctionPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::IgniterFunctionPlugin_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< ::ProjectDataManagement::IgniterFunction >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::IgniterFunctionPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
IgniterFunctionPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
IgniterFunctionPlugin_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 = "ProjectDataManagement::IgniterFunction";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
IgniterFunctionPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type IgniterType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
IgniterTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
IgniterType *sample = new IgniterType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
IgniterType *
|
|
IgniterTypePluginSupport_create_data(void)
|
|
{
|
|
return (IgniterType *) IgniterTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
IgniterTypePluginSupport_destroy_data(
|
|
IgniterType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
IgniterTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::IgniterTypePluginSupport_destroy_data((IgniterType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
IgniterTypePluginSupport_copy_data(
|
|
IgniterType *dst,
|
|
const IgniterType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
IgniterTypePluginSupport_create_keyI(void)
|
|
{
|
|
return IgniterTypePluginSupport_create_data();
|
|
}
|
|
|
|
IgniterType *
|
|
IgniterTypePluginSupport_create_key(void)
|
|
{
|
|
return (IgniterType *) IgniterTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
IgniterTypePluginSupport_destroy_key(
|
|
IgniterTypeKeyHolder *key)
|
|
{
|
|
IgniterTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
IgniterTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::IgniterTypePluginSupport_destroy_key((IgniterTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
IgniterTypePlugin_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< IgniterType >::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
|
|
IgniterTypePlugin_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
|
|
IgniterTypePlugin_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,
|
|
IgniterTypePluginSupport_create_dataI,
|
|
IgniterTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::IgniterTypePluginSupport_create_keyI , ::ProjectDataManagement::IgniterTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::IgniterTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = IgniterTypePlugin_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 = ::ProjectDataManagement::IgniterTypePlugin_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)
|
|
::ProjectDataManagement::IgniterTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
IgniterTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
IgniterTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"IgniterTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
IgniterTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
IgniterType *dst,
|
|
const IgniterType *src)
|
|
{
|
|
return ::ProjectDataManagement::IgniterTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
IgniterTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
IgniterTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const IgniterType *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< IgniterType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
IgniterType,
|
|
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 =
|
|
IgniterTypePlugin_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
|
|
IgniterTypePlugin_deserialize_from_cdr_buffer(
|
|
IgniterType *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< IgniterType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
IgniterType,
|
|
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
|
|
IgniterTypePlugin_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
|
|
IgniterTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool IgniterTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterType **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
|
|
IgniterTypePlugin_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
|
|
IgniterTypePlugin_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
|
|
IgniterTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterTypeKeyHolder *dst,
|
|
const IgniterType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IgniterTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
IgniterType *dst, const
|
|
IgniterTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
IgniterTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
IgniterType * sample = NULL;
|
|
sample = (IgniterType *)
|
|
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 *IgniterTypePlugin_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)
|
|
::ProjectDataManagement::IgniterTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::IgniterTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::IgniterTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::IgniterTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
IgniterTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
IgniterTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
IgniterTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
IgniterTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
IgniterTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
IgniterTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::IgniterTypePlugin_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< ::ProjectDataManagement::IgniterType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::IgniterTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
IgniterTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
IgniterTypePlugin_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 = "ProjectDataManagement::IgniterType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
IgniterTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type InsertUpdateTranslationRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
InsertUpdateTranslationRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
InsertUpdateTranslationRequest *sample = new InsertUpdateTranslationRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
InsertUpdateTranslationRequest *
|
|
InsertUpdateTranslationRequestPluginSupport_create_data(void)
|
|
{
|
|
return (InsertUpdateTranslationRequest *) InsertUpdateTranslationRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
InsertUpdateTranslationRequestPluginSupport_destroy_data(
|
|
InsertUpdateTranslationRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
InsertUpdateTranslationRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPluginSupport_destroy_data((InsertUpdateTranslationRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
InsertUpdateTranslationRequestPluginSupport_copy_data(
|
|
InsertUpdateTranslationRequest *dst,
|
|
const InsertUpdateTranslationRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
InsertUpdateTranslationRequestPlugin_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< InsertUpdateTranslationRequest >::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
|
|
InsertUpdateTranslationRequestPlugin_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
|
|
InsertUpdateTranslationRequestPlugin_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,
|
|
InsertUpdateTranslationRequestPluginSupport_create_dataI,
|
|
InsertUpdateTranslationRequestPluginSupport_destroy_dataI,
|
|
NULL , NULL );
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
if (endpoint_info->endpointKind == PRES_TYPEPLUGIN_ENDPOINT_WRITER) {
|
|
serializedSampleMaxSize = ::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_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)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
InsertUpdateTranslationRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
InsertUpdateTranslationRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
InsertUpdateTranslationRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"InsertUpdateTranslationRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
InsertUpdateTranslationRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
InsertUpdateTranslationRequest *dst,
|
|
const InsertUpdateTranslationRequest *src)
|
|
{
|
|
return ::ProjectDataManagement::InsertUpdateTranslationRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
InsertUpdateTranslationRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
InsertUpdateTranslationRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const InsertUpdateTranslationRequest *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< InsertUpdateTranslationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
InsertUpdateTranslationRequest,
|
|
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 =
|
|
InsertUpdateTranslationRequestPlugin_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
|
|
InsertUpdateTranslationRequestPlugin_deserialize_from_cdr_buffer(
|
|
InsertUpdateTranslationRequest *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< InsertUpdateTranslationRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
InsertUpdateTranslationRequest,
|
|
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
|
|
InsertUpdateTranslationRequestPlugin_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
|
|
InsertUpdateTranslationRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_NO_KEY;
|
|
}
|
|
|
|
RTIBool InsertUpdateTranslationRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
InsertUpdateTranslationRequest **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
|
|
InsertUpdateTranslationRequestPlugin_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
|
|
InsertUpdateTranslationRequestPlugin_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 *InsertUpdateTranslationRequestPlugin_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)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
InsertUpdateTranslationRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
InsertUpdateTranslationRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
InsertUpdateTranslationRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
InsertUpdateTranslationRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_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< ::ProjectDataManagement::InsertUpdateTranslationRequest >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::InsertUpdateTranslationRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
InsertUpdateTranslationRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
InsertUpdateTranslationRequestPlugin_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 = "ProjectDataManagement::InsertUpdateTranslationRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
InsertUpdateTranslationRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type LanguageHmi
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
LanguageHmiPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
LanguageHmi *sample = new LanguageHmi();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
LanguageHmi *
|
|
LanguageHmiPluginSupport_create_data(void)
|
|
{
|
|
return (LanguageHmi *) LanguageHmiPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
LanguageHmiPluginSupport_destroy_data(
|
|
LanguageHmi *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
LanguageHmiPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::LanguageHmiPluginSupport_destroy_data((LanguageHmi *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
LanguageHmiPluginSupport_copy_data(
|
|
LanguageHmi *dst,
|
|
const LanguageHmi *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
LanguageHmiPluginSupport_create_keyI(void)
|
|
{
|
|
return LanguageHmiPluginSupport_create_data();
|
|
}
|
|
|
|
LanguageHmi *
|
|
LanguageHmiPluginSupport_create_key(void)
|
|
{
|
|
return (LanguageHmi *) LanguageHmiPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
LanguageHmiPluginSupport_destroy_key(
|
|
LanguageHmiKeyHolder *key)
|
|
{
|
|
LanguageHmiPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
LanguageHmiPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::LanguageHmiPluginSupport_destroy_key((LanguageHmiKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
LanguageHmiPlugin_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< LanguageHmi >::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
|
|
LanguageHmiPlugin_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
|
|
LanguageHmiPlugin_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,
|
|
LanguageHmiPluginSupport_create_dataI,
|
|
LanguageHmiPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::LanguageHmiPluginSupport_create_keyI , ::ProjectDataManagement::LanguageHmiPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::LanguageHmiPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = LanguageHmiPlugin_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 = ::ProjectDataManagement::LanguageHmiPlugin_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)
|
|
::ProjectDataManagement::LanguageHmiPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
LanguageHmiPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
LanguageHmiPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageHmi *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"LanguageHmiPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
LanguageHmiPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
LanguageHmi *dst,
|
|
const LanguageHmi *src)
|
|
{
|
|
return ::ProjectDataManagement::LanguageHmiPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
LanguageHmiPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
LanguageHmiPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const LanguageHmi *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< LanguageHmi >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LanguageHmi,
|
|
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 =
|
|
LanguageHmiPlugin_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
|
|
LanguageHmiPlugin_deserialize_from_cdr_buffer(
|
|
LanguageHmi *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< LanguageHmi >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LanguageHmi,
|
|
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
|
|
LanguageHmiPlugin_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
|
|
LanguageHmiPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool LanguageHmiPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageHmi **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
|
|
LanguageHmiPlugin_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
|
|
LanguageHmiPlugin_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
|
|
LanguageHmiPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageHmiKeyHolder *dst,
|
|
const LanguageHmi *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LanguageHmiPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageHmi *dst, const
|
|
LanguageHmiKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LanguageHmiPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
LanguageHmi * sample = NULL;
|
|
sample = (LanguageHmi *)
|
|
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 *LanguageHmiPlugin_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)
|
|
::ProjectDataManagement::LanguageHmiPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::LanguageHmiPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::LanguageHmiPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::LanguageHmiPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
LanguageHmiPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
LanguageHmiPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
LanguageHmiPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
LanguageHmiPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
LanguageHmiPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
LanguageHmiPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::LanguageHmiPlugin_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< ::ProjectDataManagement::LanguageHmi >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::LanguageHmiPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
LanguageHmiPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
LanguageHmiPlugin_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 = "ProjectDataManagement::LanguageHmi";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
LanguageHmiPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type LanguageXdu
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
LanguageXduPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
LanguageXdu *sample = new LanguageXdu();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
LanguageXdu *
|
|
LanguageXduPluginSupport_create_data(void)
|
|
{
|
|
return (LanguageXdu *) LanguageXduPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
LanguageXduPluginSupport_destroy_data(
|
|
LanguageXdu *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
LanguageXduPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::LanguageXduPluginSupport_destroy_data((LanguageXdu *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
LanguageXduPluginSupport_copy_data(
|
|
LanguageXdu *dst,
|
|
const LanguageXdu *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
LanguageXduPluginSupport_create_keyI(void)
|
|
{
|
|
return LanguageXduPluginSupport_create_data();
|
|
}
|
|
|
|
LanguageXdu *
|
|
LanguageXduPluginSupport_create_key(void)
|
|
{
|
|
return (LanguageXdu *) LanguageXduPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
LanguageXduPluginSupport_destroy_key(
|
|
LanguageXduKeyHolder *key)
|
|
{
|
|
LanguageXduPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
LanguageXduPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::LanguageXduPluginSupport_destroy_key((LanguageXduKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
LanguageXduPlugin_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< LanguageXdu >::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
|
|
LanguageXduPlugin_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
|
|
LanguageXduPlugin_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,
|
|
LanguageXduPluginSupport_create_dataI,
|
|
LanguageXduPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::LanguageXduPluginSupport_create_keyI , ::ProjectDataManagement::LanguageXduPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::LanguageXduPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = LanguageXduPlugin_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 = ::ProjectDataManagement::LanguageXduPlugin_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)
|
|
::ProjectDataManagement::LanguageXduPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
LanguageXduPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
LanguageXduPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageXdu *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"LanguageXduPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
LanguageXduPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
LanguageXdu *dst,
|
|
const LanguageXdu *src)
|
|
{
|
|
return ::ProjectDataManagement::LanguageXduPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
LanguageXduPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
LanguageXduPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const LanguageXdu *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< LanguageXdu >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LanguageXdu,
|
|
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 =
|
|
LanguageXduPlugin_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
|
|
LanguageXduPlugin_deserialize_from_cdr_buffer(
|
|
LanguageXdu *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< LanguageXdu >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LanguageXdu,
|
|
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
|
|
LanguageXduPlugin_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
|
|
LanguageXduPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool LanguageXduPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageXdu **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
|
|
LanguageXduPlugin_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
|
|
LanguageXduPlugin_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
|
|
LanguageXduPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageXduKeyHolder *dst,
|
|
const LanguageXdu *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LanguageXduPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LanguageXdu *dst, const
|
|
LanguageXduKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LanguageXduPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
LanguageXdu * sample = NULL;
|
|
sample = (LanguageXdu *)
|
|
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 *LanguageXduPlugin_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)
|
|
::ProjectDataManagement::LanguageXduPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::LanguageXduPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::LanguageXduPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::LanguageXduPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
LanguageXduPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
LanguageXduPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
LanguageXduPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
LanguageXduPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
LanguageXduPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
LanguageXduPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::LanguageXduPlugin_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< ::ProjectDataManagement::LanguageXdu >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::LanguageXduPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
LanguageXduPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
LanguageXduPlugin_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 = "ProjectDataManagement::LanguageXdu";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
LanguageXduPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type LoadType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
LoadTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
LoadType *sample = new LoadType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
LoadType *
|
|
LoadTypePluginSupport_create_data(void)
|
|
{
|
|
return (LoadType *) LoadTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
LoadTypePluginSupport_destroy_data(
|
|
LoadType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
LoadTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::LoadTypePluginSupport_destroy_data((LoadType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
LoadTypePluginSupport_copy_data(
|
|
LoadType *dst,
|
|
const LoadType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
LoadTypePluginSupport_create_keyI(void)
|
|
{
|
|
return LoadTypePluginSupport_create_data();
|
|
}
|
|
|
|
LoadType *
|
|
LoadTypePluginSupport_create_key(void)
|
|
{
|
|
return (LoadType *) LoadTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
LoadTypePluginSupport_destroy_key(
|
|
LoadTypeKeyHolder *key)
|
|
{
|
|
LoadTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
LoadTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::LoadTypePluginSupport_destroy_key((LoadTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
LoadTypePlugin_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< LoadType >::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
|
|
LoadTypePlugin_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
|
|
LoadTypePlugin_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,
|
|
LoadTypePluginSupport_create_dataI,
|
|
LoadTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::LoadTypePluginSupport_create_keyI , ::ProjectDataManagement::LoadTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::LoadTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = LoadTypePlugin_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 = ::ProjectDataManagement::LoadTypePlugin_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)
|
|
::ProjectDataManagement::LoadTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
LoadTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
LoadTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LoadType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"LoadTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
LoadTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
LoadType *dst,
|
|
const LoadType *src)
|
|
{
|
|
return ::ProjectDataManagement::LoadTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
LoadTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
LoadTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const LoadType *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< LoadType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LoadType,
|
|
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 =
|
|
LoadTypePlugin_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
|
|
LoadTypePlugin_deserialize_from_cdr_buffer(
|
|
LoadType *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< LoadType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
LoadType,
|
|
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
|
|
LoadTypePlugin_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
|
|
LoadTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool LoadTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LoadType **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
|
|
LoadTypePlugin_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
|
|
LoadTypePlugin_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
|
|
LoadTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LoadTypeKeyHolder *dst,
|
|
const LoadType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LoadTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
LoadType *dst, const
|
|
LoadTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
LoadTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
LoadType * sample = NULL;
|
|
sample = (LoadType *)
|
|
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 *LoadTypePlugin_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)
|
|
::ProjectDataManagement::LoadTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::LoadTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::LoadTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::LoadTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
LoadTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
LoadTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
LoadTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
LoadTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
LoadTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
LoadTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::LoadTypePlugin_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< ::ProjectDataManagement::LoadType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::LoadTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
LoadTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
LoadTypePlugin_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 = "ProjectDataManagement::LoadType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
LoadTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type NuclearPreset
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
NuclearPresetPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
NuclearPreset *sample = new NuclearPreset();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
NuclearPreset *
|
|
NuclearPresetPluginSupport_create_data(void)
|
|
{
|
|
return (NuclearPreset *) NuclearPresetPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
NuclearPresetPluginSupport_destroy_data(
|
|
NuclearPreset *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
NuclearPresetPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::NuclearPresetPluginSupport_destroy_data((NuclearPreset *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
NuclearPresetPluginSupport_copy_data(
|
|
NuclearPreset *dst,
|
|
const NuclearPreset *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
NuclearPresetPluginSupport_create_keyI(void)
|
|
{
|
|
return NuclearPresetPluginSupport_create_data();
|
|
}
|
|
|
|
NuclearPreset *
|
|
NuclearPresetPluginSupport_create_key(void)
|
|
{
|
|
return (NuclearPreset *) NuclearPresetPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
NuclearPresetPluginSupport_destroy_key(
|
|
NuclearPresetKeyHolder *key)
|
|
{
|
|
NuclearPresetPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
NuclearPresetPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::NuclearPresetPluginSupport_destroy_key((NuclearPresetKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
NuclearPresetPlugin_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< NuclearPreset >::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
|
|
NuclearPresetPlugin_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
|
|
NuclearPresetPlugin_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,
|
|
NuclearPresetPluginSupport_create_dataI,
|
|
NuclearPresetPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::NuclearPresetPluginSupport_create_keyI , ::ProjectDataManagement::NuclearPresetPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::NuclearPresetPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = NuclearPresetPlugin_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 = ::ProjectDataManagement::NuclearPresetPlugin_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)
|
|
::ProjectDataManagement::NuclearPresetPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
NuclearPresetPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
NuclearPresetPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
NuclearPreset *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"NuclearPresetPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
NuclearPresetPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
NuclearPreset *dst,
|
|
const NuclearPreset *src)
|
|
{
|
|
return ::ProjectDataManagement::NuclearPresetPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
NuclearPresetPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
NuclearPresetPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const NuclearPreset *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< NuclearPreset >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
NuclearPreset,
|
|
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 =
|
|
NuclearPresetPlugin_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
|
|
NuclearPresetPlugin_deserialize_from_cdr_buffer(
|
|
NuclearPreset *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< NuclearPreset >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
NuclearPreset,
|
|
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
|
|
NuclearPresetPlugin_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
|
|
NuclearPresetPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool NuclearPresetPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
NuclearPreset **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
|
|
NuclearPresetPlugin_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
|
|
NuclearPresetPlugin_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
|
|
NuclearPresetPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
NuclearPresetKeyHolder *dst,
|
|
const NuclearPreset *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
NuclearPresetPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
NuclearPreset *dst, const
|
|
NuclearPresetKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
NuclearPresetPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
NuclearPreset * sample = NULL;
|
|
sample = (NuclearPreset *)
|
|
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 *NuclearPresetPlugin_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)
|
|
::ProjectDataManagement::NuclearPresetPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::NuclearPresetPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::NuclearPresetPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::NuclearPresetPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
NuclearPresetPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
NuclearPresetPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
NuclearPresetPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
NuclearPresetPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
NuclearPresetPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
NuclearPresetPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::NuclearPresetPlugin_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< ::ProjectDataManagement::NuclearPreset >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::NuclearPresetPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
NuclearPresetPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
NuclearPresetPlugin_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 = "ProjectDataManagement::NuclearPreset";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
NuclearPresetPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type RadioGroup
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
RadioGroupPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
RadioGroup *sample = new RadioGroup();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
RadioGroup *
|
|
RadioGroupPluginSupport_create_data(void)
|
|
{
|
|
return (RadioGroup *) RadioGroupPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
RadioGroupPluginSupport_destroy_data(
|
|
RadioGroup *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
RadioGroupPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::RadioGroupPluginSupport_destroy_data((RadioGroup *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
RadioGroupPluginSupport_copy_data(
|
|
RadioGroup *dst,
|
|
const RadioGroup *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
RadioGroupPluginSupport_create_keyI(void)
|
|
{
|
|
return RadioGroupPluginSupport_create_data();
|
|
}
|
|
|
|
RadioGroup *
|
|
RadioGroupPluginSupport_create_key(void)
|
|
{
|
|
return (RadioGroup *) RadioGroupPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
RadioGroupPluginSupport_destroy_key(
|
|
RadioGroupKeyHolder *key)
|
|
{
|
|
RadioGroupPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
RadioGroupPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::RadioGroupPluginSupport_destroy_key((RadioGroupKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
RadioGroupPlugin_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< RadioGroup >::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
|
|
RadioGroupPlugin_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
|
|
RadioGroupPlugin_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,
|
|
RadioGroupPluginSupport_create_dataI,
|
|
RadioGroupPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::RadioGroupPluginSupport_create_keyI , ::ProjectDataManagement::RadioGroupPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::RadioGroupPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = RadioGroupPlugin_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 = ::ProjectDataManagement::RadioGroupPlugin_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)
|
|
::ProjectDataManagement::RadioGroupPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
RadioGroupPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
RadioGroupPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RadioGroup *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"RadioGroupPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
RadioGroupPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
RadioGroup *dst,
|
|
const RadioGroup *src)
|
|
{
|
|
return ::ProjectDataManagement::RadioGroupPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
RadioGroupPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
RadioGroupPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const RadioGroup *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< RadioGroup >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
RadioGroup,
|
|
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 =
|
|
RadioGroupPlugin_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
|
|
RadioGroupPlugin_deserialize_from_cdr_buffer(
|
|
RadioGroup *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< RadioGroup >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
RadioGroup,
|
|
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
|
|
RadioGroupPlugin_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
|
|
RadioGroupPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool RadioGroupPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RadioGroup **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
|
|
RadioGroupPlugin_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
|
|
RadioGroupPlugin_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
|
|
RadioGroupPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RadioGroupKeyHolder *dst,
|
|
const RadioGroup *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
RadioGroupPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RadioGroup *dst, const
|
|
RadioGroupKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
RadioGroupPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
RadioGroup * sample = NULL;
|
|
sample = (RadioGroup *)
|
|
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 *RadioGroupPlugin_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)
|
|
::ProjectDataManagement::RadioGroupPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::RadioGroupPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::RadioGroupPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::RadioGroupPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
RadioGroupPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
RadioGroupPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
RadioGroupPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
RadioGroupPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
RadioGroupPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
RadioGroupPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::RadioGroupPlugin_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< ::ProjectDataManagement::RadioGroup >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::RadioGroupPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
RadioGroupPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
RadioGroupPlugin_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 = "ProjectDataManagement::RadioGroup";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
RadioGroupPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SanitationInjury
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SanitationInjuryPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SanitationInjury *sample = new SanitationInjury();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SanitationInjury *
|
|
SanitationInjuryPluginSupport_create_data(void)
|
|
{
|
|
return (SanitationInjury *) SanitationInjuryPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPluginSupport_destroy_data(
|
|
SanitationInjury *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryPluginSupport_destroy_data((SanitationInjury *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPluginSupport_copy_data(
|
|
SanitationInjury *dst,
|
|
const SanitationInjury *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SanitationInjuryPluginSupport_create_keyI(void)
|
|
{
|
|
return SanitationInjuryPluginSupport_create_data();
|
|
}
|
|
|
|
SanitationInjury *
|
|
SanitationInjuryPluginSupport_create_key(void)
|
|
{
|
|
return (SanitationInjury *) SanitationInjuryPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPluginSupport_destroy_key(
|
|
SanitationInjuryKeyHolder *key)
|
|
{
|
|
SanitationInjuryPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryPluginSupport_destroy_key((SanitationInjuryKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SanitationInjuryPlugin_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< SanitationInjury >::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
|
|
SanitationInjuryPlugin_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
|
|
SanitationInjuryPlugin_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,
|
|
SanitationInjuryPluginSupport_create_dataI,
|
|
SanitationInjuryPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::SanitationInjuryPluginSupport_create_keyI , ::ProjectDataManagement::SanitationInjuryPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::SanitationInjuryPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SanitationInjuryPlugin_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 = ::ProjectDataManagement::SanitationInjuryPlugin_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)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjury *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SanitationInjuryPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SanitationInjury *dst,
|
|
const SanitationInjury *src)
|
|
{
|
|
return ::ProjectDataManagement::SanitationInjuryPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SanitationInjuryPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SanitationInjuryPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SanitationInjury *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< SanitationInjury >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjury,
|
|
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 =
|
|
SanitationInjuryPlugin_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
|
|
SanitationInjuryPlugin_deserialize_from_cdr_buffer(
|
|
SanitationInjury *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< SanitationInjury >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjury,
|
|
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
|
|
SanitationInjuryPlugin_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
|
|
SanitationInjuryPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SanitationInjuryPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjury **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
|
|
SanitationInjuryPlugin_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
|
|
SanitationInjuryPlugin_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
|
|
SanitationInjuryPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryKeyHolder *dst,
|
|
const SanitationInjury *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjury *dst, const
|
|
SanitationInjuryKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SanitationInjury * sample = NULL;
|
|
sample = (SanitationInjury *)
|
|
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 *SanitationInjuryPlugin_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)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SanitationInjuryPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SanitationInjuryPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SanitationInjuryPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SanitationInjuryPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SanitationInjuryPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SanitationInjuryPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlugin_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< ::ProjectDataManagement::SanitationInjury >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::SanitationInjuryPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SanitationInjuryPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SanitationInjuryPlugin_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 = "ProjectDataManagement::SanitationInjury";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SanitationInjuryKind
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SanitationInjuryKindPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SanitationInjuryKind *sample = new SanitationInjuryKind();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SanitationInjuryKind *
|
|
SanitationInjuryKindPluginSupport_create_data(void)
|
|
{
|
|
return (SanitationInjuryKind *) SanitationInjuryKindPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPluginSupport_destroy_data(
|
|
SanitationInjuryKind *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryKindPluginSupport_destroy_data((SanitationInjuryKind *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryKindPluginSupport_copy_data(
|
|
SanitationInjuryKind *dst,
|
|
const SanitationInjuryKind *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SanitationInjuryKindPluginSupport_create_keyI(void)
|
|
{
|
|
return SanitationInjuryKindPluginSupport_create_data();
|
|
}
|
|
|
|
SanitationInjuryKind *
|
|
SanitationInjuryKindPluginSupport_create_key(void)
|
|
{
|
|
return (SanitationInjuryKind *) SanitationInjuryKindPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPluginSupport_destroy_key(
|
|
SanitationInjuryKindKeyHolder *key)
|
|
{
|
|
SanitationInjuryKindPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryKindPluginSupport_destroy_key((SanitationInjuryKindKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SanitationInjuryKindPlugin_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< SanitationInjuryKind >::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
|
|
SanitationInjuryKindPlugin_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
|
|
SanitationInjuryKindPlugin_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,
|
|
SanitationInjuryKindPluginSupport_create_dataI,
|
|
SanitationInjuryKindPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::SanitationInjuryKindPluginSupport_create_keyI , ::ProjectDataManagement::SanitationInjuryKindPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::SanitationInjuryKindPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SanitationInjuryKindPlugin_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 = ::ProjectDataManagement::SanitationInjuryKindPlugin_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)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryKind *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SanitationInjuryKindPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryKindPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SanitationInjuryKind *dst,
|
|
const SanitationInjuryKind *src)
|
|
{
|
|
return ::ProjectDataManagement::SanitationInjuryKindPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SanitationInjuryKindPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SanitationInjuryKindPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SanitationInjuryKind *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< SanitationInjuryKind >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjuryKind,
|
|
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 =
|
|
SanitationInjuryKindPlugin_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
|
|
SanitationInjuryKindPlugin_deserialize_from_cdr_buffer(
|
|
SanitationInjuryKind *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< SanitationInjuryKind >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjuryKind,
|
|
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
|
|
SanitationInjuryKindPlugin_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
|
|
SanitationInjuryKindPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SanitationInjuryKindPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryKind **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
|
|
SanitationInjuryKindPlugin_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
|
|
SanitationInjuryKindPlugin_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
|
|
SanitationInjuryKindPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryKindKeyHolder *dst,
|
|
const SanitationInjuryKind *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryKindPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryKind *dst, const
|
|
SanitationInjuryKindKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryKindPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SanitationInjuryKind * sample = NULL;
|
|
sample = (SanitationInjuryKind *)
|
|
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 *SanitationInjuryKindPlugin_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)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SanitationInjuryKindPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SanitationInjuryKindPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SanitationInjuryKindPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SanitationInjuryKindPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SanitationInjuryKindPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SanitationInjuryKindPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_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< ::ProjectDataManagement::SanitationInjuryKind >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::SanitationInjuryKindPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SanitationInjuryKindPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SanitationInjuryKindPlugin_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 = "ProjectDataManagement::SanitationInjuryKind";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryKindPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SanitationInjuryPlace1
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SanitationInjuryPlace1PluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SanitationInjuryPlace1 *sample = new SanitationInjuryPlace1();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SanitationInjuryPlace1 *
|
|
SanitationInjuryPlace1PluginSupport_create_data(void)
|
|
{
|
|
return (SanitationInjuryPlace1 *) SanitationInjuryPlace1PluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1PluginSupport_destroy_data(
|
|
SanitationInjuryPlace1 *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1PluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryPlace1PluginSupport_destroy_data((SanitationInjuryPlace1 *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace1PluginSupport_copy_data(
|
|
SanitationInjuryPlace1 *dst,
|
|
const SanitationInjuryPlace1 *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SanitationInjuryPlace1PluginSupport_create_keyI(void)
|
|
{
|
|
return SanitationInjuryPlace1PluginSupport_create_data();
|
|
}
|
|
|
|
SanitationInjuryPlace1 *
|
|
SanitationInjuryPlace1PluginSupport_create_key(void)
|
|
{
|
|
return (SanitationInjuryPlace1 *) SanitationInjuryPlace1PluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1PluginSupport_destroy_key(
|
|
SanitationInjuryPlace1KeyHolder *key)
|
|
{
|
|
SanitationInjuryPlace1PluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1PluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryPlace1PluginSupport_destroy_key((SanitationInjuryPlace1KeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SanitationInjuryPlace1Plugin_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< SanitationInjuryPlace1 >::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
|
|
SanitationInjuryPlace1Plugin_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
|
|
SanitationInjuryPlace1Plugin_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,
|
|
SanitationInjuryPlace1PluginSupport_create_dataI,
|
|
SanitationInjuryPlace1PluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::SanitationInjuryPlace1PluginSupport_create_keyI , ::ProjectDataManagement::SanitationInjuryPlace1PluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::SanitationInjuryPlace1Plugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SanitationInjuryPlace1Plugin_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 = ::ProjectDataManagement::SanitationInjuryPlace1Plugin_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)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1Plugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1Plugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace1 *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SanitationInjuryPlace1Plugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace1Plugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SanitationInjuryPlace1 *dst,
|
|
const SanitationInjuryPlace1 *src)
|
|
{
|
|
return ::ProjectDataManagement::SanitationInjuryPlace1PluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SanitationInjuryPlace1Plugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace1Plugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SanitationInjuryPlace1 *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< SanitationInjuryPlace1 >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjuryPlace1,
|
|
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 =
|
|
SanitationInjuryPlace1Plugin_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
|
|
SanitationInjuryPlace1Plugin_deserialize_from_cdr_buffer(
|
|
SanitationInjuryPlace1 *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< SanitationInjuryPlace1 >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjuryPlace1,
|
|
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
|
|
SanitationInjuryPlace1Plugin_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
|
|
SanitationInjuryPlace1Plugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SanitationInjuryPlace1Plugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace1 **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
|
|
SanitationInjuryPlace1Plugin_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
|
|
SanitationInjuryPlace1Plugin_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
|
|
SanitationInjuryPlace1Plugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace1KeyHolder *dst,
|
|
const SanitationInjuryPlace1 *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace1Plugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace1 *dst, const
|
|
SanitationInjuryPlace1KeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace1Plugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SanitationInjuryPlace1 * sample = NULL;
|
|
sample = (SanitationInjuryPlace1 *)
|
|
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 *SanitationInjuryPlace1Plugin_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)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SanitationInjuryPlace1Plugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SanitationInjuryPlace1Plugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SanitationInjuryPlace1Plugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SanitationInjuryPlace1Plugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SanitationInjuryPlace1Plugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SanitationInjuryPlace1Plugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_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< ::ProjectDataManagement::SanitationInjuryPlace1 >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::SanitationInjuryPlace1Plugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SanitationInjuryPlace1Plugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SanitationInjuryPlace1Plugin_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 = "ProjectDataManagement::SanitationInjuryPlace1";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace1Plugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SanitationInjuryPlace2
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SanitationInjuryPlace2PluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SanitationInjuryPlace2 *sample = new SanitationInjuryPlace2();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SanitationInjuryPlace2 *
|
|
SanitationInjuryPlace2PluginSupport_create_data(void)
|
|
{
|
|
return (SanitationInjuryPlace2 *) SanitationInjuryPlace2PluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2PluginSupport_destroy_data(
|
|
SanitationInjuryPlace2 *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2PluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryPlace2PluginSupport_destroy_data((SanitationInjuryPlace2 *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace2PluginSupport_copy_data(
|
|
SanitationInjuryPlace2 *dst,
|
|
const SanitationInjuryPlace2 *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SanitationInjuryPlace2PluginSupport_create_keyI(void)
|
|
{
|
|
return SanitationInjuryPlace2PluginSupport_create_data();
|
|
}
|
|
|
|
SanitationInjuryPlace2 *
|
|
SanitationInjuryPlace2PluginSupport_create_key(void)
|
|
{
|
|
return (SanitationInjuryPlace2 *) SanitationInjuryPlace2PluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2PluginSupport_destroy_key(
|
|
SanitationInjuryPlace2KeyHolder *key)
|
|
{
|
|
SanitationInjuryPlace2PluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2PluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::SanitationInjuryPlace2PluginSupport_destroy_key((SanitationInjuryPlace2KeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SanitationInjuryPlace2Plugin_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< SanitationInjuryPlace2 >::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
|
|
SanitationInjuryPlace2Plugin_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
|
|
SanitationInjuryPlace2Plugin_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,
|
|
SanitationInjuryPlace2PluginSupport_create_dataI,
|
|
SanitationInjuryPlace2PluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::SanitationInjuryPlace2PluginSupport_create_keyI , ::ProjectDataManagement::SanitationInjuryPlace2PluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::SanitationInjuryPlace2Plugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SanitationInjuryPlace2Plugin_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 = ::ProjectDataManagement::SanitationInjuryPlace2Plugin_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)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2Plugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2Plugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace2 *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SanitationInjuryPlace2Plugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace2Plugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SanitationInjuryPlace2 *dst,
|
|
const SanitationInjuryPlace2 *src)
|
|
{
|
|
return ::ProjectDataManagement::SanitationInjuryPlace2PluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SanitationInjuryPlace2Plugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace2Plugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SanitationInjuryPlace2 *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< SanitationInjuryPlace2 >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjuryPlace2,
|
|
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 =
|
|
SanitationInjuryPlace2Plugin_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
|
|
SanitationInjuryPlace2Plugin_deserialize_from_cdr_buffer(
|
|
SanitationInjuryPlace2 *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< SanitationInjuryPlace2 >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationInjuryPlace2,
|
|
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
|
|
SanitationInjuryPlace2Plugin_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
|
|
SanitationInjuryPlace2Plugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SanitationInjuryPlace2Plugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace2 **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
|
|
SanitationInjuryPlace2Plugin_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
|
|
SanitationInjuryPlace2Plugin_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
|
|
SanitationInjuryPlace2Plugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace2KeyHolder *dst,
|
|
const SanitationInjuryPlace2 *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace2Plugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationInjuryPlace2 *dst, const
|
|
SanitationInjuryPlace2KeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationInjuryPlace2Plugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SanitationInjuryPlace2 * sample = NULL;
|
|
sample = (SanitationInjuryPlace2 *)
|
|
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 *SanitationInjuryPlace2Plugin_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)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SanitationInjuryPlace2Plugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SanitationInjuryPlace2Plugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SanitationInjuryPlace2Plugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SanitationInjuryPlace2Plugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SanitationInjuryPlace2Plugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SanitationInjuryPlace2Plugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_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< ::ProjectDataManagement::SanitationInjuryPlace2 >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::SanitationInjuryPlace2Plugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SanitationInjuryPlace2Plugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SanitationInjuryPlace2Plugin_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 = "ProjectDataManagement::SanitationInjuryPlace2";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SanitationInjuryPlace2Plugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SanitationMaterial
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SanitationMaterialPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SanitationMaterial *sample = new SanitationMaterial();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SanitationMaterial *
|
|
SanitationMaterialPluginSupport_create_data(void)
|
|
{
|
|
return (SanitationMaterial *) SanitationMaterialPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPluginSupport_destroy_data(
|
|
SanitationMaterial *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::SanitationMaterialPluginSupport_destroy_data((SanitationMaterial *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationMaterialPluginSupport_copy_data(
|
|
SanitationMaterial *dst,
|
|
const SanitationMaterial *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SanitationMaterialPluginSupport_create_keyI(void)
|
|
{
|
|
return SanitationMaterialPluginSupport_create_data();
|
|
}
|
|
|
|
SanitationMaterial *
|
|
SanitationMaterialPluginSupport_create_key(void)
|
|
{
|
|
return (SanitationMaterial *) SanitationMaterialPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPluginSupport_destroy_key(
|
|
SanitationMaterialKeyHolder *key)
|
|
{
|
|
SanitationMaterialPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::SanitationMaterialPluginSupport_destroy_key((SanitationMaterialKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SanitationMaterialPlugin_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< SanitationMaterial >::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
|
|
SanitationMaterialPlugin_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
|
|
SanitationMaterialPlugin_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,
|
|
SanitationMaterialPluginSupport_create_dataI,
|
|
SanitationMaterialPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::SanitationMaterialPluginSupport_create_keyI , ::ProjectDataManagement::SanitationMaterialPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::SanitationMaterialPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SanitationMaterialPlugin_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 = ::ProjectDataManagement::SanitationMaterialPlugin_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)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationMaterial *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SanitationMaterialPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationMaterialPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SanitationMaterial *dst,
|
|
const SanitationMaterial *src)
|
|
{
|
|
return ::ProjectDataManagement::SanitationMaterialPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SanitationMaterialPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SanitationMaterialPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SanitationMaterial *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< SanitationMaterial >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationMaterial,
|
|
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 =
|
|
SanitationMaterialPlugin_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
|
|
SanitationMaterialPlugin_deserialize_from_cdr_buffer(
|
|
SanitationMaterial *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< SanitationMaterial >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationMaterial,
|
|
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
|
|
SanitationMaterialPlugin_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
|
|
SanitationMaterialPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SanitationMaterialPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationMaterial **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
|
|
SanitationMaterialPlugin_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
|
|
SanitationMaterialPlugin_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
|
|
SanitationMaterialPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationMaterialKeyHolder *dst,
|
|
const SanitationMaterial *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationMaterialPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationMaterial *dst, const
|
|
SanitationMaterialKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationMaterialPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SanitationMaterial * sample = NULL;
|
|
sample = (SanitationMaterial *)
|
|
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 *SanitationMaterialPlugin_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)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SanitationMaterialPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SanitationMaterialPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SanitationMaterialPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SanitationMaterialPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SanitationMaterialPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SanitationMaterialPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::SanitationMaterialPlugin_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< ::ProjectDataManagement::SanitationMaterial >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::SanitationMaterialPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SanitationMaterialPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SanitationMaterialPlugin_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 = "ProjectDataManagement::SanitationMaterial";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SanitationMaterialPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type SanitationProcedure
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
SanitationProcedurePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
SanitationProcedure *sample = new SanitationProcedure();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
SanitationProcedure *
|
|
SanitationProcedurePluginSupport_create_data(void)
|
|
{
|
|
return (SanitationProcedure *) SanitationProcedurePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePluginSupport_destroy_data(
|
|
SanitationProcedure *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::SanitationProcedurePluginSupport_destroy_data((SanitationProcedure *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationProcedurePluginSupport_copy_data(
|
|
SanitationProcedure *dst,
|
|
const SanitationProcedure *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
SanitationProcedurePluginSupport_create_keyI(void)
|
|
{
|
|
return SanitationProcedurePluginSupport_create_data();
|
|
}
|
|
|
|
SanitationProcedure *
|
|
SanitationProcedurePluginSupport_create_key(void)
|
|
{
|
|
return (SanitationProcedure *) SanitationProcedurePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePluginSupport_destroy_key(
|
|
SanitationProcedureKeyHolder *key)
|
|
{
|
|
SanitationProcedurePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::SanitationProcedurePluginSupport_destroy_key((SanitationProcedureKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
SanitationProcedurePlugin_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< SanitationProcedure >::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
|
|
SanitationProcedurePlugin_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
|
|
SanitationProcedurePlugin_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,
|
|
SanitationProcedurePluginSupport_create_dataI,
|
|
SanitationProcedurePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::SanitationProcedurePluginSupport_create_keyI , ::ProjectDataManagement::SanitationProcedurePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::SanitationProcedurePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = SanitationProcedurePlugin_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 = ::ProjectDataManagement::SanitationProcedurePlugin_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)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationProcedure *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"SanitationProcedurePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
SanitationProcedurePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
SanitationProcedure *dst,
|
|
const SanitationProcedure *src)
|
|
{
|
|
return ::ProjectDataManagement::SanitationProcedurePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
SanitationProcedurePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
SanitationProcedurePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const SanitationProcedure *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< SanitationProcedure >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationProcedure,
|
|
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 =
|
|
SanitationProcedurePlugin_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
|
|
SanitationProcedurePlugin_deserialize_from_cdr_buffer(
|
|
SanitationProcedure *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< SanitationProcedure >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
SanitationProcedure,
|
|
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
|
|
SanitationProcedurePlugin_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
|
|
SanitationProcedurePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool SanitationProcedurePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationProcedure **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
|
|
SanitationProcedurePlugin_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
|
|
SanitationProcedurePlugin_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
|
|
SanitationProcedurePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationProcedureKeyHolder *dst,
|
|
const SanitationProcedure *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationProcedurePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
SanitationProcedure *dst, const
|
|
SanitationProcedureKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
SanitationProcedurePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
SanitationProcedure * sample = NULL;
|
|
sample = (SanitationProcedure *)
|
|
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 *SanitationProcedurePlugin_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)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
SanitationProcedurePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
SanitationProcedurePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
SanitationProcedurePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
SanitationProcedurePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
SanitationProcedurePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
SanitationProcedurePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::SanitationProcedurePlugin_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< ::ProjectDataManagement::SanitationProcedure >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::SanitationProcedurePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
SanitationProcedurePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
SanitationProcedurePlugin_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 = "ProjectDataManagement::SanitationProcedure";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
SanitationProcedurePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TargetSubType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TargetSubTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TargetSubType *sample = new TargetSubType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TargetSubType *
|
|
TargetSubTypePluginSupport_create_data(void)
|
|
{
|
|
return (TargetSubType *) TargetSubTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TargetSubTypePluginSupport_destroy_data(
|
|
TargetSubType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TargetSubTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::TargetSubTypePluginSupport_destroy_data((TargetSubType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TargetSubTypePluginSupport_copy_data(
|
|
TargetSubType *dst,
|
|
const TargetSubType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
TargetSubTypePluginSupport_create_keyI(void)
|
|
{
|
|
return TargetSubTypePluginSupport_create_data();
|
|
}
|
|
|
|
TargetSubType *
|
|
TargetSubTypePluginSupport_create_key(void)
|
|
{
|
|
return (TargetSubType *) TargetSubTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
TargetSubTypePluginSupport_destroy_key(
|
|
TargetSubTypeKeyHolder *key)
|
|
{
|
|
TargetSubTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
TargetSubTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::TargetSubTypePluginSupport_destroy_key((TargetSubTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TargetSubTypePlugin_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< TargetSubType >::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
|
|
TargetSubTypePlugin_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
|
|
TargetSubTypePlugin_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,
|
|
TargetSubTypePluginSupport_create_dataI,
|
|
TargetSubTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::TargetSubTypePluginSupport_create_keyI , ::ProjectDataManagement::TargetSubTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::TargetSubTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = TargetSubTypePlugin_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 = ::ProjectDataManagement::TargetSubTypePlugin_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)
|
|
::ProjectDataManagement::TargetSubTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TargetSubTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TargetSubTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetSubType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TargetSubTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TargetSubTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TargetSubType *dst,
|
|
const TargetSubType *src)
|
|
{
|
|
return ::ProjectDataManagement::TargetSubTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TargetSubTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TargetSubTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TargetSubType *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< TargetSubType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetSubType,
|
|
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 =
|
|
TargetSubTypePlugin_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
|
|
TargetSubTypePlugin_deserialize_from_cdr_buffer(
|
|
TargetSubType *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< TargetSubType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetSubType,
|
|
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
|
|
TargetSubTypePlugin_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
|
|
TargetSubTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool TargetSubTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetSubType **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
|
|
TargetSubTypePlugin_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
|
|
TargetSubTypePlugin_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
|
|
TargetSubTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetSubTypeKeyHolder *dst,
|
|
const TargetSubType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetSubTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetSubType *dst, const
|
|
TargetSubTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetSubTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
TargetSubType * sample = NULL;
|
|
sample = (TargetSubType *)
|
|
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 *TargetSubTypePlugin_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)
|
|
::ProjectDataManagement::TargetSubTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::TargetSubTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::TargetSubTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::TargetSubTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TargetSubTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TargetSubTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TargetSubTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TargetSubTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
TargetSubTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
TargetSubTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::TargetSubTypePlugin_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< ::ProjectDataManagement::TargetSubType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::TargetSubTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TargetSubTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TargetSubTypePlugin_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 = "ProjectDataManagement::TargetSubType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TargetSubTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TargetType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TargetTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TargetType *sample = new TargetType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TargetType *
|
|
TargetTypePluginSupport_create_data(void)
|
|
{
|
|
return (TargetType *) TargetTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TargetTypePluginSupport_destroy_data(
|
|
TargetType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TargetTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::TargetTypePluginSupport_destroy_data((TargetType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypePluginSupport_copy_data(
|
|
TargetType *dst,
|
|
const TargetType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
TargetTypePluginSupport_create_keyI(void)
|
|
{
|
|
return TargetTypePluginSupport_create_data();
|
|
}
|
|
|
|
TargetType *
|
|
TargetTypePluginSupport_create_key(void)
|
|
{
|
|
return (TargetType *) TargetTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
TargetTypePluginSupport_destroy_key(
|
|
TargetTypeKeyHolder *key)
|
|
{
|
|
TargetTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
TargetTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::TargetTypePluginSupport_destroy_key((TargetTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TargetTypePlugin_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< TargetType >::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
|
|
TargetTypePlugin_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
|
|
TargetTypePlugin_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,
|
|
TargetTypePluginSupport_create_dataI,
|
|
TargetTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::TargetTypePluginSupport_create_keyI , ::ProjectDataManagement::TargetTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::TargetTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = TargetTypePlugin_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 = ::ProjectDataManagement::TargetTypePlugin_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)
|
|
::ProjectDataManagement::TargetTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TargetTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TargetTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TargetTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TargetType *dst,
|
|
const TargetType *src)
|
|
{
|
|
return ::ProjectDataManagement::TargetTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TargetTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TargetTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TargetType *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< TargetType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetType,
|
|
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 =
|
|
TargetTypePlugin_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
|
|
TargetTypePlugin_deserialize_from_cdr_buffer(
|
|
TargetType *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< TargetType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetType,
|
|
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
|
|
TargetTypePlugin_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
|
|
TargetTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool TargetTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetType **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
|
|
TargetTypePlugin_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
|
|
TargetTypePlugin_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
|
|
TargetTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetTypeKeyHolder *dst,
|
|
const TargetType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetType *dst, const
|
|
TargetTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
TargetType * sample = NULL;
|
|
sample = (TargetType *)
|
|
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 *TargetTypePlugin_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)
|
|
::ProjectDataManagement::TargetTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::TargetTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::TargetTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::TargetTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TargetTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TargetTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TargetTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TargetTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
TargetTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
TargetTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::TargetTypePlugin_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< ::ProjectDataManagement::TargetType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::TargetTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TargetTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TargetTypePlugin_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 = "ProjectDataManagement::TargetType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TargetTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TargetTypeTargetSubType
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TargetTypeTargetSubTypePluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TargetTypeTargetSubType *sample = new TargetTypeTargetSubType();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TargetTypeTargetSubType *
|
|
TargetTypeTargetSubTypePluginSupport_create_data(void)
|
|
{
|
|
return (TargetTypeTargetSubType *) TargetTypeTargetSubTypePluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePluginSupport_destroy_data(
|
|
TargetTypeTargetSubType *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePluginSupport_destroy_data((TargetTypeTargetSubType *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypeTargetSubTypePluginSupport_copy_data(
|
|
TargetTypeTargetSubType *dst,
|
|
const TargetTypeTargetSubType *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
TargetTypeTargetSubTypePluginSupport_create_keyI(void)
|
|
{
|
|
return TargetTypeTargetSubTypePluginSupport_create_data();
|
|
}
|
|
|
|
TargetTypeTargetSubType *
|
|
TargetTypeTargetSubTypePluginSupport_create_key(void)
|
|
{
|
|
return (TargetTypeTargetSubType *) TargetTypeTargetSubTypePluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePluginSupport_destroy_key(
|
|
TargetTypeTargetSubTypeKeyHolder *key)
|
|
{
|
|
TargetTypeTargetSubTypePluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePluginSupport_destroy_key((TargetTypeTargetSubTypeKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TargetTypeTargetSubTypePlugin_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< TargetTypeTargetSubType >::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
|
|
TargetTypeTargetSubTypePlugin_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
|
|
TargetTypeTargetSubTypePlugin_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,
|
|
TargetTypeTargetSubTypePluginSupport_create_dataI,
|
|
TargetTypeTargetSubTypePluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePluginSupport_create_keyI , ::ProjectDataManagement::TargetTypeTargetSubTypePluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::TargetTypeTargetSubTypePlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = TargetTypeTargetSubTypePlugin_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 = ::ProjectDataManagement::TargetTypeTargetSubTypePlugin_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)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetTypeTargetSubType *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TargetTypeTargetSubTypePlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypeTargetSubTypePlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TargetTypeTargetSubType *dst,
|
|
const TargetTypeTargetSubType *src)
|
|
{
|
|
return ::ProjectDataManagement::TargetTypeTargetSubTypePluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TargetTypeTargetSubTypePlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TargetTypeTargetSubTypePlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TargetTypeTargetSubType *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< TargetTypeTargetSubType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetTypeTargetSubType,
|
|
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 =
|
|
TargetTypeTargetSubTypePlugin_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
|
|
TargetTypeTargetSubTypePlugin_deserialize_from_cdr_buffer(
|
|
TargetTypeTargetSubType *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< TargetTypeTargetSubType >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TargetTypeTargetSubType,
|
|
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
|
|
TargetTypeTargetSubTypePlugin_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
|
|
TargetTypeTargetSubTypePlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool TargetTypeTargetSubTypePlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetTypeTargetSubType **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
|
|
TargetTypeTargetSubTypePlugin_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
|
|
TargetTypeTargetSubTypePlugin_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
|
|
TargetTypeTargetSubTypePlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetTypeTargetSubTypeKeyHolder *dst,
|
|
const TargetTypeTargetSubType *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypeTargetSubTypePlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TargetTypeTargetSubType *dst, const
|
|
TargetTypeTargetSubTypeKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TargetTypeTargetSubTypePlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
TargetTypeTargetSubType * sample = NULL;
|
|
sample = (TargetTypeTargetSubType *)
|
|
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 *TargetTypeTargetSubTypePlugin_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)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TargetTypeTargetSubTypePlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TargetTypeTargetSubTypePlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TargetTypeTargetSubTypePlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TargetTypeTargetSubTypePlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
TargetTypeTargetSubTypePlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
TargetTypeTargetSubTypePlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_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< ::ProjectDataManagement::TargetTypeTargetSubType >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::TargetTypeTargetSubTypePlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TargetTypeTargetSubTypePlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TargetTypeTargetSubTypePlugin_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 = "ProjectDataManagement::TargetTypeTargetSubType";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TargetTypeTargetSubTypePlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type TranslationBlob
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
TranslationBlobPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
TranslationBlob *sample = new TranslationBlob();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
TranslationBlob *
|
|
TranslationBlobPluginSupport_create_data(void)
|
|
{
|
|
return (TranslationBlob *) TranslationBlobPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
TranslationBlobPluginSupport_destroy_data(
|
|
TranslationBlob *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
TranslationBlobPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::TranslationBlobPluginSupport_destroy_data((TranslationBlob *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
TranslationBlobPluginSupport_copy_data(
|
|
TranslationBlob *dst,
|
|
const TranslationBlob *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
TranslationBlobPluginSupport_create_keyI(void)
|
|
{
|
|
return TranslationBlobPluginSupport_create_data();
|
|
}
|
|
|
|
TranslationBlob *
|
|
TranslationBlobPluginSupport_create_key(void)
|
|
{
|
|
return (TranslationBlob *) TranslationBlobPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
TranslationBlobPluginSupport_destroy_key(
|
|
TranslationBlobKeyHolder *key)
|
|
{
|
|
TranslationBlobPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
TranslationBlobPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::TranslationBlobPluginSupport_destroy_key((TranslationBlobKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
TranslationBlobPlugin_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< TranslationBlob >::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
|
|
TranslationBlobPlugin_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
|
|
TranslationBlobPlugin_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,
|
|
TranslationBlobPluginSupport_create_dataI,
|
|
TranslationBlobPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::TranslationBlobPluginSupport_create_keyI , ::ProjectDataManagement::TranslationBlobPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::TranslationBlobPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = TranslationBlobPlugin_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 = ::ProjectDataManagement::TranslationBlobPlugin_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)
|
|
::ProjectDataManagement::TranslationBlobPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
TranslationBlobPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
TranslationBlobPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TranslationBlob *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"TranslationBlobPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
TranslationBlobPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
TranslationBlob *dst,
|
|
const TranslationBlob *src)
|
|
{
|
|
return ::ProjectDataManagement::TranslationBlobPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
TranslationBlobPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
TranslationBlobPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const TranslationBlob *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< TranslationBlob >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TranslationBlob,
|
|
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 =
|
|
TranslationBlobPlugin_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
|
|
TranslationBlobPlugin_deserialize_from_cdr_buffer(
|
|
TranslationBlob *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< TranslationBlob >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
TranslationBlob,
|
|
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
|
|
TranslationBlobPlugin_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
|
|
TranslationBlobPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool TranslationBlobPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TranslationBlob **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
|
|
TranslationBlobPlugin_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
|
|
TranslationBlobPlugin_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
|
|
TranslationBlobPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TranslationBlobKeyHolder *dst,
|
|
const TranslationBlob *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBase *)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TranslationBlobPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
TranslationBlob *dst, const
|
|
TranslationBlobKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBasePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBase*)dst,(const ::ProjectDataManagement::PdmBase*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
TranslationBlobPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
TranslationBlob * sample = NULL;
|
|
sample = (TranslationBlob *)
|
|
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 *TranslationBlobPlugin_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)
|
|
::ProjectDataManagement::TranslationBlobPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::TranslationBlobPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::TranslationBlobPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::TranslationBlobPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
TranslationBlobPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
TranslationBlobPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
TranslationBlobPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
TranslationBlobPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
TranslationBlobPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
TranslationBlobPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::TranslationBlobPlugin_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< ::ProjectDataManagement::TranslationBlob >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::TranslationBlobPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
TranslationBlobPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
TranslationBlobPlugin_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 = "ProjectDataManagement::TranslationBlob";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
TranslationBlobPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type UpdateChargeNamesRequest
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
UpdateChargeNamesRequestPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
UpdateChargeNamesRequest *sample = new UpdateChargeNamesRequest();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
UpdateChargeNamesRequest *
|
|
UpdateChargeNamesRequestPluginSupport_create_data(void)
|
|
{
|
|
return (UpdateChargeNamesRequest *) UpdateChargeNamesRequestPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPluginSupport_destroy_data(
|
|
UpdateChargeNamesRequest *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPluginSupport_destroy_data((UpdateChargeNamesRequest *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
UpdateChargeNamesRequestPluginSupport_copy_data(
|
|
UpdateChargeNamesRequest *dst,
|
|
const UpdateChargeNamesRequest *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
UpdateChargeNamesRequestPluginSupport_create_keyI(void)
|
|
{
|
|
return UpdateChargeNamesRequestPluginSupport_create_data();
|
|
}
|
|
|
|
UpdateChargeNamesRequest *
|
|
UpdateChargeNamesRequestPluginSupport_create_key(void)
|
|
{
|
|
return (UpdateChargeNamesRequest *) UpdateChargeNamesRequestPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPluginSupport_destroy_key(
|
|
UpdateChargeNamesRequestKeyHolder *key)
|
|
{
|
|
UpdateChargeNamesRequestPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPluginSupport_destroy_key((UpdateChargeNamesRequestKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
UpdateChargeNamesRequestPlugin_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< UpdateChargeNamesRequest >::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
|
|
UpdateChargeNamesRequestPlugin_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
|
|
UpdateChargeNamesRequestPlugin_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,
|
|
UpdateChargeNamesRequestPluginSupport_create_dataI,
|
|
UpdateChargeNamesRequestPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPluginSupport_create_keyI , ::ProjectDataManagement::UpdateChargeNamesRequestPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::UpdateChargeNamesRequestPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = UpdateChargeNamesRequestPlugin_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 = ::ProjectDataManagement::UpdateChargeNamesRequestPlugin_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)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UpdateChargeNamesRequest *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"UpdateChargeNamesRequestPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
UpdateChargeNamesRequestPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
UpdateChargeNamesRequest *dst,
|
|
const UpdateChargeNamesRequest *src)
|
|
{
|
|
return ::ProjectDataManagement::UpdateChargeNamesRequestPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
UpdateChargeNamesRequestPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
UpdateChargeNamesRequestPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const UpdateChargeNamesRequest *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< UpdateChargeNamesRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UpdateChargeNamesRequest,
|
|
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 =
|
|
UpdateChargeNamesRequestPlugin_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
|
|
UpdateChargeNamesRequestPlugin_deserialize_from_cdr_buffer(
|
|
UpdateChargeNamesRequest *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< UpdateChargeNamesRequest >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
UpdateChargeNamesRequest,
|
|
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
|
|
UpdateChargeNamesRequestPlugin_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
|
|
UpdateChargeNamesRequestPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool UpdateChargeNamesRequestPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UpdateChargeNamesRequest **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
|
|
UpdateChargeNamesRequestPlugin_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
|
|
UpdateChargeNamesRequestPlugin_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
|
|
UpdateChargeNamesRequestPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UpdateChargeNamesRequestKeyHolder *dst,
|
|
const UpdateChargeNamesRequest *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UpdateChargeNamesRequestPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
UpdateChargeNamesRequest *dst, const
|
|
UpdateChargeNamesRequestKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
UpdateChargeNamesRequestPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
UpdateChargeNamesRequest * sample = NULL;
|
|
sample = (UpdateChargeNamesRequest *)
|
|
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 *UpdateChargeNamesRequestPlugin_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)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
UpdateChargeNamesRequestPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
UpdateChargeNamesRequestPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
UpdateChargeNamesRequestPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
UpdateChargeNamesRequestPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
UpdateChargeNamesRequestPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
UpdateChargeNamesRequestPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_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< ::ProjectDataManagement::UpdateChargeNamesRequest >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::UpdateChargeNamesRequestPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
UpdateChargeNamesRequestPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
UpdateChargeNamesRequestPlugin_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 = "ProjectDataManagement::UpdateChargeNamesRequest";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
UpdateChargeNamesRequestPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
* Type VulnerabilityKind
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
/* -----------------------------------------------------------------------------
|
|
Support functions:
|
|
* -------------------------------------------------------------------------- */
|
|
|
|
void *
|
|
VulnerabilityKindPluginSupport_create_dataI(void)
|
|
{
|
|
try {
|
|
VulnerabilityKind *sample = new VulnerabilityKind();
|
|
::rti::topic::allocate_sample(*sample);
|
|
return sample;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
VulnerabilityKind *
|
|
VulnerabilityKindPluginSupport_create_data(void)
|
|
{
|
|
return (VulnerabilityKind *) VulnerabilityKindPluginSupport_create_dataI();
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPluginSupport_destroy_data(
|
|
VulnerabilityKind *sample)
|
|
{
|
|
delete sample;
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPluginSupport_destroy_dataI(
|
|
void *sample)
|
|
{
|
|
::ProjectDataManagement::VulnerabilityKindPluginSupport_destroy_data((VulnerabilityKind *) sample);
|
|
}
|
|
|
|
RTIBool
|
|
VulnerabilityKindPluginSupport_copy_data(
|
|
VulnerabilityKind *dst,
|
|
const VulnerabilityKind *src)
|
|
{
|
|
try {
|
|
*dst = *src;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
}
|
|
|
|
void *
|
|
VulnerabilityKindPluginSupport_create_keyI(void)
|
|
{
|
|
return VulnerabilityKindPluginSupport_create_data();
|
|
}
|
|
|
|
VulnerabilityKind *
|
|
VulnerabilityKindPluginSupport_create_key(void)
|
|
{
|
|
return (VulnerabilityKind *) VulnerabilityKindPluginSupport_create_keyI();
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPluginSupport_destroy_key(
|
|
VulnerabilityKindKeyHolder *key)
|
|
{
|
|
VulnerabilityKindPluginSupport_destroy_data(key);
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPluginSupport_destroy_keyI(
|
|
void *key)
|
|
{
|
|
::ProjectDataManagement::VulnerabilityKindPluginSupport_destroy_key((VulnerabilityKindKeyHolder *) key);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
Callback functions:
|
|
* ---------------------------------------------------------------------------- */
|
|
|
|
PRESTypePluginParticipantData
|
|
VulnerabilityKindPlugin_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< VulnerabilityKind >::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
|
|
VulnerabilityKindPlugin_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
|
|
VulnerabilityKindPlugin_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,
|
|
VulnerabilityKindPluginSupport_create_dataI,
|
|
VulnerabilityKindPluginSupport_destroy_dataI,
|
|
::ProjectDataManagement::VulnerabilityKindPluginSupport_create_keyI , ::ProjectDataManagement::VulnerabilityKindPluginSupport_destroy_keyI);
|
|
|
|
if (epd == NULL) {
|
|
return NULL;
|
|
}
|
|
|
|
serializedKeyMaxSize = ::ProjectDataManagement::VulnerabilityKindPlugin_get_serialized_key_max_size(
|
|
epd,RTI_FALSE,RTI_CDR_ENCAPSULATION_ID_CDR_BE,0);
|
|
serializedKeyMaxSizeV2 = VulnerabilityKindPlugin_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 = ::ProjectDataManagement::VulnerabilityKindPlugin_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)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_get_serialized_sample_max_size, epd,
|
|
(PRESTypePluginGetSerializedSampleSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleSize,
|
|
epd) == RTI_FALSE) {
|
|
PRESTypePluginDefaultEndpointData_delete(epd);
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
return epd;
|
|
} catch (...) {
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPlugin_on_endpoint_detached(
|
|
PRESTypePluginEndpointData endpoint_data)
|
|
{
|
|
PRESTypePluginDefaultEndpointData_delete(endpoint_data);
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPlugin_return_sample(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
VulnerabilityKind *sample,
|
|
void *handle)
|
|
{
|
|
try {
|
|
::rti::topic::reset_sample(*sample);
|
|
} catch(const std::exception& ex) {
|
|
RTICdrLog_logWithFunctionName(
|
|
RTI_LOG_BIT_EXCEPTION,
|
|
"VulnerabilityKindPlugin_return_sample",
|
|
&RTI_LOG_ANY_FAILURE_ss,
|
|
"exception: ",
|
|
ex.what());
|
|
}
|
|
|
|
PRESTypePluginDefaultEndpointData_returnSample(
|
|
endpoint_data, sample, handle);
|
|
}
|
|
|
|
RTIBool
|
|
VulnerabilityKindPlugin_copy_sample(
|
|
PRESTypePluginEndpointData,
|
|
VulnerabilityKind *dst,
|
|
const VulnerabilityKind *src)
|
|
{
|
|
return ::ProjectDataManagement::VulnerabilityKindPluginSupport_copy_data(dst,src);
|
|
}
|
|
|
|
/* ----------------------------------------------------------------------------
|
|
(De)Serialize functions:
|
|
* ------------------------------------------------------------------------- */
|
|
unsigned int
|
|
VulnerabilityKindPlugin_get_serialized_sample_max_size(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
RTIBool include_encapsulation,
|
|
RTIEncapsulationId encapsulation_id,
|
|
unsigned int current_alignment);
|
|
|
|
RTIBool
|
|
VulnerabilityKindPlugin_serialize_to_cdr_buffer(
|
|
char * buffer,
|
|
unsigned int * length,
|
|
const VulnerabilityKind *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< VulnerabilityKind >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
VulnerabilityKind,
|
|
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 =
|
|
VulnerabilityKindPlugin_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
|
|
VulnerabilityKindPlugin_deserialize_from_cdr_buffer(
|
|
VulnerabilityKind *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< VulnerabilityKind >::get().native()
|
|
;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
pd.programs = ::rti::topic::interpreter::get_cdr_serialization_programs<
|
|
VulnerabilityKind,
|
|
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
|
|
VulnerabilityKindPlugin_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
|
|
VulnerabilityKindPlugin_get_key_kind(void)
|
|
{
|
|
return PRES_TYPEPLUGIN_USER_KEY;
|
|
}
|
|
|
|
RTIBool VulnerabilityKindPlugin_deserialize_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
VulnerabilityKind **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
|
|
VulnerabilityKindPlugin_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
|
|
VulnerabilityKindPlugin_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
|
|
VulnerabilityKindPlugin_instance_to_key(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
VulnerabilityKindKeyHolder *dst,
|
|
const VulnerabilityKind *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_instance_to_key(endpoint_data,(::ProjectDataManagement::PdmBaseName *)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
VulnerabilityKindPlugin_key_to_instance(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
VulnerabilityKind *dst, const
|
|
VulnerabilityKindKeyHolder *src)
|
|
{
|
|
try {
|
|
if (!::ProjectDataManagement::PdmBaseNamePlugin_key_to_instance(endpoint_data,(::ProjectDataManagement::PdmBaseName*)dst,(const ::ProjectDataManagement::PdmBaseName*)src)) {
|
|
return RTI_FALSE;
|
|
}
|
|
return RTI_TRUE;
|
|
} catch (...) {
|
|
return RTI_FALSE;
|
|
}
|
|
}
|
|
|
|
RTIBool
|
|
VulnerabilityKindPlugin_serialized_sample_to_keyhash(
|
|
PRESTypePluginEndpointData endpoint_data,
|
|
struct RTICdrStream *cdrStream,
|
|
DDS_KeyHash_t *keyhash,
|
|
RTIBool deserialize_encapsulation,
|
|
void *endpoint_plugin_qos)
|
|
{
|
|
VulnerabilityKind * sample = NULL;
|
|
sample = (VulnerabilityKind *)
|
|
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 *VulnerabilityKindPlugin_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)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_on_participant_attached;
|
|
plugin->onParticipantDetached =
|
|
(PRESTypePluginOnParticipantDetachedCallback)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_on_participant_detached;
|
|
plugin->onEndpointAttached =
|
|
(PRESTypePluginOnEndpointAttachedCallback)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_on_endpoint_attached;
|
|
plugin->onEndpointDetached =
|
|
(PRESTypePluginOnEndpointDetachedCallback)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_on_endpoint_detached;
|
|
|
|
plugin->copySampleFnc =
|
|
(PRESTypePluginCopySampleFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_copy_sample;
|
|
plugin->createSampleFnc =
|
|
(PRESTypePluginCreateSampleFunction)
|
|
VulnerabilityKindPlugin_create_sample;
|
|
plugin->destroySampleFnc =
|
|
(PRESTypePluginDestroySampleFunction)
|
|
VulnerabilityKindPlugin_destroy_sample;
|
|
|
|
plugin->serializeFnc =
|
|
(PRESTypePluginSerializeFunction) PRESTypePlugin_interpretedSerialize;
|
|
plugin->deserializeFnc =
|
|
(PRESTypePluginDeserializeFunction) PRESTypePlugin_interpretedDeserializeWithAlloc;
|
|
plugin->getSerializedSampleMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMaxSizeFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_get_serialized_sample_max_size;
|
|
plugin->getSerializedSampleMinSizeFnc =
|
|
(PRESTypePluginGetSerializedSampleMinSizeFunction)
|
|
PRESTypePlugin_interpretedGetSerializedSampleMinSize;
|
|
plugin->getDeserializedSampleMaxSizeFnc = NULL;
|
|
plugin->getSampleFnc =
|
|
(PRESTypePluginGetSampleFunction)
|
|
VulnerabilityKindPlugin_get_sample;
|
|
plugin->returnSampleFnc =
|
|
(PRESTypePluginReturnSampleFunction)
|
|
VulnerabilityKindPlugin_return_sample;
|
|
plugin->getKeyKindFnc =
|
|
(PRESTypePluginGetKeyKindFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_get_key_kind;
|
|
|
|
plugin->getSerializedKeyMaxSizeFnc =
|
|
(PRESTypePluginGetSerializedKeyMaxSizeFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_get_serialized_key_max_size;
|
|
plugin->serializeKeyFnc =
|
|
(PRESTypePluginSerializeKeyFunction)
|
|
PRESTypePlugin_interpretedSerializeKey;
|
|
plugin->deserializeKeyFnc =
|
|
(PRESTypePluginDeserializeKeyFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_deserialize_key;
|
|
plugin->deserializeKeySampleFnc =
|
|
(PRESTypePluginDeserializeKeySampleFunction)
|
|
PRESTypePlugin_interpretedDeserializeKey;
|
|
|
|
plugin-> instanceToKeyHashFnc =
|
|
(PRESTypePluginInstanceToKeyHashFunction)
|
|
PRESTypePlugin_interpretedInstanceToKeyHash;
|
|
plugin->serializedSampleToKeyHashFnc =
|
|
(PRESTypePluginSerializedSampleToKeyHashFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_serialized_sample_to_keyhash;
|
|
|
|
plugin->getKeyFnc =
|
|
(PRESTypePluginGetKeyFunction)
|
|
VulnerabilityKindPlugin_get_key;
|
|
plugin->returnKeyFnc =
|
|
(PRESTypePluginReturnKeyFunction)
|
|
VulnerabilityKindPlugin_return_key;
|
|
|
|
plugin->instanceToKeyFnc =
|
|
(PRESTypePluginInstanceToKeyFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_instance_to_key;
|
|
plugin->keyToInstanceFnc =
|
|
(PRESTypePluginKeyToInstanceFunction)
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_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< ::ProjectDataManagement::VulnerabilityKind >::get().native();
|
|
} catch (...) {
|
|
::ProjectDataManagement::VulnerabilityKindPlugin_delete(plugin);
|
|
return NULL;
|
|
}
|
|
#endif
|
|
plugin->languageKind = PRES_TYPEPLUGIN_CPPSTL_LANG;
|
|
|
|
/* Serialized buffer */
|
|
plugin->getBuffer =
|
|
(PRESTypePluginGetBufferFunction)
|
|
VulnerabilityKindPlugin_get_buffer;
|
|
plugin->returnBuffer =
|
|
(PRESTypePluginReturnBufferFunction)
|
|
VulnerabilityKindPlugin_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 = "ProjectDataManagement::VulnerabilityKind";
|
|
plugin->endpointTypeName = TYPE_NAME;
|
|
plugin->isMetpType = RTI_FALSE;
|
|
plugin->isRecursiveType = RTI_FALSE;
|
|
return plugin;
|
|
}
|
|
|
|
void
|
|
VulnerabilityKindPlugin_delete(struct PRESTypePlugin *plugin)
|
|
{
|
|
RTIOsapiHeap_freeStructure(plugin);
|
|
}
|
|
} /* namespace ProjectDataManagement */
|
|
|
|
#undef RTI_CDR_CURRENT_SUBMODULE
|