看板 C_and_CPP 關於我們 聯絡資訊
請問是要實作成 CQueuedPipe::RemoveQHeadFromQueue(){..} 這樣嗎? 還是實作這個即可 CBulkPipe::RemoveQHeadFromQueue(){..} source code如下 class CBulkPipe : public CQueuedPipe { ... protected : virtual BOOL RemoveQHeadFromQueue(); virtual BOOL InsertQHeadToQueue() ; ... } class CQueuedPipe : public CPipe { public: CQueuedPipe(xxx); virtual ~CQueuedPipe(); protected: virtual BOOL RemoveQHeadFromQueue() = 0; virtual BOOL InsertQHeadToQueue() = 0 ; ... } BOOL CBulkPipe::RemoveQHeadFromQueue() { ASSERT(m_pPipeQHead); return (m_pCEhcd->AsyncDequeueQH( m_pPipeQHead )!=NULL); } BOOL CBulkPipe::InsertQHeadToQueue() { ASSERT(m_pPipeQHead); return (m_pCEhcd->AsyncQueueQH( m_pPipeQHead )!=NULL); } ============================================================================= ※ 引述《liptonbin (我還存在耶)》之銘言: 請問我在CreateBulkPipe的return new CBulkPipe(xxx)跳出下面錯誤 請問有人知道是什 麼問題嗎 謝謝 error C2259: 'CBulkPipe' : cannot instantiate abstract class 如下圖,太多參數我就打xxxx Cpipe.cpp: CBulkPipe::CBulkPipe(xxxxx) : CQueuedPipe(xxxx) // constructor for base class { DEBUGMSG( ZONE_PIPE && ZONE_VERBOSE, (TEXT("+CBulkPipe::CBulkPipe\n")) ); DEBUGCHK( !fIsLowSpeed ); // bulk pipe must be high speed DEBUGMSG( ZONE_PIPE && ZONE_VERBOSE, (TEXT("-CBulkPipe::CBulkPipe\n")) ); } CBulkPipe::~CBulkPipe( ) { DEBUGMSG( ZONE_PIPE && ZONE_VERBOSE, (TEXT("+CBulkPipe::~CBulkPipe\n")) ); ClosePipe(); DEBUGMSG( ZONE_PIPE && ZONE_VERBOSE, (TEXT("-CBulkPipe::~CBulkPipe\n")) ); } BOOL CBulkPipe::RemoveQHeadFromQueue() { ASSERT(m_pPipeQHead); return (m_pCEhcd->AsyncDequeueQH( m_pPipeQHead )!=NULL); } BOOL CBulkPipe::InsertQHeadToQueue() { ASSERT(m_pPipeQHead); return (m_pCEhcd->AsyncQueueQH( m_pPipeQHead )!=NULL); } CPipeAbs * CreateBulkPipe(xxxx) { return new CBulkPipe(lpEndpointDescriptor,fIsLowSpeed,fIsHighSpeed,bDeviceAddress,bHubAddress,bHubPort,ttContext,(CEhcd * const)pChcd); //!!!!!這邊跳出錯誤 error C2259: 'CBulkPipe' : cannot instantiate abstract class } ---------------------------------------------------------------------------------------------------- class CPipeAbs { // Abstract Pipe class. public: CPipeAbs(UCHAR const bEndpointAddress):m_bEndpointAddress(bEndpointAddress) {;}; virtual ~CPipeAbs() {;}; virtual HCD_REQUEST_STATUS OpenPipe( void ) = 0; virtual HCD_REQUEST_STATUS ClosePipe( void ) = 0; virtual HCD_REQUEST_STATUS IssueTransfer( xxx)=0; virtual HCD_REQUEST_STATUS AbortTransfer( xxx ) = 0; virtual HCD_REQUEST_STATUS IsPipeHalted( OUT LPBOOL const lpbHalted )=0; virtual void ClearHaltedFlag( void )=0; virtual void ResetEndPoint(void) = 0; virtual void ChangeMaxPacketSize( IN const USHORT ) {ASSERT(FALSE);}; virtual BOOL SetReservedDeviceAddr(UCHAR bReservedDeviceAddr)=0; virtual UCHAR GetReservedDeviceAddr()=0; UCHAR const m_bEndpointAddress; }; CPipeAbs * CreateBulkPipe(xxx); CPipeAbs * CreateControlPipe(xxx); CPipeAbs * CreateInterruptPipe(xxx); CPipeAbs * CreateIsochronousPipe(xxx);} ---------------------------------------------------------------------------------------------------------- Cpipe.h: class CBulkPipe : public CQueuedPipe { public: CBulkPipe(xxxxx); ~CBulkPipe(); virtual PIPE_TYPE GetType () { return TYPE_BULK; }; HCD_REQUEST_STATUS OpenPipe( void ); HCD_REQUEST_STATUS ClosePipe( void ); protected : virtual BOOL RemoveQHeadFromQueue(); virtual BOOL InsertQHeadToQueue() ; private: BOOL AreTransferParametersValid( const STransfer *pTransfer = NULL ) const; }; -- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.124.0.175
wangm4a1:CBulkPipe 繼承 CQueuedPipe 有函式沒實作嗎? 04/16 20:28
-- -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 27.147.29.81
mail6543210:你要init class就要先實作其所有virtual function 04/16 22:21
※ 編輯: liptonbin 來自: 27.147.29.81 (04/16 22:38)
dayyeah:CE EHCI driver? 04/17 01:06