5 changed files with 91 additions and 2 deletions
-
4Projects/img_mill/IM_DnnWorker.cpp
-
2Projects/img_mill/img_mill.vpj
-
2Projects/img_mill/makefile
-
54lib/App/common/targetPipeLine.cpp
-
31lib/App/common/targetPipeLine.h
@ -0,0 +1,54 @@ |
|||
#include "targetPipeLine.h"
|
|||
|
|||
targetPileLine::targetPileLine():basicThread(){ |
|||
|
|||
}; |
|||
|
|||
targetPileLine::~targetPileLine(){ |
|||
|
|||
}; |
|||
|
|||
void targetPileLine::m_fThreadProc( void ){ |
|||
m_bThreadStatus = TH_WORKING; |
|||
while( m_bThreadStatus < TH_ENDED ) { |
|||
m_mTargetProtector.lock(); |
|||
if ( m_qTargets.size() ){ |
|||
TARGET_DATA tData = m_qTargets[0]; |
|||
m_qTargets.pop(); |
|||
m_mTargetProtector.unlock(); |
|||
if ( tData ) { |
|||
bool propogateTarget = true; |
|||
for ( vectorKernelEventFilters::iterator idx = m_vTargetFilters.begin(); ( idx != m_vTargetFilters.end() ) && ( m_bThreadStatus < TH_ENDED ); idx++ ) { |
|||
if( (*idx)->isActive() ) { |
|||
if( (*idx)->validateTarget( m_sNodeData.node_id, tData ) ) { |
|||
propogateTarget = false; |
|||
break; |
|||
}; |
|||
}; |
|||
}; |
|||
if ( propogateTarget && m_bThreadStatus < TH_ENDED ) { |
|||
bEVT = createBasicEvent( m_nNodeId, m_eEventClass, EVT_TARGET_2D_WHITE, NULL, NULL, tData ); |
|||
if( bEVT != NULL ) { |
|||
if( m_nTargetCamId ) { |
|||
bEVT->m_nDestinationNodeID = m_nTargetCamId; |
|||
}; |
|||
if( !m_pEventHeap->broadcast( bEVT ) ) free( tData ); |
|||
} else { |
|||
free( tData ); |
|||
}; |
|||
} else { |
|||
free( tData ); |
|||
}; |
|||
}; |
|||
} else { |
|||
m_mTargetProtector.unlock(); |
|||
SLEEP(DEFAULT_THREAD_SLEEP_TIME); |
|||
}; |
|||
}; |
|||
}; |
|||
|
|||
void targetPileLine::push(TARGET_DATA *ptr){ |
|||
m_mTargetProtector.lock(); |
|||
m_qTargets.push( ptr ); |
|||
m_mTargetProtector.unlock(); |
|||
}; |
|||
@ -0,0 +1,31 @@ |
|||
#ifndef __TARGET_PIPELINE_HEADERS__ |
|||
#define __TARGET_PIPELINE_HEADERS__ |
|||
|
|||
#include "../../components/base/basicEvent.h" |
|||
#include "../../components/base/basicMutex.h" |
|||
#include "../../components/base/basicThread.h" |
|||
|
|||
typedef struct S_TargetPipeLineItem{ |
|||
uint8_t stage; |
|||
}TargetPipeLineItem; |
|||
|
|||
typedef std::queue<TARGET_DATA *> Q_TARGET_QUEUE; |
|||
|
|||
class targetPileLine: public basicThread{ |
|||
private: |
|||
basicLogCollection * m_pLog; |
|||
uint32_t m_nNodeId; |
|||
uint32_t m_nTargetCamId; |
|||
basicMutex m_mTargetProtector; |
|||
Q_TARGET_QUEUE m_qTargets; |
|||
vectorKernelEventFilters m_vTargetFilters; |
|||
protected: |
|||
virtual void m_fThreadProc( void ); |
|||
public: |
|||
explicit targetPileLine( uint32_t node_id, uint32_t bind_cam_id = 0 ); |
|||
~targetPileLine(); |
|||
void push( TARGET_DATA *ptr ); |
|||
}; |
|||
|
|||
|
|||
#endif |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue