本文整理汇总了C++中LList::getFirst方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::getFirst方法的具体用法?C++ LList::getFirst怎么用?C++ LList::getFirst使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LList
的用法示例。
在下文中一共展示了LList::getFirst方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: includes
bool GroupTagSubscription::includes (Subscription *pSubscription)
{
if (pSubscription->getSubscriptionType() == GROUP_TAG_SUBSCRIPTION) {
GroupTagSubscription *pGTS = (GroupTagSubscription*) pSubscription;
LList<uint16> *pTags = pGTS->getTags();
uint16 ui16Tag;
pTags->getFirst (ui16Tag);
for (int i = 0; i < pTags->length; i++) {
if (!_ui16Tags.contains (ui16Tag)) {
return false;
}
pTags->getNext (ui16Tag);
}
return true;
}
return false;
}
示例2: doMetadataArrived
void PositionUpdater::doMetadataArrived (StringHashtable<MsgIdList > *pMsgToNotifyByQueryId)
{
if (pMsgToNotifyByQueryId == nullptr) {
return;
}
const char *pszMethodName = "PositionUpdater::doMetadataArrived";
String msgId;
StringHashtable<LList<String> >::Iterator iter = pMsgToNotifyByQueryId->getAllElements();
for (; !iter.end(); iter.nextElement()) {
const char *pszQueryId = iter.getKey();
LList<String> *pMsgToNotify = iter.getValue();
for (int rc = pMsgToNotify->getFirst (msgId); rc == 1; rc = pMsgToNotify->getNext (msgId)) {
MessageHeaders::MsgType type;
Message *pMessage = getCompleteMessageAndRemoveDSProMetadata (_pDSPro->_pDataStore, msgId.c_str(), type);
if (pMessage == nullptr || (type != MessageHeaders::Data && type != MessageHeaders::Metadata)) {
// The message to be notified to the application was not found at
// this time. Re-add it to the list of messages to notify so it can
// be tried again later.
static const char * messageIds[2];
messageIds[0] = msgId.c_str();
messageIds[1] = nullptr;
addMetadataToNotify (pszQueryId, messageIds);
}
else {
MessageInfo *pMI = pMessage->getMessageInfo();
char *pszId = convertFieldToKey (pMI->getGroupName(), pMI->getPublisherNodeId(), pMI->getMsgSeqId());
const String currMsgId (pszId);
if (pszId == nullptr) {
checkAndLogMsg (pszMethodName, memoryExhausted);
}
else {
free (pszId);
pszId = nullptr;
}
String sGrpName (MessageIdGenerator::extractSubgroupFromMsgGroup (pMI->getGroupName()));
if (sGrpName.length() <= 0) {
checkAndLogMsg (pszMethodName, Logger::L_MildError, "could not extract group message id\n");
sGrpName = pMI->getGroupName();
}
if (type == MessageHeaders::Metadata) {
MetaData *pMetadata = toMetadata (pMessage->getData(), pMI->getTotalMessageLength());
if (pMetadata != nullptr) {
String sReferredObjectId, sReferredInstanceId, sRefersTo;
getReferredObjectAndInstanceIds (pMetadata, sReferredObjectId, sReferredInstanceId, sRefersTo);
int rc = _pDSPro->metadataArrived (currMsgId, sGrpName, sReferredObjectId,
sReferredInstanceId, pMetadata, sRefersTo,
pszQueryId);
checkAndLogMsg (pszMethodName, Logger::L_Info, "notified clients "
"with message %s matching query request %s\n/",
currMsgId.c_str(), pszQueryId);
delete pMetadata;
pMetadata = nullptr;
if (rc != 0) {
checkAndLogMsg (pszMethodName, Logger::L_Warning, "Can not notify message "
"with id = <%s> failed. Returned %d\n", currMsgId.c_str(), rc);
}
else {
checkAndLogMsg (pszMethodName, Logger::L_Info, "client applications "
"notified message with id: <%s>.\n", currMsgId.c_str());
}
}
}
else {
// Data or chunked data
uint8 ui8ChunkIndex = pMI->getTotalNumberOfChunks() == 0 ? (uint8) 0 : 1; // HACK: For the general case I need to figure out the current number of chunks from the database
rc = _pDSPro->dataArrived (currMsgId, sGrpName, pMI->getObjectId(), pMI->getInstanceId(),
pMI->getAnnotates(), pMI->getMimeType(), pMessage->getData(),
pMI->getTotalMessageLength(), ui8ChunkIndex, pMI->getTotalNumberOfChunks(),
pszQueryId);
}
free ((void*) pMessage->getData());
delete pMessage->getMessageHeader();
delete pMessage;
}
}
}
}
示例3: run
void PositionUpdater::run (void)
{
const char *pszMethodName = "PositionUpdater::run";
setName (pszMethodName);
started();
BufferWriter bw;
do {
_m.lock();
if (!_bMessageRequested) {
_cv.wait (DSPro::DEFAULT_UPDATE_TIMEOUT);
}
if (pTopoLog != nullptr) {
if ((_pDSPro != nullptr) && (_pDSPro->_pTopology != nullptr)) {
logTopology (pszMethodName, Logger::L_Info, "\n==== TOPOLOGY ===\n");
_pDSPro->_pTopology->display (pTopoLog->getLogFileHandle());
logTopology (pszMethodName, Logger::L_Info, "\n=================\n");
}
}
LList<MsgIdWrapper> msgToRequestCpy;
int64 i64Now = getTimeInMilliseconds();
for (MsgIdWrapper *pMsgIdWr = _msgToRequest.getFirst(); pMsgIdWr != nullptr; pMsgIdWr = _msgToRequest.getNext()) {
msgToRequestCpy.add (*pMsgIdWr); // copy the IDs of the message to request
pMsgIdWr->ui64LatestRequestTime = i64Now;
}
_msgToRequest.removeAll();
StringHashtable<LList<String> > *pMsgToNotify = _pMsgToNotify;
_pMsgToNotify = new StringHashtable<LList<String> >(true, true, true, true);
_m.unlock();
MsgIdWrapper msgIdWr;
for (int rc = msgToRequestCpy.getFirst (msgIdWr); rc == 1; rc = msgToRequestCpy.getNext (msgIdWr)) {
int64 i64Elapsed = i64Now - msgIdWr.ui64LatestRequestTime;
if (msgIdWr.ui64LatestRequestTime == 0U || (i64Elapsed > DSPro::DEFAULT_UPDATE_TIMEOUT)) {
Targets **ppTargets;
if (msgIdWr.senderId.length() <= 0) {
ppTargets = _pDSPro->_pTopology->getNeighborsAsTargets();
}
else {
ppTargets = _pDSPro->_pTopology->getForwardingTargets (_pDSPro->getNodeId(), msgIdWr.senderId);
}
if ((ppTargets != nullptr) && (ppTargets[0] != nullptr)) {
int rc = 0;
String publisher (msgIdWr.publisherId.length() <= 0 ? _pDSPro->getNodeId() : msgIdWr.publisherId.c_str());
if (isOnDemandDataID (msgIdWr.msgId)) {
rc = _pDSPro->_adaptMgr.sendChunkRequestMessage (msgIdWr.msgId, &(msgIdWr.locallyCachedChunkIds),
publisher, ppTargets);
}
else {
rc = _pDSPro->_adaptMgr.sendMessageRequestMessage (msgIdWr.msgId, publisher, ppTargets);
}
if (rc == 0) {
checkAndLogMsg (pszMethodName, Logger::L_Info, "Requested request "
"message with id: <%s>.\n", msgIdWr.msgId.c_str());
}
else {
checkAndLogMsg (pszMethodName, Logger::L_Warning, "Can not request message with "
"id = <%s> failed. Returned %d\n", msgIdWr.msgId.c_str(), rc);
}
}
Targets::deallocateTargets (ppTargets);
}
}
doMetadataArrived (pMsgToNotify);
delete pMsgToNotify;
_m.lock();
_bMessageRequested = false;
int64 i64Tmp = _i64TimeStamp;
_m.unlock();
if ((getTimeInMilliseconds() - i64Tmp) > DSPro::DEFAULT_UPDATE_TIMEOUT) {
if (_pNodeContexMgr->getActivePeerNumber() == 0) {
continue;
}
bw.reset();
int rc = _pNodeContexMgr->updatePosition (&bw);
if (rc < 0) {
checkAndLogMsg (pszMethodName, Logger::L_MildError, "Could not write "
"the way point message. Error code %d.\n", rc);
continue;
}
_m.lock();
_i64TimeStamp = getTimeInMilliseconds();
_m.unlock();
_pDSPro->sendWaypointMessage (bw.getBuffer(), bw.getBufferLength());
}
if (_pDSPro->_bEnableTopologyExchange && _bTopologyHasChanged) {
_bTopologyHasChanged = false;
//.........这里部分代码省略.........