コード例 #1
0
ファイル: ncbi_conn_stream.cpp プロジェクト: swuecho/igblast
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
}
コード例 #2
0
ファイル: BitMask2.cpp プロジェクト: Mavrx-inc/gdal
// 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;
}
コード例 #3
0
ファイル: main.cpp プロジェクト: spayne/sigevo_champ
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;
}
コード例 #4
0
ファイル: 12_22.cpp プロジェクト: Mlieou/cpp_primer
int main() {
    const StrBlob sb;
    ConstStrBlobPtr csb(sb);

    return 0;
}