本文整理汇总了C++中UnsignedArray类的典型用法代码示例。如果您正苦于以下问题:C++ UnsignedArray类的具体用法?C++ UnsignedArray怎么用?C++ UnsignedArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了UnsignedArray类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: init
void init()
{
// prepare topology.
unsigned rootNodes = container.queryJob().querySlaves();
unsigned res = MERGE_GRANULARITY;
sD = new MemoryBuffer[rootNodes];
UnsignedArray nodes1, nodes2;
UnsignedArray *currentLevel = &nodes1, *nextLevel = &nodes2;
unsigned n = 0; while (n<rootNodes) currentLevel->append(n++);
while (rootNodes > 1)
{
assertex(rootNodes);
unsigned r = (rootNodes+(res-1))/res; // groups
unsigned t = 0;
n = 0;
bool first = true;
loop
{
if (first)
{
first = false;
nextLevel->append(currentLevel->item(n));
}
else
{
#ifdef _DEBUG
unsigned node = nextLevel->tos();
unsigned item = currentLevel->item(n);
ActPrintLog("Adding to node=%d, item=%d", node, item);
#endif
sD[nextLevel->tos()].append(currentLevel->item(n));
}
n++;
if (n>=rootNodes) break;
t += r;
if (t>=rootNodes)
{
t -= rootNodes;
first = true;
}
}
assertex(sD[nextLevel->tos()].length()); // something must have been added
n = 0;
while (n<nextLevel->ordinality()) sD[nextLevel->item(n++)].append(0); // terminator
#ifdef _DEBUG
ActPrintLog("EOL");
#endif
rootNodes = nextLevel->ordinality();
UnsignedArray *tmp = currentLevel;
currentLevel = nextLevel;
nextLevel = tmp;
nextLevel->kill();
}
}
开发者ID:anandjun,项目名称:HPCC-Platform,代码行数:60,代码来源:thtopn.cpp
示例2: extractKeyedInfo
void DataSourceMetaData::extractKeyedInfo(UnsignedArray & offsets, TypeInfoArray & types)
{
unsigned curOffset = 0;
ForEachItemIn(i, fields)
{
if (curOffset >= keyedSize)
break;
DataSourceMetaItem & cur = fields.item(i);
switch (cur.flags)
{
case FVFFnone:
{
offsets.append(curOffset);
types.append(*LINK(cur.type));
unsigned size = cur.type->getSize();
assertex(size != UNKNOWN_LENGTH);
curOffset += size;
break;
}
case FVFFbeginrecord:
case FVFFendrecord:
break;
default:
throwUnexpected();
}
}
offsets.append(curOffset);
assertex(curOffset == keyedSize);
}
开发者ID:Goon83,项目名称:HPCC-Platform,代码行数:30,代码来源:fvsource.cpp
示例3: assert
NlpMatchPath::NlpMatchPath(const UnsignedArray & _ids, const UnsignedArray & _indices)
{
assert(_ids.ordinality() == _indices.ordinality());
ForEachItemIn(idx, _ids)
{
ids.append(_ids.item(idx));
indices.append(_indices.item(idx));
}
开发者ID:AsherBond,项目名称:HPCC-Platform,代码行数:8,代码来源:thorparse.cpp
示例4: match
bool CCronAtSchedule::match(UnsignedArray &a,unsigned v,unsigned &next)
{
if (a.ordinality()==0) {
next = v;
return true;
}
ForEachItemIn(i,a) {
unsigned n = a.item(i);
if (n>=v) {
next = n;
return true;
}
}
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:13,代码来源:jtime.cpp
示例5: tokens
MultiLexer::MultiLexer(const AsciiDfa & _tokens, const AsciiDfa & _skip, const UnsignedArray & _endTokenChars, unsigned _eofId) : tokens(_tokens), skip(_skip)
{
eofId = _eofId;
_clear(isEndToken);
ForEachItemIn(idx, _endTokenChars)
{
unsigned next = _endTokenChars.item(idx);
if (next < 256)
isEndToken[next] = true;
}
开发者ID:Josh-Googler,项目名称:HPCC-Platform,代码行数:10,代码来源:thortlex.cpp
示例6: serializeMap
void CSlavePartMapping::serializeMap(unsigned i, MemoryBuffer &mb, IGetSlaveData *extra)
{
if (local)
i = 0;
if (i >= maps.ordinality())
{
mb.append((unsigned)0);
return;
}
CSlaveMap &map = maps.item(i);
unsigned nPos = mb.length();
unsigned n=0;
mb.append(n);
UnsignedArray parts;
ForEachItemIn(m, map)
parts.append(map.item(m).queryPartIndex());
MemoryBuffer extraMb;
if (extra)
{
ForEachItemIn(m2, map)
{
unsigned xtraLen = 0;
unsigned xtraPos = extraMb.length();
extraMb.append(xtraLen);
IPartDescriptor &partDesc = map.item(m2);
if (!extra->getData(m2, partDesc.queryPartIndex(), extraMb))
{
parts.zap(partDesc.queryPartIndex());
extraMb.rewrite(xtraPos);
}
else
{
xtraLen = (extraMb.length()-xtraPos)-sizeof(xtraLen);
extraMb.writeDirect(xtraPos, sizeof(xtraLen), &xtraLen);
}
}
}
开发者ID:LlsDimple,项目名称:HPCC-Platform,代码行数:38,代码来源:thactivitymaster.cpp
示例7: doStartStop
bool Cws_machineEx::doStartStop(IEspContext &context, StringArray& addresses, char* userName, char* password, bool bStop,
IEspStartStopResponse &resp)
{
bool containCluster = false;
double version = context.getClientVersion();
const int ordinality= addresses.ordinality();
UnsignedArray threadHandles;
IArrayOf<IEspStartStopResult> resultsArray;
for (int index=0; index<ordinality; index++)
{
const char* address0 = addresses.item(index);
//address passed in is of the form "192.168.1.4:EspProcess:2:path1"
StringArray sArray;
sArray.appendList(addresses.item(index), ":");
if (sArray.ordinality() < 4)
throw MakeStringException(ECLWATCH_MISSING_PARAMS, "Incomplete arguments");
Owned<IEspStartStopResult> pResult = static_cast<IEspStartStopResult*>(new CStartStopResult(""));
const char* address = sArray.item(0);
const char* compType= sArray.item(1);
const char* OS = sArray.item(3);//index 2 is component name
const char* path = sArray.item(4);
if (!(address && *address && compType && *compType && OS && *OS && path && *path))
throw MakeStringExceptionDirect(ECLWATCH_INVALID_INPUT, "Invalid input");
if (!stricmp(compType, "ThorCluster") || !stricmp(compType, "RoxieCluster"))
containCluster = true;
#ifndef OLD_START_STOP
{
char* configAddress = NULL;
char* props1 = (char*) strchr(address, '|');
if (props1)
{
configAddress = props1+1;
*props1 = '\0';
}
else
{
configAddress = (char*) address;
}
StringBuffer newAddress;
ConvertAddress(address0, newAddress);
pResult->setAddressOrig ( newAddress.str() );//can be either IP or name of component
pResult->setAddress ( address );//can be either IP or name of component
pResult->setCompType( compType );
if (version > 1.04)
{
pResult->setName( path );
const char* pStr2 = strstr(path, "LexisNexis");
if (pStr2)
{
char name[256];
const char* pStr1 = strchr(pStr2, '|');
if (!pStr1)
{
strcpy(name, pStr2+11);
}
else
{
strncpy(name, pStr2+11, pStr1 - pStr2 -11);
name[pStr1 - pStr2 -11] = 0;
}
pResult->setName( name );
}
}
pResult->setOS( atoi(OS) );
pResult->setPath( path );
resultsArray.append(*pResult.getLink());
CStartStopThreadParam* pThreadReq;
pThreadReq = new CStartStopThreadParam(address, configAddress, bStop, m_useDefaultHPCCInit, this, context);
pThreadReq->setResultObject( pResult );
if (userName && *userName)
pThreadReq->setUserID( userName );
if (password && *password)
pThreadReq->setPassword( password );
PooledThreadHandle handle = m_threadPool->start( pThreadReq );
threadHandles.append(handle);
}
#else
{
StringBuffer newAddress;
ConvertAddress(address0, newAddress);
char* pStr = (char*) strchr(address, '|');;
if (pStr)
pStr[0] = 0;
pResult->setAddressOrig ( newAddress.str() );//can be either IP or name of component
pResult->setAddress ( address );//can be either IP or name of component
//.........这里部分代码省略.........
开发者ID:RogerDev,项目名称:HPCC-Platform,代码行数:101,代码来源:ws_machineServiceRexec.cpp
注:本文中的UnsignedArray类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论