本文整理汇总了C++中LList::add方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::add方法的具体用法?C++ LList::add怎么用?C++ LList::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LList
的用法示例。
在下文中一共展示了LList::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char** argv)
{
LList* l = new LList();
l->add(1)->p()->add(2)->p()->add(4)->p()->add(10)->p()->add(80)->p();
l->reverse()->p();
l->remove(44)->p()->remove(2)->p()->remove(10)->p()->remove(80)->p()->remove(1)->p()->remove(4)->p()->remove(99)->p();
StackL* s = new StackL();
s->push(1)->p()->push(2)->p()->push(5)->p()->push(3)->p();
s->pop();
s->p();
s->pop();
s->p();
s->pop();
s->p();
s->pop();
s->p();
QueueL* q = new QueueL();
q->enq(1)->p()->enq(2)->p()->enq(5)->p();
q->dq()->p()->dq()->p()->dq()->p();
return 0;
}
示例2:
LList<uint16> * GroupTagSubscription::getTags (void)
{
if (_ui16Tags.getCount() <= 0) {
return NULL;
}
LList<uint16> *pRet = new LList<uint16>();
for (UInt32Hashtable<TagInfo>::Iterator i = _ui16Tags.getAllElements(); !i.end(); i.nextElement()) {
pRet->add (i.getKey());
}
return pRet;
}
示例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;
//.........这里部分代码省略.........