本文整理汇总了C++中IsLocked函数的典型用法代码示例。如果您正苦于以下问题:C++ IsLocked函数的具体用法?C++ IsLocked怎么用?C++ IsLocked使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IsLocked函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetState
CTrafficLights::eTrafficLightState CTrafficLights::GetState()
{
if(IsLocked())
return m_eStateSet;
if(m_eStateSet >= TRAFFIC_LIGHT_STATE_FLASHING_FLASHING)
return m_eStateSet;
if(m_uiTotalDuration == 0)
return TRAFFIC_LIGHT_STATE_DISABLED_DISABLED;
// Get the state based on the time elapsed in that cycle
unsigned int uiTimePassed = GetTimeThisCylce();
if(uiTimePassed < m_uiGreenDuration)
return TRAFFIC_LIGHT_STATE_GREEN_RED;
else if(uiTimePassed < m_uiGreenDuration + m_uiYellowDuration)
return TRAFFIC_LIGHT_STATE_YELLOW_RED;
else if(uiTimePassed < m_uiGreenDuration + m_uiYellowDuration + m_uiRedDuration)
return TRAFFIC_LIGHT_STATE_RED_RED_1;
else if(uiTimePassed < m_uiGreenDuration + 2 * m_uiYellowDuration + m_uiRedDuration)
return TRAFFIC_LIGHT_STATE_RED_TO_GREEN;
else if(uiTimePassed < 2 * m_uiGreenDuration + 2 * m_uiYellowDuration + m_uiRedDuration)
return TRAFFIC_LIGHT_STATE_RED_GREEN;
else if(uiTimePassed < 2 * m_uiGreenDuration + 3 * m_uiYellowDuration + m_uiRedDuration)
return TRAFFIC_LIGHT_STATE_RED_YELLOW;
else if(uiTimePassed < 2 * m_uiGreenDuration + 3 * m_uiYellowDuration + 2 * m_uiRedDuration)
return TRAFFIC_LIGHT_STATE_RED_RED_2;
else
return TRAFFIC_LIGHT_STATE_TO_GREEN_RED;
}
开发者ID:andrefsantos,项目名称:IVMultiplayer-1,代码行数:38,代码来源:CTrafficLights.cpp
示例2: ToggleOpenTargets
void CFrobLock::ToggleOpenTargets()
{
if (IsLocked())
{
// We're still locked, play the locked sound and exit
FrobLockStartSound("snd_locked");
}
else
{
// Actually open any targetted frobmovers
for ( int i = 0 ; i < targets.Num() ; i++ )
{
idEntity* target = targets[i].GetEntity();
if ( (target == NULL) || !target->IsType(CBinaryFrobMover::Type))
{
continue;
}
static_cast<CBinaryFrobMover*>(target)->ToggleOpen();
}
}
}
开发者ID:nbohr1more,项目名称:TheDarkMod_SVN_Unofficial-1,代码行数:23,代码来源:FrobLock.cpp
示例3: GetKey
bool CAccountHD::GetKey(const CKeyID& keyID, CKey& key) const
{
if (IsLocked())
return false;
int64_t nKeyIndex = -1;
CExtKey privKey;
if (externalKeyStore.GetKey(keyID, nKeyIndex)) {
primaryChainKeyPriv.Derive(privKey, nKeyIndex);
if (privKey.Neuter().pubkey.GetID() != keyID)
assert(0);
key = privKey.key;
return true;
}
if (internalKeyStore.GetKey(keyID, nKeyIndex)) {
changeChainKeyPriv.Derive(privKey, nKeyIndex);
if (privKey.Neuter().pubkey.GetID() != keyID)
assert(0);
key = privKey.key;
return true;
}
return false;
}
开发者ID:Gulden,项目名称:gulden-official,代码行数:23,代码来源:account.cpp
示例4: SetCaretPos
int32_t CFDE_TxtEdtEngine::SetCaretPos(int32_t nIndex, FX_BOOL bBefore) {
if (IsLocked()) {
return 0;
}
ASSERT(nIndex >= 0 && nIndex <= GetTextBufLength());
if (m_PagePtrArray.GetSize() <= m_nCaretPage) {
return 0;
}
m_bBefore = bBefore;
m_nCaret = nIndex;
MovePage2Char(m_nCaret);
GetCaretRect(m_rtCaret, m_nCaretPage, m_nCaret, m_bBefore);
if (!m_bBefore) {
m_nCaret++;
m_bBefore = TRUE;
}
m_fCaretPosReserve = (m_Param.dwLayoutStyles & FDE_TEXTEDITLAYOUT_DocVertical)
? m_rtCaret.top
: m_rtCaret.left;
m_Param.pEventSink->On_CaretChanged(this, m_nCaretPage, 0);
m_nAnchorPos = -1;
return m_nCaret;
}
开发者ID:hfiguiere,项目名称:pdfium,代码行数:23,代码来源:cfde_txtedtengine.cpp
示例5: MOZ_ASSERT_UNREACHABLE
void
DecodedSurfaceProvider::SetLocked(bool aLocked)
{
// See DrawableRef() for commentary on these assertions.
if (Availability().IsPlaceholder()) {
MOZ_ASSERT_UNREACHABLE("Calling SetLocked() on a placeholder");
return;
}
if (!mSurface) {
MOZ_ASSERT_UNREACHABLE("Calling SetLocked() when we have no surface");
return;
}
if (aLocked == IsLocked()) {
return; // Nothing to do.
}
// If we're locked, hold a DrawableFrameRef to |mSurface|, which will keep any
// volatile buffer it owns in memory.
mLockRef = aLocked ? mSurface->DrawableRef()
: DrawableFrameRef();
}
开发者ID:MichaelKohler,项目名称:gecko-dev,代码行数:23,代码来源:DecodedSurfaceProvider.cpp
示例6: SelectActors
void FLevelViewModel::SelectActors( bool bSelect, bool bNotify, bool bSelectEvenIfHidden, const TSharedPtr< IFilter< const TWeakObjectPtr< AActor >& > >& Filter )
{
if( !Level.IsValid() || IsLocked() )
{
return;
}
Editor->GetSelectedActors()->BeginBatchSelectOperation();
bool bChangesOccurred = false;
// Iterate over all actors, looking for actors in this level.
ULevel* RawLevel = Level.Get();
for ( int32 ActorIndex = 2 ; ActorIndex < RawLevel->Actors.Num() ; ++ActorIndex )
{
AActor* Actor = RawLevel->Actors[ ActorIndex ];
if ( Actor )
{
if( Filter.IsValid() && !Filter->PassesFilter( Actor ) )
{
continue;
}
bool bNotifyForActor = false;
Editor->GetSelectedActors()->Modify();
Editor->SelectActor( Actor, bSelect, bNotifyForActor, bSelectEvenIfHidden );
bChangesOccurred = true;
}
}
Editor->GetSelectedActors()->EndBatchSelectOperation();
if( bNotify )
{
Editor->NoteSelectionChange();
}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:36,代码来源:LevelViewModel.cpp
示例7: NSLOCTEXT
void FLevelViewModel::Save()
{
if ( !IsLevel() )
{
return;
}
if ( !IsVisible() )
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "UnableToSaveInvisibleLevels", "Save aborted. Levels must be made visible before they can be saved.") );
return;
}
else if ( IsLocked() )
{
FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "UnableToSaveLockedLevels", "Save aborted. Level must be unlocked before it can be saved.") );
return;
}
// Prompt the user to check out the level from source control before saving if it's currently under source control
if ( FEditorFileUtils::PromptToCheckoutLevels( false, Level.Get() ) )
{
FEditorFileUtils::SaveLevel( Level.Get() );
}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:24,代码来源:LevelViewModel.cpp
示例8:
//------------------------------------------------------------------------------
void
BLocker::Unlock(void)
{
// If the thread currently holds the lockdecrement
if (IsLocked()) {
// Decrement the number of outstanding locks this thread holds
// on this BLocker.
fRecursiveCount--;
// If the recursive count is now at 0, that means the BLocker has
// been released by the thread.
if (fRecursiveCount == 0) {
// The BLocker is no longer owned by any thread.
fLockOwner = B_ERROR;
// Decrement the benaphore count and store the undecremented
// value in oldBenaphoreCount.
//int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, -1);
// TODO: use atomic_dec(&fBenaphoreCount) instead
int32 oldBenaphoreCount = atomic_add(&fBenaphoreCount, -1);
// If the oldBenaphoreCount is greater than 1, then there is
// at lease one thread waiting for the lock in the case of a
// benaphore.
if (oldBenaphoreCount > 1) {
// Since there are threads waiting for the lock, it must
// be released. Note, the old benaphore count will always be
// greater than 1 for a semaphore so the release is always done.
release_sem(fSemaphoreID);
}
}
}
}
开发者ID:BackupTheBerlios,项目名称:nemo,代码行数:37,代码来源:Locker.cpp
示例9:
BOOL S3PDBSocketPool::ShowAllClientInfo()
{
if (IsLocked())
return FALSE;
Lock();
BOOL b = FALSE;
GatewayIDMap::iterator i = m_clientIDs.begin();
int n = 0;
while (i != m_clientIDs.end())
{
KGatewayDataProcess* p = i->second;
if (p)
{
in_addr add;
add.s_addr = p->m_Address;
gTrace("Client %d: %s(%s)", n, p->m_ServerName.c_str(), inet_ntoa(in_addr(add)));
}
i++;
n++;
}
b = TRUE;
Unlock();
return b;
}
开发者ID:XeanoRRR,项目名称:mmo-resourse,代码行数:24,代码来源:S3PDBSocketPool.cpp
示例10: GetLevelObject
void FLevelModel::SetLocked(bool bLocked)
{
if (LevelCollectionModel.IsReadOnly())
{
return;
}
ULevel* Level = GetLevelObject();
if (Level == NULL)
{
return;
}
// Do nothing if attempting to set the level to the same locked state
if (bLocked == IsLocked())
{
return;
}
// If locking the level, deselect all of its actors and BSP surfaces
if (bLocked)
{
DeselectAllActors();
DeselectAllSurfaces();
// Tell the editor selection status was changed.
Editor->NoteSelectionChange();
// If locking the current level, reset the p-level as the current level
//@todo: fix this!
}
// Change the level's locked status
FLevelUtils::ToggleLevelLock(Level);
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:36,代码来源:LevelModel.cpp
示例11: CanUnload
/// \brief
/// Flag that determines whether the resource can currently unload itself. Used by the resource manager.
inline BOOL CanUnload() const {return IsResourceFlagSet(VRESOURCEFLAG_ALLOWUNLOAD) && !IsLocked();}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:3,代码来源:VResource.hpp
示例12: wxRemoveFile
BlockFile::~BlockFile()
{
if (!IsLocked() && mFileName.HasName())
wxRemoveFile(mFileName.GetFullPath());
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:5,代码来源:BlockFile.cpp
示例13: GetOutputCurrentType
HRESULT CHWMFT::GetOutputCurrentType(
DWORD dwOutputStreamID,
IMFMediaType** ppType)
{
/*****************************************
** See http://msdn.microsoft.com/en-us/library/ms696985(v=VS.85).aspx
*****************************************/
HRESULT hr = S_OK;
IMFMediaType* pMT = NULL;
do
{
/************************************
** Since this MFT is a decoder, it
** must not allow this function to be
** called until it is unlocked. If
** your MFT is an encoder, this function
** CAN be called before the MFT is
** unlocked
************************************/
if(IsLocked() != FALSE)
{
hr = MF_E_TRANSFORM_ASYNC_LOCKED;
break;
}
if(ppType == NULL)
{
hr = E_POINTER;
break;
}
/*****************************************
** Todo: If your MFT supports more than one
** stream, make sure you modify
** MFT_MAX_STREAMS and adjust this function
** accordingly
*****************************************/
if(dwOutputStreamID >= MFT_MAX_STREAMS)
{
hr = MF_E_INVALIDSTREAMNUMBER;
break;
}
{
CAutoLock lock(&m_csLock);
if(m_pOutputMT == NULL)
{
hr = MF_E_TRANSFORM_TYPE_NOT_SET;
break;
}
/*******************************************
** Return a copy of the media type, not the
** internal one. Returning the internal one
** will allow an external component to modify
** the internal media type
*******************************************/
hr = MFCreateMediaType(&pMT);
if(FAILED(hr))
{
break;
}
hr = DuplicateAttributes(pMT, m_pOutputMT);
if(FAILED(hr))
{
break;
}
}
(*ppType) = pMT;
(*ppType)->AddRef();
}while(false);
SAFERELEASE(pMT);
return hr;
}
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:82,代码来源:CHWMFT_IMFTransform_Impl.cpp
示例14: MSG_PANEL_ITEM
void MODULE::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{
int nbpad;
wxString msg;
aList.push_back( MSG_PANEL_ITEM( m_Reference->GetShownText(), m_Value->GetShownText(), DARKCYAN ) );
// Display last date the component was edited (useful in Module Editor).
wxDateTime date( m_LastEditTime );
if( m_LastEditTime && date.IsValid() )
// Date format: see http://www.cplusplus.com/reference/ctime/strftime
msg = date.Format( wxT( "%b %d, %Y" ) ); // Abbreviated_month_name Day, Year
else
msg = _( "Unknown" );
aList.push_back( MSG_PANEL_ITEM( _( "Last Change" ), msg, BROWN ) );
// display schematic path
aList.push_back( MSG_PANEL_ITEM( _( "Netlist Path" ), m_Path, BROWN ) );
// display the board side placement
aList.push_back( MSG_PANEL_ITEM( _( "Board Side" ),
IsFlipped()? _( "Back (Flipped)" ) : _( "Front" ), RED ) );
EDA_ITEM* PtStruct = m_Pads;
nbpad = 0;
while( PtStruct )
{
nbpad++;
PtStruct = PtStruct->Next();
}
msg.Printf( wxT( "%d" ), nbpad );
aList.push_back( MSG_PANEL_ITEM( _( "Pads" ), msg, BLUE ) );
msg = wxT( ".." );
if( IsLocked() )
msg[0] = 'L';
if( m_ModuleStatus & MODULE_is_PLACED )
msg[1] = 'P';
aList.push_back( MSG_PANEL_ITEM( _( "Status" ), msg, MAGENTA ) );
msg.Printf( wxT( "%.1f" ), GetOrientationDegrees() );
aList.push_back( MSG_PANEL_ITEM( _( "Rotation" ), msg, BROWN ) );
// Controls on right side of the dialog
switch( m_Attributs & 255 )
{
case 0:
msg = _( "Normal" );
break;
case MOD_CMS:
msg = _( "Insert" );
break;
case MOD_VIRTUAL:
msg = _( "Virtual" );
break;
default:
msg = wxT( "???" );
break;
}
aList.push_back( MSG_PANEL_ITEM( _( "Attributes" ), msg, BROWN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Footprint" ), FROM_UTF8( m_fpid.Format().c_str() ), BLUE ) );
if( m_3D_Drawings.empty() )
msg = _( "No 3D shape" );
else
msg = m_3D_Drawings.front().m_Filename;
// Search the first active 3D shape in list
aList.push_back( MSG_PANEL_ITEM( _( "3D-Shape" ), msg, RED ) );
wxString doc, keyword;
doc.Printf( _( "Doc: %s" ), GetChars( m_Doc ) );
keyword.Printf( _( "Key Words: %s" ), GetChars( m_KeyWord ) );
aList.push_back( MSG_PANEL_ITEM( doc, keyword, BLACK ) );
}
开发者ID:nikgul,项目名称:kicad-source-mirror,代码行数:87,代码来源:class_module.cpp
示例15: DebugAssertTrue
void UScheduler::Timer::SetTimeout(U32 timeout)
{
DebugAssertTrue(IsLocked());
_timeoutTime = System::GetTickCount() + timeout;
AddOperationWithTimeout(_node);
}
开发者ID:DVDPT,项目名称:Micro-Operating-System,代码行数:6,代码来源:UScheduler.cpp
示例16: TraceString
HRESULT CHWMFT::ProcessOutput(
DWORD dwFlags,
DWORD dwOutputBufferCount,
MFT_OUTPUT_DATA_BUFFER* pOutputSamples,
DWORD* pdwStatus)
{
/*****************************************
** See http://msdn.microsoft.com/en-us/library/ms704014(v=VS.85).aspx
*****************************************/
HRESULT hr = S_OK;
IMFSample* pSample = NULL;
TraceString(CHMFTTracing::TRACE_INFORMATION, L"%S(): Enter", __FUNCTION__);
do
{
if(IsLocked() != FALSE)
{
hr = MF_E_TRANSFORM_ASYNC_LOCKED;
break;
}
{
CAutoLock lock(&m_csLock);
TraceString(CHMFTTracing::TRACE_INFORMATION, L"%S(): HaveOutputCount: %u", __FUNCTION__, m_dwHaveOutputCount);
if(m_dwHaveOutputCount == 0)
{
// This call does not correspond to a have output call
hr = E_UNEXPECTED;
break;
}
else
{
m_dwHaveOutputCount--;
}
}
/*****************************************
** Todo: If your MFT supports more than one
** stream, make sure you modify
** MFT_MAX_STREAMS and adjust this function
** accordingly
*****************************************/
if(dwOutputBufferCount < MFT_MAX_STREAMS)
{
hr = E_INVALIDARG;
break;
}
if(IsMFTReady() == FALSE)
{
hr = MF_E_TRANSFORM_TYPE_NOT_SET;
break;
}
/***************************************
** Since this in an internal function
** we know m_pOutputSampleQueue can never be
** NULL due to InitializeTransform()
***************************************/
hr = m_pOutputSampleQueue->GetNextSample(&pSample);
if(FAILED(hr))
{
break;
}
if(pSample == NULL)
{
hr = MF_E_TRANSFORM_NEED_MORE_INPUT;
break;
}
/*******************************
** Todo: This MFT only has one
** input stream, so the output
** samples array and stream ID
** will only use the first
** member
*******************************/
pOutputSamples[0].dwStreamID = 0;
if((pOutputSamples[0].pSample) == NULL)
{
// The MFT is providing it's own samples
(pOutputSamples[0].pSample) = pSample;
(pOutputSamples[0].pSample)->AddRef();
}
else
{
// The pipeline has allocated the samples
IMFMediaBuffer* pBuffer = NULL;
do
{
hr = pSample->ConvertToContiguousBuffer(&pBuffer);
if(FAILED(hr))
//.........这里部分代码省略.........
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:101,代码来源:CHWMFT_IMFTransform_Impl.cpp
示例17: ubKeepLock
BOOL CGatewayEpos2ToMaxonSerialV1::Process_SegmentWrite(CCommand_DCS* pCommand, CProtocolStackManagerBase* pProtocolStackManager, HANDLE hPS_Handle, HANDLE hTransactionHandle)
{
const BYTE MAX_SEGMENT_LENGTH = 63;
//*Constants DCS*
const int PARAMETER_INDEX_NODE_ID = 0;
const int PARAMETER_INDEX_CONTROL_BYTE = 1;
const int PARAMETER_INDEX_DATA = 2;
const int RETURN_PARAMETER_INDEX_ERROR_CODE = 0;
const int RETURN_PARAMETER_INDEX_CONTROL_BYTE = 1;
//*Constants PS*
const BYTE OP_CODE = 0x15;
const BYTE DATA_LENGTH = 1;
const BYTE RETURN_DATA_LENGTH = 6;
//*Variables DCS*
//Parameter
BYTE uNodeId = 0;
UEpos2ControlByte controlByte;
controlByte.bValue = 0;
void* pData = NULL;
//Return Parameter
UEpos2ControlByte retControlByte;
retControlByte.bValue = 0;
DWORD dDeviceErrorCode = 0;
//*Variables PS*
//Parameter
BYTE uOpCode = OP_CODE;
void* pDataBuffer=NULL;
DWORD dDataBufferLength;
BYTE ubKeepLock(1);
//ReturnParameter
void* pRetDataBuffer=NULL;
DWORD dRetDataBufferLength = 0;
BOOL oResult = FALSE;
CErrorInfo comErrorInfo;
CErrorInfo cmdErrorInfo;
void* pDest;
void* pSource;
if(pCommand)
{
//Check CriticalSection
if(!IsLocked(pCommand)) return FALSE;
//GetParameterData
pCommand->GetParameterData(PARAMETER_INDEX_NODE_ID, &uNodeId, sizeof(uNodeId));
pCommand->GetParameterData(PARAMETER_INDEX_CONTROL_BYTE, &controlByte.bValue, sizeof(controlByte.bValue));
//Check Max SegmentLength
if(controlByte.structure.bLength > MAX_SEGMENT_LENGTH) controlByte.structure.bLength = MAX_SEGMENT_LENGTH;
pData = malloc(controlByte.structure.bLength);
pCommand->GetParameterData(PARAMETER_INDEX_DATA, pData, controlByte.structure.bLength);
//Prepare DataBuffer
dDataBufferLength = DATA_LENGTH + controlByte.structure.bLength;
pDataBuffer = malloc(dDataBufferLength);
//Data
pDest = pDataBuffer;
CopyData(pDest, &controlByte.bValue, sizeof(controlByte.bValue));
CopyData(pDest, pData, controlByte.structure.bLength);
//Execute Command
oResult = PS_ProcessProtocol(pProtocolStackManager, hPS_Handle, hTransactionHandle, uOpCode, pDataBuffer, dDataBufferLength, ubKeepLock, &pRetDataBuffer, &dRetDataBufferLength, &comErrorInfo);
//Check ReturnData Size
if(oResult && (dRetDataBufferLength != RETURN_DATA_LENGTH))
{
if(m_pErrorHandling) m_pErrorHandling->GetError(k_Error_MaxonSerialV1_BadDataSizeReceived, &comErrorInfo);
oResult = FALSE;
}
//ReturnData
pSource = pRetDataBuffer;
if(oResult) oResult = CopyReturnData(&dDeviceErrorCode, sizeof(dDeviceErrorCode), pSource, dRetDataBufferLength);
if(oResult) oResult = CopyReturnData(&retControlByte.bValue, sizeof(retControlByte.bValue), pSource, dRetDataBufferLength);
//Evaluate ErrorCode
oResult = EvaluateErrorCode(oResult, dDeviceErrorCode, &comErrorInfo, &cmdErrorInfo);
//Restore controlByte
if(oResult && (controlByte.structure.bToggle != retControlByte.structure.bToggle))
{
if(m_pErrorHandling) m_pErrorHandling->GetError(ERROR_DEVICE_EPOS_TOGGLE, &cmdErrorInfo);
oResult = FALSE;
}
//SetReturnParameterData
pCommand->SetStatus(oResult, &cmdErrorInfo);
pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_ERROR_CODE, &dDeviceErrorCode, sizeof(dDeviceErrorCode));
pCommand->SetReturnParameterData(RETURN_PARAMETER_INDEX_CONTROL_BYTE, &retControlByte, sizeof(retControlByte));
//Free DataBuffer
if(pData) free(pData);
//.........这里部分代码省略.........
开发者ID:RIVeR-Lab,项目名称:eposcmd,代码行数:101,代码来源:GatewayEpos2ToMaxonSerialV1.cpp
示例18: Process_ProcessProtocolMaxon
BOOL CGatewayInfoteamSerialToI::Process_ProcessProtocolMaxon(CCommand_PS* pCommand,CInterfaceManagerBase* pInterfaceManager,HANDLE hI_Handle,HANDLE hTransactionHandle)
{
const DWORD k_MaxPackageSize_Maxon = 256;
//*Constants PS*
const int k_ParameterIndex_PackageSize = 0;
const int k_ParameterIndex_ChunkSize = 1;
const int k_ParameterIndex_LastChunkFlag = 2;
const int k_ParameterIndex_Checksum = 3;
const int k_ParameterIndex_PackageType = 4;
const int k_ParameterIndex_OpCode = 5;
const int k_ParameterIndex_Data = 6;
const int k_ParameterIndex_KeepLock = 7;
const int k_ReturnParameterIndex_PackageSize = 0;
const int k_ReturnParameterIndex_Checksum = 1;
const int k_ReturnParameterIndex_PackageType = 2;
const int k_ReturnParameterIndex_Data = 3;
//*Variables PS*
//Parameter
DWORD dPackageSize;
WORD wChunkSize;
BYTE uLastChunkFlag;
DWORD dChecksum;
BYTE uPackageType = 0;
BYTE uOpCode = 0;
void* pDataBuffer = NULL;
DWORD dDataBufferLength;
BYTE ubKeepLock = 0;
BYTE* p = NULL;
DWORD dSize;
//ReturnParameter
DWORD dRetPackageSize;
DWORD dRetChecksum;
BYTE uRetPackageType = 0;
void* pRetDataBuffer = NULL;
DWORD dRetDataBufferLength = 0;
BOOL oResult = FALSE;
CErrorInfo errorInfo;
DWORD dTimeout;
if(pCommand && pInterfaceManager)
{
//Lock CriticalSection
if(!IsLocked(pCommand))
{
if(!Lock(pCommand)) return FALSE;
}
//Prepare DataBuffer
dDataBufferLength = pCommand->GetParameterLength(k_ParameterIndex_Data) + sizeof(uPackageType) + sizeof(uOpCode);
if(dDataBufferLength > 0) pDataBuffer = malloc(dDataBufferLength);
//Get PS Parameter Data
pCommand->GetParameterData(k_ParameterIndex_PackageSize,&dPackageSize,sizeof(dPackageSize));
pCommand->GetParameterData(k_ParameterIndex_ChunkSize,&wChunkSize,sizeof(wChunkSize));
pCommand->GetParameterData(k_ParameterIndex_LastChunkFlag,&uLastChunkFlag,sizeof(uLastChunkFlag));
pCommand->GetParameterData(k_ParameterIndex_Checksum,&dChecksum,sizeof(dChecksum));
pCommand->GetParameterData(k_ParameterIndex_KeepLock,&ubKeepLock,sizeof(ubKeepLock));
p = (BYTE*)pDataBuffer;
pCommand->GetParameterData(k_ParameterIndex_PackageType,p,sizeof(uPackageType));p+=sizeof(uPackageType);
pCommand->GetParameterData(k_ParameterIndex_OpCode,p,sizeof(uOpCode));p+=sizeof(uOpCode);
pCommand->GetParameterData(k_ParameterIndex_Data,p,pCommand->GetParameterLength(k_ParameterIndex_Data));
//Execute Command
dTimeout = pCommand->GetTimeout();
oResult = SendFrameRepeated(pInterfaceManager,hI_Handle,hTransactionHandle,dPackageSize,wChunkSize,uLastChunkFlag,&dChecksum,pDataBuffer,dDataBufferLength,&errorInfo);
if(oResult)
{
oResult = ReceiveFrameRepeated(pInterfaceManager,hI_Handle,hTransactionHandle, k_MaxPackageSize_Maxon, &dRetPackageSize,&dRetChecksum,&pRetDataBuffer,&dRetDataBufferLength,dTimeout,&errorInfo);
}
//Set PS ReturnParameter Data
pCommand->SetStatus(oResult,&errorInfo);
pCommand->SetParameterData(k_ParameterIndex_Checksum,&dChecksum,sizeof(dChecksum));
pCommand->SetReturnParameterData(k_ReturnParameterIndex_PackageSize,&dRetPackageSize,sizeof(dRetPackageSize));
pCommand->SetReturnParameterData(k_ReturnParameterIndex_Checksum,&dRetChecksum,sizeof(dRetChecksum));
if(dRetDataBufferLength > 0)
{
p = (BYTE*)pRetDataBuffer;
dSize = dRetDataBufferLength;
pCommand->SetReturnParameterData(k_ReturnParameterIndex_PackageType,p,sizeof(uRetPackageType)); p+=sizeof(uPackageType); dSize -= sizeof(uPackageType);
pCommand->SetReturnParameterData(k_ReturnParameterIndex_Data,p,dSize);
}
//Free DataBuffer
if(pDataBuffer) free(pDataBuffer);
if(pRetDataBuffer) free(pRetDataBuffer);
//Unlock CriticalSection
if(!ubKeepLock) Unlock();
}
return oResult;
//.........这里部分代码省略.........
开发者ID:RIVeR-Lab,项目名称:eposcmd,代码行数:101,代码来源:GatewayInfoteamSerialToI.cpp
示例19: IsLocked
bool
Matrix<T>::Locked() const
{ return IsLocked( viewType_ ); }
开发者ID:khalid-hasanov,项目名称:Elemental,代码行数:3,代码来源:matrix.cpp
示例20: GetInputAvailableType
HRESULT CHWMFT::GetInputAvailableType(
DWORD dwInputStreamID,
DWORD dwTypeIndex,
IMFMediaType** ppType)
{
/*****************************************
** Todo: This function will return a media
** type at a given index. The SDK
** implementation uses a static array of
** media types. Your MFT may want to use
** a dynamic array and modify the list
** order depending on the MFTs state
** See http://msdn.microsoft.com/en-us/library/ms704814(v=VS.85).aspx
*****************************************/
HRESULT hr = S_OK;
IMFMediaType* pMT = NULL;
do
{
if(IsLocked() != FALSE)
{
hr = MF_E_TRANSFORM_ASYNC_LOCKED;
break;
}
if(ppType == NULL)
{
hr = E_POINTER;
break;
}
/*****************************************
** Todo: If your MFT supports more than one
** stream, make sure you modify
** MFT_MAX_STREAMS and adjust this function
** accordingly
*****************************************/
if(dwInputStreamID >= MFT_MAX_STREAMS)
{
hr = MF_E_INVALIDSTREAMNUMBER;
break;
}
/*****************************************
** Todo: Modify the accepted input list
** g_ppguidInputTypes or use your own
** implementation of this function
*****************************************/
if(dwTypeIndex >= g_dwNumInputTypes)
{
hr = MF_E_NO_MORE_TYPES;
break;
}
{
CAutoLock lock(&m_csLock);
hr = MFCreateMediaType(&pMT);
if(FAILED(hr))
{
break;
}
hr = pMT->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
if(FAILED(hr))
{
break;
}
hr = pMT->SetGUID(MF_MT_SUBTYPE, *(g_ppguidInputTypes[dwTypeIndex]));
if(FAILED(hr))
{
break;
}
(*ppType) = pMT;
(*ppType)->AddRef();
}
}while(false);
SAFERELEASE(pMT);
return hr;
}
开发者ID:DMFZ,项目名称:Windows-classic-samples,代码行数:85,代码来源:CHWMFT_IMFTransform_Impl.cpp
注:本文中的IsLocked函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论