Create type code from serialized type object bytes in C#

4 posts / 0 new
Last post
Offline
Last seen: 6 years 8 months ago
Joined: 04/03/2018
Posts: 3
Create type code from serialized type object bytes in C#

Using the C# API, I would like to create type code from the serialized type object blob stored in the SQLite file created by the RTI logger. I already do this in C++ using the following method but I have been unable to find the equivalent in C#. I am using DDS 5.3.1. Thank you.

RtiTypeCode CreateTypeCode(const char* data_in, size_t len, DDS_TypeObjectFactory* factory)
{

 if (len == 0) { return nullptr; }

auto data = std::make_shared<std::vector<char>>(len);
  std::copy_n(data_in, len, data->begin());

if (factory != nullptr) {
    auto type_object = DDS_TypeObjectFactory_create_typeobject_from_serialize_buffer(factory, data->data(), data->size());
    auto type_code = DDS_TypeObject_convert_to_typecode(type_object);
    return RtiTypeCode(type_code, [](DDS::TypeCode* p){
       RTICdrTypeCode_destroyTypeCode(reinterpret_cast<RTICdrTypeCode*>(p));
    });
  }

auto cdr_type_code = reinterpret_cast<RTICdrTypeCode*>(data->data());
  auto type_code = reinterpret_cast<DDS::TypeCode*>(cdr_type_code);
  return RtiTypeCode(type_code, [data](DDS::TypeCode*){});
}

 

Organization:
Offline
Last seen: 6 years 8 months ago
Joined: 04/03/2018
Posts: 3

Correction. I'm using 5.2.3 on C# and 5.3.1 on C++. I'll update my C# to 5.3.1 and re-investigate.

Offline
Last seen: 6 years 8 months ago
Joined: 04/03/2018
Posts: 3

I have updated to 5.3.1 and I am still unable to find the equivalent to DDS_TypeObjectFactory_create_typeobject_from_serialize_buffer in the C# API.

sara's picture
Offline
Last seen: 4 weeks 9 hours ago
Joined: 01/16/2013
Posts: 128

Hi Chris,

I took a look and couldn't find the API you mention exposed in C#. If you need this, please contact your FAE and they will follow up internally on this. Basically, we will file a request, get an estimate from Engineering, and provide a priority compared to other features requested. If somebody else needs this, let us know and we'll add them to the requesters list as well.

If you do not know who you FAE is, let me know and I'll follow up myself.

All the best,
Sara