Ejemplo n.º 1
0
BEGIN_NCBI_SCOPE


CConn_IOStream::CConn_IOStream(const TConn_Pair& connpair,
                               const STimeout* timeout,
                               size_t buf_size, TConn_Flags flags,
                               CT_CHAR_TYPE* ptr, size_t size)
    : CNcbiIostream(0), m_CSb(0)
{
    auto_ptr<CConn_Streambuf>
        csb(new CConn_Streambuf(connpair.first, connpair.second,
                                timeout, buf_size, flags, ptr, size));
    CONN conn = csb->GetCONN();
    if (conn) {
        SOCK s/*dummy*/;
        // CONN_Write(0 bytes) could have caused the same effect as GetSOCK
        (void) CONN_GetSOCK(conn, &s);  // Prompt CONN to actually open
        if (CONN_Status(conn, eIO_Open) == eIO_Success) {
            init(csb.get());
            m_CSb = csb.release();
            return;
        }
    }
    init(0); // according to the standard (27.4.4.1.3), badbit is set here
}
Ejemplo n.º 2
0
// Number of bits set.
// We really only need to know if full, empty or in between
int BitMask2::CountValidBits() const
{
  assert(Size());
  const Byte* ptr = m_pBits;
  int sum = 0;

  // The first loop is in multiples of four, to let the compiler optimize
  for (int i = 0; i < (Size()/4) * 4; i++)
      sum += csb(*ptr++);
  // Second loop for the leftover bytes, up to three
  for (int i = 0; i < Size() % 4; i++)
      sum += csb(*ptr++);

  // Subtract the defined bits potentially contained in the last byte
  // Number of undefined bytes is (C*R)%8
  // The undefined bits are at the low bit position, use a mask for them
  sum -= csb((*--ptr) & ((1 << ((m_nCols * m_nRows) % 8)) -1));

  return sum;
}
Ejemplo n.º 3
0
int main(int argc, char **argv)
{
	ros::init(argc, argv, "simple_driver");
	ros::NodeHandle nh;

	ros::Publisher publisher = nh.advertise<sigevo_champ::CarControl> ("torcs_car_control",5);  
	CarStateFunctor csb(&publisher);
	ros::Subscriber subscriber = nh.subscribe<sigevo_champ::CarState> ("torcs_car_state",5, csb);

	ros::spin();

	return 0;
}
Ejemplo n.º 4
0
int main() {
    const StrBlob sb;
    ConstStrBlobPtr csb(sb);

    return 0;
}