本文整理汇总了C++中Linked类的典型用法代码示例。如果您正苦于以下问题:C++ Linked类的具体用法?C++ Linked怎么用?C++ Linked使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Linked类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
inline void Linked<C>::insert_after(Linked<C>& x) {
// *p -> *this -> x -> *n
x.set_prev(*this);
x.set_next(this->next());
next().set_prev(x);
set_next(x);
}
示例2: b
ILoadedDllEntry * SafePluginMap::getPluginDll(const char *id, const char *version, bool checkVersion)
{
CriticalBlock b(crit);
Linked<PluginDll> ret = static_cast<PluginDll *>(map.getValue(id));
if (ret && checkVersion)
{
if (!ret->checkVersion(version))
return NULL;
}
return ret.getLink();
}
示例3: convertExisting
void convertExisting()
{
Linked<IPropertyTree> pmPart = pmExisting;
const char *s = strstr(pmid.str(), "::");
if (s)
pmPart->addProp("@id", s+2);
packageMaps->removeTree(pmExisting);
Owned<IPropertyTree> pmTree = createPTree("PackageMap", ipt_ordered);
pmTree->setProp("@id", pmid);
pmTree->setPropBool("@multipart", true);
pmTree->addPropTree("Part", pmPart.getClear());
pmExisting = packageMaps->addPropTree("PackageMap", pmTree.getClear());
}
示例4: notify
virtual void notify(SubscriptionId subid, const char *daliXpath, SDSNotifyFlags flags, unsigned valueLen, const void *valueData)
{
Linked<CDaliPackageWatcher> me = this; // Ensure that I am not released by the notify call (which would then access freed memory to release the critsec)
Linked<ISDSSubscription> myNotifier;
{
CriticalBlock b(crit);
if (traceLevel > 5)
DBGLOG("Notification on %s (%s), %p", xpath.get(), daliXpath ? daliXpath : "", this);
myNotifier.set(notifier);
// allow crit to be released, allowing this to be unsubscribed, to avoid deadlocking when other threads via notify call unsubscribe
}
if (myNotifier)
myNotifier->notify(subid, daliXpath, flags, valueLen, valueData);
}
示例5: main
int main(int argc, char *argv[])
{
String read="run -t -includelist linkdemo";
Linked<String> tokenlist;
Linked<String> optionlist;
char s[]="hello world";
String test=s;
std::cout<<test;
char str[50];
int i=0;
std::cout<<read.length()<<std::endl;
while(read[i]!='\0')
{
int j=0;
if(read[i]!='-')
{
while(read[i]!=' ' && read[i]!='\0')
str[j++]=read[i++];
str[j]='\0';
String temp=str;
tokenlist.InsertAfter(temp);
}
else
{
while(read[i]!=' ' && read[i]!='\0')
str[j++]=read[i++];
str[j]='\0';
String temp=str;
//std::cout<<str<<endl;
optionlist.InsertAfter(temp);
//PrintLink(optionlist);
}
std::cout<<"|"<<str<<"|"<<endl;
if(read[i]!='\0')
i++;
}
PrintLink(tokenlist);
//PrintLink(optionlist);
/*Linked<String> l;
String stre="hell world";
l.InsertAfter(stre);
PrintLink(l);*/
std::system("pause");
return 0;
}
示例6: main
main(){
Linked L;
L.append(1);
L.append(3);
L.append(5);
L.append(3);
L.append(5);
L.append(11);
L.displayList();
L.remDups();
std::cout << "duplicates removed \n" ;
std::cout << L ;
}
示例7: prev
inline void Linked<C>::insert_before(Linked<C>& x) {
x.set_prev(prev());
x.set_next(*this);//thisは、ROOTインスタンスを指す。
prev().set_next(x);
set_prev(x);
}
示例8: process
virtual void process() override
{
ActPrintLog("INDEXWRITE: Start");
init();
IRowStream *stream = inputStream;
ThorDataLinkMetaInfo info;
input->getMetaInfo(info);
outRowAllocator.setown(getRowAllocator(helper->queryDiskRecordSize()));
start();
if (refactor)
{
assertex(isLocal);
if (active)
{
unsigned targetWidth = partDesc->queryOwner().numParts()-(buildTlk?1:0);
assertex(0 == container.queryJob().querySlaves() % targetWidth);
unsigned partsPerNode = container.queryJob().querySlaves() / targetWidth;
unsigned myPart = queryJobChannel().queryMyRank();
IArrayOf<IRowStream> streams;
streams.append(*LINK(stream));
--partsPerNode;
// Should this be merging 1,11,21,31 etc.
unsigned p=0;
unsigned fromPart = targetWidth+1 + (partsPerNode * (myPart-1));
for (; p<partsPerNode; p++)
{
streams.append(*createRowStreamFromNode(*this, fromPart++, queryJobChannel().queryJobComm(), mpTag, abortSoon));
}
ICompare *icompare = helper->queryCompare();
assertex(icompare);
Owned<IRowLinkCounter> linkCounter = new CThorRowLinkCounter;
myInputStream.setown(createRowStreamMerger(streams.ordinality(), streams.getArray(), icompare, false, linkCounter));
stream = myInputStream;
}
else // serve nodes, creating merged parts
rowServer.setown(createRowServer(this, stream, queryJobChannel().queryJobComm(), mpTag));
}
processed = THORDATALINK_STARTED;
// single part key support
// has to serially pull all data fron nodes 2-N
// nodes 2-N, could/should start pushing some data (as it's supposed to be small) to cut down on serial nature.
unsigned node = queryJobChannel().queryMyRank();
if (singlePartKey)
{
if (1 == node)
{
try
{
open(*partDesc, false, helper->queryDiskRecordSize()->isVariableSize());
loop
{
OwnedConstThorRow row = inputStream->ungroupedNextRow();
if (!row)
break;
if (abortSoon) return;
processRow(row);
}
unsigned node = 2;
while (node <= container.queryJob().querySlaves())
{
Linked<IOutputRowDeserializer> deserializer = ::queryRowDeserializer(input);
CMessageBuffer mb;
Owned<ISerialStream> stream = createMemoryBufferSerialStream(mb);
CThorStreamDeserializerSource rowSource;
rowSource.setStream(stream);
bool successSR;
loop
{
{
BooleanOnOff tf(receivingTag2);
successSR = queryJobChannel().queryJobComm().sendRecv(mb, node, mpTag2);
}
if (successSR)
{
if (rowSource.eos())
break;
Linked<IEngineRowAllocator> allocator = ::queryRowAllocator(input);
do
{
RtlDynamicRowBuilder rowBuilder(allocator);
size32_t sz = deserializer->deserialize(rowBuilder, rowSource);
OwnedConstThorRow fRow = rowBuilder.finalizeRowClear(sz);
processRow(fRow);
}
while (!rowSource.eos());
}
}
node++;
}
}
catch (CATCHALL)
{
close(*partDesc, partCrc, true);
throw;
}
//.........这里部分代码省略.........
示例9: processMessage
void processMessage(CMessageBuffer &mb)
{
ICoven &coven=queryCoven();
MemoryBuffer params;
params.swapWith(mb);
int fn;
params.read(fn);
switch (fn) {
case MDR_GET_VALUE: {
StringAttr id;
StringBuffer buf;
params.read(id);
if (0 == stricmp(id,"threads")) {
mb.append(getThreadList(buf).str());
}
else if (0 == stricmp(id, "mpqueue")) {
mb.append(getReceiveQueueDetails(buf).str());
}
else if (0 == stricmp(id, "locks")) {
mb.append(querySDS().getLocks(buf).str());
}
else if (0 == stricmp(id, "sdsstats")) {
mb.append(querySDS().getUsageStats(buf).str());
}
else if (0 == stricmp(id, "connections")) {
mb.append(querySDS().getConnections(buf).str());
}
else if (0 == stricmp(id, "sdssubscribers")) {
mb.append(querySDS().getSubscribers(buf).str());
}
else if (0 == stricmp(id, "clients")) {
mb.append(querySessionManager().getClientProcessList(buf).str());
}
else if (0 == stricmp(id, "subscriptions")) {
mb.append(getSubscriptionList(buf).str());
}
else if (0 == stricmp(id, "mpverify")) {
queryWorldCommunicator().verifyAll(buf);
mb.append(buf.str());
}
else if (0 == stricmp(id, "extconsistency")) {
mb.append(querySDS().getExternalReport(buf).str());
}
else if (0 == stricmp(id, "build")) {
mb.append("$Id: dadiags.cpp 62376 2011-02-04 21:59:58Z sort $");
}
else if (0 == stricmp(id, "sdsfetch")) {
StringAttr branchpath;
params.read(branchpath);
Linked<IPropertyTree> sroot = querySDSServer().lockStoreRead();
try { sroot->queryPropTree(branchpath)->serialize(mb); }
catch (...) { querySDSServer().unlockStoreRead(); throw; }
querySDSServer().unlockStoreRead();
}
else if (0 == stricmp(id, "perf")) {
getSystemTraceInfo(buf,PerfMonStandard);
mb.append(buf.str());
}
else if (0 == stricmp(id, "sdssize")) {
StringAttr branchpath;
params.read(branchpath);
Linked<IPropertyTree> sroot = querySDSServer().lockStoreRead();
StringBuffer sbuf;
try {
toXML(sroot->queryPropTree(branchpath),sbuf);
DBGLOG("sdssize '%s' = %d",branchpath.get(),sbuf.length());
}
catch (...) {
querySDSServer().unlockStoreRead();
throw;
}
querySDSServer().unlockStoreRead();
mb.append(sbuf.length());
}
else if (0 == stricmp(id, "disconnect")) {
StringAttr client;
params.read(client);
SocketEndpoint ep(client);
PROGLOG("Dalidiag request to close client connection: %s", client.get());
Owned<INode> node = createINode(ep);
queryCoven().disconnect(node);
}
else if (0 == stricmp(id, "unlock")) {
__int64 connectionId;
bool disconnect;
params.read(connectionId);
params.read(disconnect);
PROGLOG("Dalidiag request to unlock connection id: %" I64F "x", connectionId);
StringBuffer connectionInfo;
bool success = querySDSServer().unlock(connectionId, disconnect, connectionInfo);
mb.append(success);
if (success)
mb.append(connectionInfo);
}
else if (0 == stricmp(id, "save")) {
PROGLOG("Dalidiag requests SDS save");
querySDSServer().saveRequest();
}
else if (0 == stricmp(id, "settracetransactions")) {
PROGLOG("Dalidiag requests Trace Transactions");
//.........这里部分代码省略.........
示例10: run
int run()
{
if (!started) {
try {
in->start();
started = true;
}
catch(IException * e)
{
ActPrintLog(&activity, e, "ThorLookaheadCache starting input");
startexception.setown(e);
if (asyncstart)
notify->onInputStarted(startexception);
running = false;
stopped = true;
startsem.signal();
return 0;
}
}
try {
StringBuffer temp;
if (allowspill)
GetTempName(temp,"lookahd",true);
assertex(bufsize);
if (allowspill)
smartbuf.setown(createSmartBuffer(&activity, temp.toCharArray(), bufsize, queryRowInterfaces(in)));
else
smartbuf.setown(createSmartInMemoryBuffer(&activity, queryRowInterfaces(in), bufsize));
if (notify)
notify->onInputStarted(NULL);
startsem.signal();
Linked<IRowWriter> writer = smartbuf->queryWriter();
if (preserveLhsGrouping)
{
while (required&&running)
{
OwnedConstThorRow row = in->nextRow();
if (!row)
{
row.setown(in->nextRow());
if (!row)
break;
else
writer->putRow(NULL); // eog
}
++count;
writer->putRow(row.getClear());
if (required!=RCUNBOUND)
required--;
}
}
else
{
while (required&&running)
{
OwnedConstThorRow row = in->ungroupedNextRow();
if (!row)
break;
++count;
writer->putRow(row.getClear());
if (required!=RCUNBOUND)
required--;
}
}
}
catch(IException * e)
{
ActPrintLog(&activity, e, "ThorLookaheadCache get exception");
getexception.setown(e);
}
if (notify)
notify->onInputFinished(count);
if (smartbuf)
smartbuf->queryWriter()->flush();
running = false;
try {
if (in)
in->stop();
}
catch(IException * e)
{
ActPrintLog(&activity, e, "ThorLookaheadCache stop exception");
if (!getexception.get())
getexception.setown(e);
}
return 0;
}
示例11: flush
virtual void flush()
{
if (!flushdone) {
out->flush();
offset_t end = out->getPosition();
writeidxofs(end);
if (outidx)
outidx->flush();
flushdone = true;
}
}
示例12: init
void init()
{
StringBuffer xpath("Software/ThorCluster[@name=\"");
xpath.append(clusterName).append("\"]");
Owned<IRemoteConnection> conn = querySDS().connect("/Environment", myProcessSession(), RTM_LOCK_READ, SDS_LOCK_TIMEOUT);
environment.setown(createPTreeFromIPT(conn->queryRoot()));
options = environment->queryPropTree(xpath.str());
if (!options)
throwUnexpected();
groupName.set(options->queryProp("@nodeGroup"));
if (groupName.isEmpty())
groupName.set(options->queryProp("@name"));
VStringBuffer spareS("%s_spares", groupName.get());
spareGroupName.set(spareS);
group.setown(queryNamedGroupStore().lookup(groupName));
spareGroup.setown(queryNamedGroupStore().lookup(spareGroupName));
}
示例13: putRow
void putRow(const void *_row)
{
offset_t start = out->getPosition();
OwnedConstThorRow row = _row;
out->putRow(row.getLink());
idx++;
if (idx==interval) {
idx = 0;
if (overflowed||rowArray.isFull()) {
overflowsize = out->getPosition();
if (!overflowed) {
PROGLOG("Sample buffer full");
overflowed = true;
}
}
else
rowArray.append(row.getClear());
}
writeidxofs(start);
}
示例14: writeidxofs
void writeidxofs(offset_t o)
{
// lazy index write
if (outidx.get()) {
outidx->write(sizeof(o),&o);
return;
}
if (lastofs) {
if (fixedsize!=o-lastofs) {
// right create idx
StringBuffer tempname;
GetTempName(tempname.clear(),"srtidx",false);
outidxfile.setown(createIFile(tempname.str()));
Owned<IFileIO> fileioidx = outidxfile->open(IFOcreate);
outidx.setown(fileioidx?createBufferedIOStream(fileioidx,0x100000):NULL);
if (outidx.get()==NULL) {
StringBuffer err;
err.append("Cannot create ").append(outidxfile->queryFilename());
LOG(MCerror, thorJob, "%s", err.str());
throw MakeStringException(-1, "%s", err.str());
}
offset_t s = 0;
while (s<=lastofs) {
outidx->write(sizeof(s),&s);
s += fixedsize;
}
assertex(s==lastofs+fixedsize);
fixedsize = 0;
writeidxofs(o);
return;
}
}
else
fixedsize = (size32_t)(o-lastofs);
lastofs = o;
}
示例15: getPosition
virtual offset_t getPosition()
{
return out->getPosition();
}