本文整理汇总了C++中UtlInt类的典型用法代码示例。如果您正苦于以下问题:C++ UtlInt类的具体用法?C++ UtlInt怎么用?C++ UtlInt使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UtlInt类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: memset
int SipUdpServer::getServerPort(const char* szLocalIp)
{
int port = PORT_NONE;
char szLocalIpForPortLookup[256];
memset((void*)szLocalIpForPortLookup, 0, sizeof(szLocalIpForPortLookup));
if (NULL == szLocalIp)
{
strcpy(szLocalIpForPortLookup, mDefaultIp);
}
else
{
strcpy(szLocalIpForPortLookup, szLocalIp);
}
UtlString localIpKey(szLocalIpForPortLookup);
UtlInt* pUtlPort;
pUtlPort = (UtlInt*)this->mServerPortMap.findValue(&localIpKey);
if (pUtlPort)
{
port = pUtlPort->getValue();
}
return port ;
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:27,代码来源:SipUdpServer.cpp
示例2: mapIterator
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// NAME: ACDCallManager::removeCallFromMap
//
// SYNOPSIS: delete the ACDCall reference from the given HashMap
//
// DESCRIPTION:
//
// RETURNS: None.
//
// ERRORS: None.
//
// CAVEATS: None.
//
////////////////////////////////////////////////////////////////////////////////////////////////////
void ACDCallManager::removeCallFromMap(ACDCall *pCallRef,
UtlHashMap *pMap, char *mapName)
{
mLock.acquire();
UtlHashMapIterator mapIterator(*pMap);
ACDCall* pACDCall = NULL;
UtlInt* pTemp = NULL;
UtlContainable* pKey;
while ((pTemp = (UtlInt*)mapIterator()) != NULL) {
pACDCall = (ACDCall*)pMap->findValue(pTemp);
if(pACDCall == pCallRef ) {
OsSysLog::add(FAC_ACD, gACD_DEBUG,
"ACDCallManager::removeCallFromMap(%s) - removed ACDCall(%p) matching hCall=%" PRIdPTR,
mapName, pACDCall, pTemp->getValue());
pKey = pMap->removeReference(pTemp);
if (pKey != NULL) {
if (pMap != &mDeadCallHandleMap) {
// Add it to the "dead" list so we know to ignore messages
// from it Yet can tell it isn't "unknown".
addDeadCallToMap(pTemp->getValue(), pCallRef) ;
}
delete pKey ;
}
}
}
mLock.release();
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:44,代码来源:ACDCallManager.cpp
示例3: releaseHandleRef
const void* SipXHandleMap::removeHandle(SIPXHANDLE handle)
{
const void* pRC = NULL ;
if (lock())
{
releaseHandleRef(handle);
UtlInt* pCount = static_cast<UtlInt*>(mLockCountHash.findValue(&UtlInt(handle))) ;
if (pCount == NULL || pCount->getValue() < 1)
{
UtlInt key(handle) ;
UtlVoidPtr* pValue ;
pValue = (UtlVoidPtr*) findValue(&key) ;
if (pValue != NULL)
{
pRC = pValue->getValue() ;
destroy(&key) ;
}
if (pCount)
{
mLockCountHash.destroy(&UtlInt(handle));
}
}
unlock() ;
}
return pRC ;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:33,代码来源:SipXHandleMap.cpp
示例4: itor
void SipXHandleMap::dump()
{
UtlHashMapIterator itor(*this) ;
UtlInt* pKey ;
UtlVoidPtr* pValue ;
while ((pKey = (UtlInt*) itor()))
{
pValue = (UtlVoidPtr*) findValue(pKey) ;
printf("\tkey=%08X, value=%p\n", pKey->getValue(),
pValue ? pValue->getValue() : 0) ;
}
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:13,代码来源:SipXHandleMap.cpp
示例5: lock
void SipXHandleMap::releaseHandleRef(SIPXHANDLE hHandle)
{
lock();
UtlInt* pCount = static_cast<UtlInt*>(mLockCountHash.findValue(&UtlInt(hHandle))) ;
if (pCount == NULL)
{
mLockCountHash.insertKeyAndValue(new UtlInt(hHandle), new UtlInt(0));
}
else
{
pCount->setValue(pCount->getValue() - 1);
}
unlock();
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:14,代码来源:SipXHandleMap.cpp
示例6: UtlInt
void SipXHandleMap::addHandleRef(SIPXHANDLE hHandle)
{
mLock.acquire();
mLockCountHash.findValue(&UtlInt(hHandle));
UtlInt* count = static_cast<UtlInt*>(mLockCountHash.findValue(&UtlInt(hHandle))) ;
if (count == NULL)
{
mLockCountHash.insertKeyAndValue(new UtlInt(hHandle), new UtlInt(1));
}
else
{
count->setValue(count->getValue() + 1);
}
mLock.release();
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:16,代码来源:SipXHandleMap.cpp
示例7: cancelRedirect
/**
* Cancel a suspended redirection.
*
* Caller must hold mRedirectorMutex.
*
* containableSeqNo - UtlInt containing the sequence number.
*
* suspendObject - pointer to the suspense object.
*/
void SipRedirectServer::cancelRedirect(UtlInt& containableSeqNo,
RedirectSuspend* suspendObject)
{
RedirectPlugin::RequestSeqNo seqNo = containableSeqNo.getValue();
Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
"SipRedirectServer::cancelRedirect "
"Canceling suspense of request %d", seqNo);
// Call cancel for redirectors that need it.
PluginIterator iterator(mRedirectPlugins);
RedirectPlugin* redirector;
int i; // Iterator sequence number.
for (i = 0; (redirector = static_cast <RedirectPlugin*> (iterator.next()));
i++)
{
if (mpConfiguredRedirectors[i].bActive &&
suspendObject->mRedirectors[i].needsCancel)
{
Os::Logger::instance().log(FAC_SIP, PRI_DEBUG,
"SipRedirectServer::cancelRedirect "
"Calling cancel(%d) for redirector %d", seqNo, i);
redirector->cancel(seqNo);
}
}
// Remove the entry from mSuspendList.
// Also deletes the suspend object.
// Deleting the suspend object frees the array of information about
// the redirectors, and the private storage for each redirector.
// (See RedirectSuspend::~RedirectSuspend().)
mSuspendList.destroy(&containableSeqNo);
}
开发者ID:maberchti,项目名称:sipxecs,代码行数:40,代码来源:SipRedirectServer.cpp
示例8: UtlString
TaoStatus TaoObjectMap::findValue(const char* key, TaoObjHandle& objValue)
{
UtlString* pLookupKey;
UtlInt* pDictValue;
pLookupKey = new UtlString(key);
pDictValue = (UtlInt*)
mDict.findValue(pLookupKey); // perform the lookup
delete pLookupKey;
if (pDictValue == NULL)
return TAO_NOT_FOUND; // did not find the specified key
objValue = pDictValue->getValue();
return TAO_SUCCESS;
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:17,代码来源:TaoObjectMap.cpp
示例9: requestDelete
void requestDelete(Url& url, UtlSList& names)
{
XmlRpcRequest* request;
XmlRpcResponse response;
request = new XmlRpcRequest(url, "configurationParameter.delete");
request->addParam(&DataSet);
if (!names.isEmpty())
{
request->addParam(&names);
}
if (!request->execute(response/*, &pSocket*/))
{
exitFault(response);
}
else
{
UtlContainable* value;
if (response.getResponse(value))
{
UtlInt* deletedCount = dynamic_cast<UtlInt*>(value);
if (deletedCount)
{
if (Verbose == Feedback)
{
printf("deleted %d parameters.\n", (int)deletedCount->getValue());
}
}
else
{
fprintf(stderr, "Incorrect type returned.\n");
exit(1);
}
}
else
{
fprintf(stderr, "No value returned.\n");
exit(1);
}
}
delete request;
request = NULL;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:45,代码来源:configrpc.cpp
示例10: iter
UtlBoolean TaoObjectMap::findValue(TaoObjHandle value)
{
UtlHashMapIterator iter(mDict);
UtlContainable* next;
UtlInt* cvalue;
iter.reset();
while ((next = iter()))
{
cvalue = (UtlInt*) iter.value();
if (value == (TaoObjHandle) cvalue->getValue())
{
return TRUE;
}
}
return FALSE;
}
开发者ID:Konnekt,项目名称:lib-sipx,代码行数:18,代码来源:TaoObjectMap.cpp
示例11: testConstructor
/** Test the constructor
*
* The test data for this test case is :-
* a) int = 0
* b) int = +ve integer
* c) int = -ve integer
* d) int = max +ve integer
* e) int = max -ve integer.
* The above set of data will be referred to as the
* Common Data Set henceforth! The common data set has been defined
* as a static const array of integers and a short description about
* the data is in a const array of char*
*
*/
void testConstructor()
{
// First test the default constructor
UtlInt testInt ;
const char* msg0 = "Test the default constructor" ;
CPPUNIT_ASSERT_EQUAL_MESSAGE(msg0, (intptr_t)0, testInt.getValue()) ;
//Now test the single argument constructor for each of
// the common test data type
const char* prefix = "Test UtlInt(int value), where value = " ;
for (int i = 0 ;i < commonTestSetLength; i++)
{
string msg ;
TestUtilities::createMessage(2, &msg, prefix, commonTestSet[i].message) ;
UtlInt testInt(commonTestSet[i].input) ;
int actualValue = testInt.getValue() ;
CPPUNIT_ASSERT_EQUAL_MESSAGE(msg.data(), commonTestSet[i].expectedValue, actualValue) ;
}
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:33,代码来源:UtlInt.cpp
示例12: UtlInt
bool SipXHandleMap::releaseHandleRef(SIPXHANDLE hHandle)
{
bool bRC = false ;
if (lock())
{
UtlInt* pCount = static_cast<UtlInt*>(mLockCountHash.findValue(&UtlInt(hHandle))) ;
if (pCount == NULL)
{
mLockCountHash.insertKeyAndValue(new UtlInt(hHandle), new UtlInt(0));
}
else
{
pCount->setValue(pCount->getValue() - 1);
}
bRC = unlock();
}
return bRC ;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:19,代码来源:SipXHandleMap.cpp
示例13: sipxCallLookupHandle
SIPX_CALL sipxCallLookupHandle(const UtlString& callID, const void* pSrc)
{
SIPX_CALL hCall = 0 ;
if (gpCallHandleMap->lock())
{
UtlHashMapIterator iter(*gpCallHandleMap);
UtlInt* pIndex = NULL;
UtlVoidPtr* pObj = NULL;
while ((pIndex = dynamic_cast<UtlInt*>( iter() )) )
{
pObj = dynamic_cast<UtlVoidPtr*>(gpCallHandleMap->findValue(pIndex));
SIPX_CALL_DATA* pData = NULL ;
if (pObj)
{
pData = (SIPX_CALL_DATA*) pObj->getValue() ;
}
if (pData &&
(pData->callId->compareTo(callID) == 0 ||
(pData->sessionCallId && (pData->sessionCallId->compareTo(callID) == 0)) ||
(pData->transferCallId && (pData->transferCallId->compareTo(callID) == 0))) &&
pData->pInst->pCallManager == pSrc)
{
hCall = pIndex->getValue() ;
#ifdef DUMP_CALLS
OsSysLog::add(FAC_SIPXTAPI, PRI_DEBUG, "***************** LookupHandle ***\nhCall %d\n****callId %s\n***sessionCallId %s\n",
hCall,
pData->callId ? pData->callId->data() : NULL,
pData->sessionCallId ? pData->sessionCallId->data() : NULL);
#endif
break ;
}
}
gpCallHandleMap->unlock() ;
}
return hCall;
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:42,代码来源:sipXtapiInternal.cpp
示例14: iter
// Get an array of pointers to the Rscs that are currently active.
// The caller provides an array that can hold up to "size" OsRsc
// pointers. This method will fill in the "activeRscs" array with
// up to "size" pointers. The method returns the number of pointers
// in the array that were actually filled in.
int UtlRscStore::getActiveRscs(char* activeRscs[], int size)
{
UtlHashMapIterator iter(mDict);
UtlContainable* next;
UtlInt* value;
int i;
iter.reset();
i = 0;
while (next = iter())
{
if (i >= size) break;
value = (UtlInt*) iter.value();
activeRscs[i] = (char*) value->value();
i++;
}
return i;
}
开发者ID:ATHLSolutions,项目名称:sipxecs,代码行数:25,代码来源:UtlRscStore.cpp
示例15: requestSet
void requestSet(Url& url, UtlHashMap& parameters)
{
XmlRpcRequest* request;
XmlRpcResponse response;
request = new XmlRpcRequest(url, "configurationParameter.set");
request->addParam(&DataSet);
request->addParam(¶meters);
if (request->execute(response /*, &pSocket*/))
{
UtlContainable* value;
if (response.getResponse(value))
{
UtlInt* numberSet = dynamic_cast<UtlInt*>(value);
if (numberSet)
{
if (Verbose == Feedback)
{
printf("set %d name/value pairs.\n", (int)numberSet->getValue());
}
}
else
{
fprintf(stderr, "Incorrect type returned.\n");
exit(1);
}
}
else
{
fprintf(stderr, "No value returned.\n");
exit(1);
}
}
else
{
exitFault(response);
}
delete request;
request = NULL;
}
开发者ID:mranga,项目名称:sipxecs,代码行数:41,代码来源:configrpc.cpp
示例16: lock
const void* SipXHandleMap::removeHandle(SIPXHANDLE handle)
{
lock() ;
releaseHandleRef(handle);
const void* pRC = NULL ;
UtlInt key(handle) ;
UtlInt* pCount = static_cast<UtlInt*>(mLockCountHash.findValue(&key)) ;
if (pCount == NULL || pCount->getValue() < 1)
{
UtlVoidPtr* pValue ;
pValue = (UtlVoidPtr*) findValue(&key) ;
if (pValue != NULL)
{
pRC = pValue->getValue() ;
if(! destroy(&key))
{
OsSysLog::add(FAC_SIPXTAPI, PRI_ERR,
"SipXHandleMap::removeHandle failed to destroy handle: %d",
handle);
}
}
if (pCount)
{
if(! mLockCountHash.destroy(&key))
{
OsSysLog::add(FAC_SIPXTAPI, PRI_ERR,
"SipXHandleMap::removeHandle failed to destroy lock count for handle: %d",
handle);
}
}
}
unlock() ;
return pRC ;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:40,代码来源:SipXHandleMap.cpp
示例17: sipxDumpCalls
void sipxDumpCalls()
{
if (gpCallHandleMap->lock())
{
UtlHashMapIterator iter(*gpCallHandleMap);
UtlInt* pIndex = NULL;
UtlVoidPtr* pObj = NULL;
SIPX_CALL hCall = 0 ;
while (pIndex = dynamic_cast<UtlInt*>( iter() ) )
{
pObj = dynamic_cast<UtlVoidPtr*>(gpCallHandleMap->findValue(pIndex));
SIPX_CALL_DATA* pData = NULL ;
if (pObj)
{
pData = (SIPX_CALL_DATA*) pObj->getValue() ;
}
if (pData)
{
hCall = pIndex->getValue() ;
OsSysLog::add(FAC_SIPXTAPI, PRI_DEBUG,
"***************** CallDump***\n"
"hCall %d\n"
"****callId %s\n"
"****ghostCallId %s\n"
"***bRemoveInsteadOfDrop %d\n"
"****lineUri %s\n",
hCall,
pData->callId ? pData->callId->data() : NULL,
pData->ghostCallId ? pData->ghostCallId->data() : NULL,
pData->bRemoveInsteadOfDrop,
pData->lineURI ? pData->lineURI->data() : NULL);
}
}
gpCallHandleMap->unlock() ;
}
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:40,代码来源:sipXtapiInternal.cpp
示例18: removeVirtualOutputs
int MpTopologyGraph::removeVirtualOutputs(MpResourceTopology& resourceTopology,
UtlBoolean replaceNumInName,
int resourceNum)
{
int portsDestroyed = 0;
MpResourceTopology::VirtualPortIterator portIter;
UtlString realResourceName;
int realPortIdx;
UtlString virtualResourceName;
int virtualPortIdx;
UtlInt keyPortIdx;
UtlContainablePair keyPair(&virtualResourceName, &keyPortIdx);
resourceTopology.initVirtualOutputIterator(portIter);
while (resourceTopology.getNextVirtualOutput(portIter,
realResourceName, realPortIdx,
virtualResourceName, virtualPortIdx)
== OS_SUCCESS)
{
if(replaceNumInName)
{
MpResourceTopology::replaceNumInName(virtualResourceName, resourceNum);
}
// Destroy entry in the virtual ports map.
keyPortIdx.setValue(virtualPortIdx);
if (mVirtualOutputs.destroy(&keyPair))
{
portsDestroyed++;
}
}
resourceTopology.freeVirtualOutputIterator(portIter);
// Prevent deletion of stack objects.
keyPair.setFirst(NULL);
keyPair.setSecond(NULL);
return portsDestroyed;
}
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:39,代码来源:MpTopologyGraph.cpp
示例19: osPrintf
int MpTopologyGraph::linkTopologyResources(MpResourceTopology& resourceTopology,
UtlHashBag& newResources,
UtlBoolean replaceNumInName,
int resourceNum)
{
// Link the resources
int connectionIndex = 0;
UtlString outputResourceName;
UtlString inputResourceName;
int outputResourcePortIndex;
int inputResourcePortIndex;
MpResource* outputResource = NULL;
MpResource* inputResource = NULL;
OsStatus result;
UtlHashMap newConnectionIds;
#ifdef TEST_PRINT
osPrintf("%d new resources in the list\n", newResources.entries());
UtlHashBagIterator iterator(newResources);
MpResource* containerResource = NULL;
while(containerResource = (MpResource*) iterator())
{
osPrintf("found list resource: \"%s\" value: \"%s\"\n",
containerResource->getName().data(), containerResource->data());
}
#endif
while(resourceTopology.getConnection(connectionIndex,
outputResourceName,
outputResourcePortIndex,
inputResourceName,
inputResourcePortIndex) == OS_SUCCESS)
{
if(replaceNumInName)
{
resourceTopology.replaceNumInName(outputResourceName, resourceNum);
resourceTopology.replaceNumInName(inputResourceName, resourceNum);
}
// Look in the container of new resources first as this is more
// efficient and new resources are not added immediately to a running
// flowgraph
outputResource = (MpResource*) newResources.find(&outputResourceName);
if(outputResource == NULL)
{
result = lookupResource(outputResourceName, outputResource);
if(result != OS_SUCCESS)
{
int virtPortIdx = outputResourcePortIndex>=0?outputResourcePortIndex:-1;
int realPortIdx;
result = lookupVirtualOutput(outputResourceName, virtPortIdx,
outputResource, realPortIdx);
if (result == OS_SUCCESS && outputResourcePortIndex>=0)
{
outputResourcePortIndex = realPortIdx;
}
}
assert(result == OS_SUCCESS);
}
inputResource = (MpResource*) newResources.find(&inputResourceName);
if(inputResource == NULL)
{
result = lookupResource(inputResourceName, inputResource);
if(result != OS_SUCCESS)
{
int virtPortIdx = inputResourcePortIndex>=0?inputResourcePortIndex:-1;
int realPortIdx;
result = lookupVirtualInput(inputResourceName, virtPortIdx,
inputResource, realPortIdx);
if (result == OS_SUCCESS && inputResourcePortIndex>=0)
{
inputResourcePortIndex = realPortIdx;
}
}
assert(result == OS_SUCCESS);
}
assert(outputResource);
assert(inputResource);
if(outputResource && inputResource)
{
if(outputResourcePortIndex == MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
{
outputResourcePortIndex = outputResource->reserveFirstUnconnectedOutput();
assert(outputResourcePortIndex >= 0);
}
else if(outputResourcePortIndex < MpResourceTopology::MP_TOPOLOGY_NEXT_AVAILABLE_PORT)
{
// First see if a real port is already in the dictionary
UtlInt searchKey(outputResourcePortIndex);
UtlInt* foundValue = NULL;
if((foundValue = (UtlInt*) newConnectionIds.findValue(&searchKey)))
{
// Use the mapped index
outputResourcePortIndex = foundValue->getValue();
}
else
{
// Find an available port and add it to the map
int realPortNum = outputResource->reserveFirstUnconnectedOutput();
//.........这里部分代码省略.........
开发者ID:John-Chan,项目名称:sipXtapi,代码行数:101,代码来源:MpTopologyGraph.cpp
示例20: sipxLineLookupHandleByURI
SIPX_LINE sipxLineLookupHandleByURI(SIPX_INSTANCE_DATA* pInst,
const char* szURI)
{
SIPX_LINE hLine = 0 ;
Url urlLine(szURI) ;
// Use the line manager to find identity if available
if (pInst && pInst->pLineManager)
{
SipLine* pLine = pInst->pLineManager->findLineByURL(urlLine, "unknown") ;
if (pLine)
urlLine = pLine->getIdentity() ;
}
if (gpLineHandleMap->lock())
{
UtlHashMapIterator iter(*gpLineHandleMap);
UtlInt* pIndex = NULL;
UtlVoidPtr* pObj = NULL;
while (pIndex = dynamic_cast<UtlInt*>( iter() ) )
{
pObj = dynamic_cast<UtlVoidPtr*>(gpLineHandleMap->findValue(pIndex));
SIPX_LINE_DATA* pData = NULL ;
if (pObj)
{
pData = (SIPX_LINE_DATA*) pObj->getValue() ;
if (pData)
{
// Check main line definition
if (urlLine.isUserHostPortEqual(*pData->lineURI))
{
hLine = pIndex->getValue() ;
break ;
}
// Check for line aliases
if (pData->pLineAliases)
{
UtlVoidPtr* pValue ;
Url* pUrl ;
UtlSListIterator iterator(*pData->pLineAliases) ;
while (pValue = (UtlVoidPtr*) iterator())
{
pUrl = (Url*) pValue->getValue() ;
if (urlLine.isUserHostPortEqual(*pUrl))
{
hLine = pIndex->getValue() ;
break ;
}
}
}
}
}
}
gpLineHandleMap->unlock() ;
}
return hLine;
}
开发者ID:LordGaav,项目名称:sipxecs,代码行数:64,代码来源:sipXtapiInternal.cpp
注:本文中的UtlInt类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论