예제 #1
0
 // 写入数据
 size_t NetMessage::write(const void *data, size_t size)
 {
     ensure_writable_bytes(size);
     if (!is_dynmic())
     {
         memcpy(static_data_ + writer_pos_, data, size);
     }
     else
     {
         dynamic_data_->insert(dynamic_data_->begin() + writer_pos_,
             reinterpret_cast<const uint8_t*>(data),
             reinterpret_cast<const uint8_t*>(data)+size);
     }
     has_written(size);
     return size;
 }
예제 #2
0
CAVirtualVG::CAVirtualVG(RefEntity *owner, const CubitSimpleAttrib &simple_attrib)
        : CubitAttrib(owner)
{
  numVC = 0;
  numVV = 0;

  if(!simple_attrib.isEmpty())
  {
     // generate a simple attribute containing the data in this CA
    const std::vector<double> &d_list = simple_attrib.double_data_list();
    const std::vector<int> &i_list = simple_attrib.int_data_list();

      // (no string)

      // now the integers
      // numVV, numVC
    int offset = 0;
    numVV = i_list[offset++];
    numVC = i_list[offset++];

      // vgUIDs
    int i;
    for (i = numVV+(3*numVC); i > 0; i--)
      vgUIDs.append(i_list[offset++]);

      // numVCPoints
    int sum = 0;
    for (i = numVC; i > 0; i--) {
      int temp_int = i_list[offset++];
      numVCPoints.append(temp_int);
      sum += temp_int;
    }

    offset = 0;
      // pointUIDList
    for (i = numVV+sum; i > 0; i--) {
      double x = d_list[offset++];
      double y = d_list[offset++];
      double z = d_list[offset++];
      posVector.append(new CubitVector( x, y, z ) );
    }

      // If we are constructing from a CubitSimpleAttrib,
      // then this attrib is already written
    has_written(CUBIT_TRUE);
  }
}