Net-NATS-Streaming-PB

 view release on metacpan or  search on metacpan

PB.xs  view on Meta::CPAN

#ifdef __cplusplus
extern "C" {
#endif
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#ifdef __cplusplus
}
#endif
#ifdef do_open
#undef do_open
#endif
#ifdef do_close
#undef do_close
#endif
#ifdef New
#undef New
#endif
#include <stdint.h>
#include <sstream>
#ifdef Move
#undef Move
#endif
#include "nats_streaming.pb.h"

using namespace std;


typedef ::Net::NATS::Streaming::PB::PubMsg __Net__NATS__Streaming__PB__PubMsg;
typedef ::Net::NATS::Streaming::PB::PubAck __Net__NATS__Streaming__PB__PubAck;
typedef ::Net::NATS::Streaming::PB::MsgProto __Net__NATS__Streaming__PB__MsgProto;
typedef ::Net::NATS::Streaming::PB::Ack __Net__NATS__Streaming__PB__Ack;
typedef ::Net::NATS::Streaming::PB::ConnectRequest __Net__NATS__Streaming__PB__ConnectRequest;
typedef ::Net::NATS::Streaming::PB::ConnectResponse __Net__NATS__Streaming__PB__ConnectResponse;
typedef ::Net::NATS::Streaming::PB::SubscriptionRequest __Net__NATS__Streaming__PB__SubscriptionRequest;
typedef ::Net::NATS::Streaming::PB::SubscriptionResponse __Net__NATS__Streaming__PB__SubscriptionResponse;
typedef ::Net::NATS::Streaming::PB::UnsubscribeRequest __Net__NATS__Streaming__PB__UnsubscribeRequest;
typedef ::Net::NATS::Streaming::PB::CloseRequest __Net__NATS__Streaming__PB__CloseRequest;
typedef ::Net::NATS::Streaming::PB::CloseResponse __Net__NATS__Streaming__PB__CloseResponse;


static ::Net::NATS::Streaming::PB::Ack *
__Net__NATS__Streaming__PB__Ack_from_hashref ( SV * sv0 )
{
  ::Net::NATS::Streaming::PB::Ack * msg0 = new ::Net::NATS::Streaming::PB::Ack;

  if ( SvROK(sv0) && SvTYPE(SvRV(sv0)) == SVt_PVHV ) {
    HV *  hv0 = (HV *)SvRV(sv0);
    SV ** sv1;

    if ( (sv1 = hv_fetch(hv0, "subject", sizeof("subject") - 1, 0)) != NULL ) {
      STRLEN len;
      char * str;
      string sval;

      str = SvPV(*sv1, len);
      sval.assign(str, len);
      msg0->set_subject(sval);
    }
    if ( (sv1 = hv_fetch(hv0, "sequence", sizeof("sequence") - 1, 0)) != NULL ) {
      uint64_t uv0 = strtoull(SvPV_nolen(*sv1), NULL, 0);

      msg0->set_sequence(uv0);
    }
  }

  return msg0;
}

static ::Net::NATS::Streaming::PB::CloseRequest *
__Net__NATS__Streaming__PB__CloseRequest_from_hashref ( SV * sv0 )
{
  ::Net::NATS::Streaming::PB::CloseRequest * msg0 = new ::Net::NATS::Streaming::PB::CloseRequest;

  if ( SvROK(sv0) && SvTYPE(SvRV(sv0)) == SVt_PVHV ) {
    HV *  hv0 = (HV *)SvRV(sv0);
    SV ** sv1;

    if ( (sv1 = hv_fetch(hv0, "clientID", sizeof("clientID") - 1, 0)) != NULL ) {
      STRLEN len;
      char * str;
      string sval;

      str = SvPV(*sv1, len);



( run in 0.970 second using v1.01-cache-2.11-cpan-39bf76dae61 )