public void serialize_key(
      Object endpoint_data,
      Object src,
      CdrOutputStream dst,
      boolean serialize_encapsulation,
      short encapsulation_id,
      boolean serialize_key,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (serialize_encapsulation) {
      dst.serializeAndSetCdrEncapsulation(encapsulation_id);

      position = dst.resetAlignment();
    }

    if (serialize_key) {

      SequenceOfGenerationControlSetPoints typedSrc = (SequenceOfGenerationControlSetPoints) src;
      org.openfmb.model.dds.rti.common.SetPointTypeSupport.get_instance()
          .serialize_sequence(
              endpoint_data,
              dst,
              typedSrc.userData,
              ((org.openfmb.model.dds.rti.generation.MaxLengthGenerationControlSetPoints.VALUE)),
              endpoint_plugin_qos);
    }

    if (serialize_encapsulation) {
      dst.restoreAlignment(position);
    }
  }
  public void serialize_key(
      Object endpoint_data,
      Object src,
      CdrOutputStream dst,
      boolean serialize_encapsulation,
      short encapsulation_id,
      boolean serialize_key,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (serialize_encapsulation) {

      dst.serializeAndSetCdrEncapsulation(encapsulation_id);

      position = dst.resetAlignment();
    }

    if (serialize_key) {
      BaseValueType typedSrc = (BaseValueType) src;

      dst.writeInt(typedSrc.longMember1);
    }

    if (serialize_encapsulation) {
      dst.restoreAlignment(position);
    }
  }
  public void serialize_key(
      Object endpoint_data,
      Object src,
      CdrOutputStream dst,
      boolean serialize_encapsulation,
      short encapsulation_id,
      boolean serialize_key,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (serialize_encapsulation) {
      dst.serializeAndSetCdrEncapsulation(encapsulation_id);

      position = dst.resetAlignment();
    }

    if (serialize_key) {

      EndDeviceControl typedSrc = (EndDeviceControl) src;
      serialize(
          endpoint_data,
          src,
          dst,
          false,
          CdrEncapsulation.CDR_ENCAPSULATION_ID_CDR_BE,
          true,
          endpoint_plugin_qos);
    }

    if (serialize_encapsulation) {
      dst.restoreAlignment(position);
    }
  }
  public void serialize(
      Object endpoint_data,
      Object src,
      CdrOutputStream dst,
      boolean serialize_encapsulation,
      short encapsulation_id,
      boolean serialize_sample,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (serialize_encapsulation) {
      dst.serializeAndSetCdrEncapsulation(encapsulation_id);

      position = dst.resetAlignment();
    }

    if (serialize_sample) {

      EndDeviceControl typedSrc = (EndDeviceControl) src;

      dst.writeString(typedSrc.issueID, (255));

      dst.writeString(typedSrc.name, (255));

      org.openfmb.model.dds.rti.openfmb.commonmodule.EndDeviceControlTypeTypeSupport.get_instance()
          .serialize(
              endpoint_data,
              typedSrc.endDeviceControlType,
              dst,
              false,
              encapsulation_id,
              true,
              endpoint_plugin_qos);

      org.openfmb.model.dds.rti.openfmb.commonmodule.DateTimeIntervalTypeSupport.get_instance()
          .serialize(
              endpoint_data,
              typedSrc.scheduledInterval,
              dst,
              false,
              encapsulation_id,
              true,
              endpoint_plugin_qos);

      org.openfmb.model.dds.rti.openfmb.commonmodule.SequenceOfEndDeviceControlSetPointsTypeSupport
          .get_instance()
          .serialize(
              endpoint_data,
              typedSrc.setPoints,
              dst,
              false,
              encapsulation_id,
              true,
              endpoint_plugin_qos);
    }

    if (serialize_encapsulation) {
      dst.restoreAlignment(position);
    }
  }
  public void serialize(
      Object endpoint_data,
      Object src,
      CdrOutputStream dst,
      boolean serialize_encapsulation,
      short encapsulation_id,
      boolean serialize_sample,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (serialize_encapsulation) {
      dst.serializeAndSetCdrEncapsulation(encapsulation_id);

      position = dst.resetAlignment();
    }

    if (serialize_sample) {

      SunRadiationData typedSrc = (SunRadiationData) src;

      dst.writeLong(typedSrc.timestamp);

      dst.writeFloat(typedSrc.value);
    }

    if (serialize_encapsulation) {
      dst.restoreAlignment(position);
    }
  }
  @Override
  public void serialize_key(
      Object endpoint_data,
      Object src,
      CdrOutputStream dst,
      boolean serialize_encapsulation,
      short encapsulation_id,
      boolean serialize_key,
      Object endpoint_plugin_qos) {
    int position = 0;

    if (serialize_encapsulation) {

      dst.serializeAndSetCdrEncapsulation(encapsulation_id);

      position = dst.resetAlignment();
    }

    if (serialize_key) {
      MDSConnectivity typedSrc = (MDSConnectivity) src;

      dst.writeString(typedSrc.unique_device_identifier, (64));
    }

    if (serialize_encapsulation) {
      dst.restoreAlignment(position);
    }
  }
  /* Fill in the fields of the given KeyHash based on the key field(s)
   * of the given instance sample.
   * Important: The fields of the instance ID cannot all be set to zero!
   */
  @Override
  public void instance_to_keyhash(Object endpoint_data, KeyHash_t keyhash, Object instance) {
    DefaultEndpointData endpointData = (DefaultEndpointData) endpoint_data;
    CdrOutputStream md5Stream = endpointData.get_stream();
    CdrBuffer buffer = null;

    if (md5Stream == null) {
      throw new RETCODE_ERROR("Missing MD5 stream");
    }

    buffer = md5Stream.getBuffer();
    buffer.resetBufferToZero();

    md5Stream.resetAndSetDirtyBit(true);

    serialize_key(
        endpoint_data,
        instance,
        md5Stream,
        false,
        CdrEncapsulation.CDR_ENCAPSULATION_ID_CDR_BE,
        true,
        null);

    if (endpointData.get_serialized_key_max_size() > KeyHash_t.KEY_HASH_MAX_LENGTH) {
      md5Stream.computeMD5(keyhash.value);
    } else {
      System.arraycopy(buffer.getBuffer(), 0, keyhash.value, 0, buffer.currentPosition());
      System.arraycopy(
          KeyHash_t.ZERO_KEYHASH.value,
          buffer.currentPosition(),
          keyhash.value,
          buffer.currentPosition(),
          KeyHash_t.KEY_HASH_MAX_LENGTH - buffer.currentPosition());
    }

    keyhash.length = KeyHash_t.KEY_HASH_MAX_LENGTH;
  }