Exemple #1
0
bool
sp::AreFunctionTypesEqual(FunctionType *a, FunctionType *b)
{
  FunctionSignature *af = a->signature();
  FunctionSignature *bf = b->signature();
  if (!AreTypesEquivalent(af->returnType().resolved(),
                          bf->returnType().resolved(),
                          Qualifiers::None))
  {
    return false;
  }

  ParameterList *ap = af->parameters();
  ParameterList *bp = bf->parameters();
  if (ap->length() != bp->length())
    return false;

  for (size_t i = 0; i < ap->length(); i++) {
    VarDecl *arga = ap->at(i);
    VarDecl *argb = bp->at(i);
    if (!AreTypesEquivalent(arga->te().resolved(),
                            argb->te().resolved(),
                            Qualifiers::None))
    {
      return false;
    }
  }
  return true;
}
  bool send_frag(const OpenDDS::DCPS::EntityId_t& writer, CORBA::ULong i,
                 const SequenceNumber_t& seq, const ACE_INET_Addr& send_to)
  {
    static const CORBA::ULong N = 3; // number of fragments to send
    ParameterList inlineQoS;
    if (i == 0) {
      inlineQoS.length(1);
      inlineQoS[0].string_data("my_topic_name");
      inlineQoS[0]._d(PID_TOPIC_NAME);
    }
#ifdef __SUNPRO_CC
    DataFragSubmessage df;
    df.smHeader.submessageId = DATA_FRAG;
    df.smHeader.flags = FLAG_E | (i ? 0 : FLAG_Q);
    df.smHeader.submessageLength = 0;
    df.extraFlags = 0;
    df.octetsToInlineQos = DATA_FRAG_OCTETS_TO_IQOS;
    df.readerId = ENTITYID_UNKNOWN;
    df.writerId = writer;
    df.writerSN = seq;
    df.fragmentStartingNum.value = i + 1;
    df.fragmentsInSubmessage = 1;
    df.fragmentSize = FRAG_SIZE;
    df.sampleSize = N * FRAG_SIZE;
    df.inlineQos = inlineQoS;
#else
    const DataFragSubmessage df = {
      {DATA_FRAG, CORBA::Octet(FLAG_E | (i ? 0 : FLAG_Q)), 0},
      0, DATA_FRAG_OCTETS_TO_IQOS, ENTITYID_UNKNOWN, writer, seq,
      {i + 1},       // fragmentStartingNum
      1,             // fragmentsInSubmessage
      FRAG_SIZE,     // fragmentSize (smallest fragmentSize allowed is 1KB)
      N * FRAG_SIZE, // sampleSize
      inlineQoS
    };
#endif
    size_t size = 0, padding = 0;
    gen_find_size(hdr_, size, padding);
    gen_find_size(df, size, padding);
    size += FRAG_SIZE;
    ACE_Message_Block mb(size + padding);
    Serializer ser(&mb, host_is_bigendian, Serializer::ALIGN_CDR);
    const ACE_CDR::ULong encap = 0x00000100; // {CDR_LE, options} in LE format
    bool ok = (ser << hdr_) && (ser << df);
    if (i == 0) ok &= (ser << encap);
    ok &= ser.write_octet_array(data_for_frag_,
                                i ? FRAG_SIZE : FRAG_SIZE - 4);
    if (!ok) {
      ACE_DEBUG((LM_DEBUG, "ERROR: failed to serialize data frag %d\n", i));
      return false;
    }
    return send(mb, send_to);
  }