Skip to content

Commit

Permalink
HPCC-12290 Reimplement jarray using templates
Browse files Browse the repository at this point in the history
Signed-off-by: Gavin Halliday <[email protected]>
  • Loading branch information
ghalliday committed Sep 29, 2014
1 parent d064f43 commit 20c8c68
Show file tree
Hide file tree
Showing 139 changed files with 826 additions and 1,046 deletions.
4 changes: 2 additions & 2 deletions common/deftype/deftype.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3846,7 +3846,7 @@ void XmlSchemaBuilder::endRecord(const char * name)
attributes.pop();
xml.append("</xs:complexType>").newline();
xml.append("</xs:element>").newline();
optionalNesting = nesting.pop();
optionalNesting = nesting.popGet();
}

bool XmlSchemaBuilder::beginDataset(const char * name, const char * row, bool hasMixedContent, unsigned *updatePos)
Expand Down Expand Up @@ -3913,7 +3913,7 @@ void XmlSchemaBuilder::endDataset(const char * name, const char * row)
xml.append("</xs:complexType>").newline();
xml.append("</xs:element>").newline();
}
optionalNesting = nesting.pop();
optionalNesting = nesting.popGet();
}

bool XmlSchemaBuilder::addSingleFieldDataset(const char * name, const char * childname, ITypeInfo & type)
Expand Down
2 changes: 1 addition & 1 deletion common/deftype/deftype.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ class DEFTYPE_API XmlSchemaBuilder : public ISchemaBuilder
IntArray stringSizes;
IntArray decimalSizes;
UnsignedArray nesting;
CopyArray setTypes;
ICopyArray setTypes;
unsigned optionalNesting;
bool addHeader;
};
Expand Down
2 changes: 1 addition & 1 deletion common/deftype/deftype.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ class CEnumeratedTypeInfo : public CTypeInfo, public IEnumeratedTypeBuilder
private:
size32_t numValues;
KeptHashTable valueMap;
Array valueList;
IArray valueList;
Owned<ITypeInfo> base;

public:
Expand Down
2 changes: 1 addition & 1 deletion common/dllserver/dllserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ IIterator * DllEntry::createLocationIterator()

typedef IArrayOf<IDllLocation> LocationArray;

int orderLocations(IInterface * * pLeft, IInterface * * pRight)
int orderLocations(IInterface * const * pLeft, IInterface * const * pRight)
{
IDllLocation * left = (IDllLocation *)*pLeft;
IDllLocation * right = (IDllLocation *)*pRight;
Expand Down
2 changes: 1 addition & 1 deletion common/environment/environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ class CEnvironmentFactory : public CInterface,
{
public:
IMPLEMENT_IINTERFACE;
MAKEValueArray(SubscriptionId, SubscriptionIDs);
typedef ArrayOf<SubscriptionId> SubscriptionIDs;
SubscriptionIDs subIDs;
Mutex mutex;
Owned<CSdsSubscription> subscription;
Expand Down
4 changes: 2 additions & 2 deletions common/fileview2/fvrelate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,8 @@ void ViewERdiagramVisitor::endIfBlock()

void ViewERdiagramVisitor::endDataset(const char * name, const char * childname)
{
activeFieldPrefix.setLength(savedFieldCounts.pop());
activeFieldCount = savedFieldCounts.pop();
activeFieldPrefix.setLength(savedFieldCounts.popGet());
activeFieldCount = savedFieldCounts.popGet();
}

void ViewERdiagramVisitor::endRecord(const char * name)
Expand Down
8 changes: 4 additions & 4 deletions common/fileview2/fvrelate.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class ViewFile;
class ViewRelation;
typedef IArrayOf<ViewFile> ViewFileArray;
typedef CIArrayOf<ViewRelation> ViewRelationArray;
typedef CopyCIArrayOf<ViewFile> ViewFileCopyArray;
typedef CopyCIArrayOf<ViewRelation> ViewRelationCopyArray;
typedef CICopyArrayOf<ViewFile> ViewFileCopyArray;
typedef CICopyArrayOf<ViewRelation> ViewRelationCopyArray;

//---------------------------------------------------------------------------

Expand Down Expand Up @@ -178,7 +178,7 @@ public:
CFileTreeBrowser * browser;
unsigned maxRecursion;
bool isEfficient;
CopyCIArrayOf<ViewFile> nestedFiles;
CICopyArrayOf<ViewFile> nestedFiles;
};

struct ViewWalkOptions : public ViewGatherOptions
Expand Down Expand Up @@ -293,7 +293,7 @@ protected:
ViewRelation * relation;
Owned<DelayedFilteredResultSetCursor> filtered;
Owned<NotifyingResultSetCursor> notifier;
CopyCIArrayOf<CRelatedBrowseFile> children;
CICopyArrayOf<CRelatedBrowseFile> children;
};


Expand Down
2 changes: 1 addition & 1 deletion common/fileview2/fvsource.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ protected:
Owned<DataSourceMetaData> transformedMeta;
HqlExprAttr transformedRecord;
Owned<ILoadedDllEntry> loadedDll;
Array pluginDlls;
IArray pluginDlls;
rowTransformFunction transformer;
unsigned extraFieldsSize;
unsigned openCount;
Expand Down
6 changes: 3 additions & 3 deletions common/remote/rmtfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ class CScriptThread : public Thread
unsigned validateNodes(const SocketEndpointArray &eps,const char *dataDir, const char *mirrorDir, bool chkver, const char *script, unsigned scripttimeout, SocketEndpointArray &failures, UnsignedArray &failedcodes, StringArray &failedmessages, const char *filename)
{
// used for detecting duff nodes
PointerIArrayOf<ISocket> sockets;
IPointerArrayOf<ISocket> sockets;
unsigned to=30*1000;
unsigned n=eps.ordinality(); // use approx log scale (timeout is long but only for failure situation)
while (n>1) {
Expand All @@ -649,7 +649,7 @@ unsigned validateNodes(const SocketEndpointArray &eps,const char *dataDir, const
class casyncfor: public CAsyncFor
{
const SocketEndpointArray &eps;
const PointerIArrayOf<ISocket> &sockets;
const IPointerArrayOf<ISocket> &sockets;
SocketEndpointArray &failures;
StringArray &failedmessages;
UnsignedArray &failedcodes;
Expand All @@ -660,7 +660,7 @@ unsigned validateNodes(const SocketEndpointArray &eps,const char *dataDir, const
const char *script;
unsigned scripttimeout;
public:
casyncfor(const SocketEndpointArray &_eps,const PointerIArrayOf<ISocket> &_sockets,const char *_dataDir,const char *_mirrorDir,bool _chkv, const char *_script, unsigned _scripttimeout, const char *_filename,SocketEndpointArray &_failures, StringArray &_failedmessages,UnsignedArray &_failedcodes,CriticalSection &_sect)
casyncfor(const SocketEndpointArray &_eps,const IPointerArrayOf<ISocket> &_sockets,const char *_dataDir,const char *_mirrorDir,bool _chkv, const char *_script, unsigned _scripttimeout, const char *_filename,SocketEndpointArray &_failures, StringArray &_failedmessages,UnsignedArray &_failedcodes,CriticalSection &_sect)
: eps(_eps), sockets(_sockets), dataDir(_dataDir), mirrorDir(_mirrorDir),
failures(_failures), failedmessages(_failedmessages), failedcodes(_failedcodes), sect(_sect)
{
Expand Down
4 changes: 2 additions & 2 deletions common/roxiecommlib/roxiecommunicationclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class CRoxieCommunicationClient: public CInterface, implements IRoxieCommunicati

public:
IMPLEMENT_IINTERFACE;
CRoxieCommunicationClient(SocketEndpoint& _ep, unsigned _roxieTimeout)
CRoxieCommunicationClient(const SocketEndpoint& _ep, unsigned _roxieTimeout)
:ep(_ep), roxieTimeout(_roxieTimeout)
{
}
Expand Down Expand Up @@ -535,7 +535,7 @@ class CRoxieCommunicationClient: public CInterface, implements IRoxieCommunicati



IRoxieCommunicationClient* createRoxieCommunicationClient(SocketEndpoint &ep, unsigned roxieTimeout)
IRoxieCommunicationClient* createRoxieCommunicationClient(const SocketEndpoint &ep, unsigned roxieTimeout)
{
return new CRoxieCommunicationClient(ep, roxieTimeout);
}
Expand Down
2 changes: 1 addition & 1 deletion common/thorhelper/roxiedebug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ void CDebugCommandHandler::doDebugCommand(IPropertyTree *query, IDebuggerContext

//=======================================================================================

MAKEValueArray(const RtlTypeInfo *, RtlTypeInfoArray);
typedef ArrayOf<const RtlTypeInfo *> RtlTypeInfoArray;

class SimpleFieldSearcher : public CInterface, implements IRowMatcher
{
Expand Down
8 changes: 2 additions & 6 deletions common/thorhelper/thorralgo.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ public:
byte flags;
};

inline ActiveStage & Array__Member2Param(ActiveStage & src) { return src; }
inline void Array__Assign(ActiveStage & dest, ActiveStage & src) { dest = src; }
inline bool Array__Equal(const ActiveStage & m, const ActiveStage & p) { UNIMPLEMENTED; }

MAKECopyArrayOf(ActiveStage, ActiveStage &, ActiveStageArray);
typedef StructArrayOf<ActiveStage> ActiveStageArray;

//---------------------------------------------------------------------------

Expand Down Expand Up @@ -189,7 +185,7 @@ public:

protected:
inline bool hasActiveStage() { return (curActiveStage != NotFound); }
inline ActiveStage & topStage() { return stages.item(curActiveStage); }
inline ActiveStage & topStage() { return stages.element(curActiveStage); }

public:
RegexStateCache & cache;
Expand Down
16 changes: 8 additions & 8 deletions common/thorhelper/thorrparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,8 @@ RegexMatchAction RegexRecursivePattern::beginMatch(RegexState & state)

RegexMatchAction RegexEndRecursivePattern::match(RegexState & state)
{
RegexRecursivePattern & top = (RegexRecursivePattern &)state.stack.pop();
const void * saved = top.positionStack.pop();
RegexRecursivePattern & top = (RegexRecursivePattern &)state.stack.popGet();
const void * saved = top.positionStack.popGet();
RegexMatchAction ret = matchNext(state);
top.positionStack.append(saved);
state.stack.append(top);
Expand Down Expand Up @@ -1502,7 +1502,7 @@ RegexMatchAction RegexDonePattern::beginMatch(RegexState & state)

RegexMatchAction RegexEndNestedPattern::match(RegexState & state)
{
RegexPattern & top = state.stack.pop();
RegexPattern & top = state.stack.popGet();
RegexMatchAction ret = top.MATCH(state);
state.stack.append(top);
return ret;
Expand All @@ -1513,7 +1513,7 @@ RegexMatchAction RegexEndNestedPattern::beginMatch(RegexState & state)
{
ActiveStage & stage = pushStage(state);
stage.setState(RSfinished);
stage.extra.nextPattern = &state.namedStack.pop();
stage.extra.nextPattern = &state.namedStack.popGet();
return stage.extra.nextPattern->beginMatch(state);
}

Expand Down Expand Up @@ -2592,7 +2592,7 @@ RegexMatchAction RegexAsciiDfaPattern::match(RegexState & state)

while (potentialMatches.ordinality() > prevPotentialMatches)
{
state.cur = (const byte *)potentialMatches.pop();
state.cur = (const byte *)potentialMatches.popGet();
RegexMatchAction ret = matchNext(state);
if (ret != RegexMatchBacktrack)
{
Expand Down Expand Up @@ -2701,7 +2701,7 @@ RegexMatchAction RegexAsciiDfaPattern::nextAction(ActiveStage & stage, RegexStat
{
if (prevPotentialMatches < potentialMatches.ordinality())
{
stage.followPosition = (const byte *)potentialMatches.pop();
stage.followPosition = (const byte *)potentialMatches.popGet();
stage.setMatched();
return RegexMatchContinue;
}
Expand Down Expand Up @@ -3241,7 +3241,7 @@ ActiveStage & RegexState::pushStage()
temp.state = RSinit;
stages.append(temp);
}
return stages.item(curActiveStage);
return stages.element(curActiveStage);
}

void RegexState::popStage()
Expand All @@ -3252,7 +3252,7 @@ void RegexState::popStage()
tos.pattern->getTraceText(t);
DBGLOG("%*s[%p]Pop %s", --patternDepth, "", tos.pattern, t.str());
#endif
stages.item(curActiveStage).cleanup(*this);
stages.element(curActiveStage).cleanup(*this);
curActiveStage--;
}

Expand Down
2 changes: 1 addition & 1 deletion common/thorhelper/thorrparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct RegexXmlState;

typedef CIArrayOf<RegexPattern> RegexPatternArray;
typedef CIArrayOf<RegexNamed> RegexNamedArray;
typedef CopyCIArrayOf<RegexPattern> RegexPatternCopyArray;
typedef CICopyArrayOf<RegexPattern> RegexPatternCopyArray;


//Used for serialization:
Expand Down
4 changes: 2 additions & 2 deletions common/thorhelper/thorsoapcall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ int CWSCHelperThread::run()
{
if (master->aborted) {
while (inputRows.ordinality() > 0)
master->rowProvider->releaseRow(inputRows.pop());
master->rowProvider->releaseRow(inputRows.popGet());
return 0;
}
const void *r = master->rowProvider->getNextRow();
Expand All @@ -1247,7 +1247,7 @@ int CWSCHelperThread::run()
}

while (inputRows.ordinality() > 0)
master->rowProvider->releaseRow(inputRows.pop());
master->rowProvider->releaseRow(inputRows.popGet());
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/thorhelper/thorstep2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ So the latest approach is as follows:
occasionally skips a long way (e.g. state) it will get corrected/used.

*/
int compareInitialInputOrder(CInterface * * _left, CInterface * * _right)
int compareInitialInputOrder(CInterface * const * _left, CInterface * const * _right)
{
OrderedInput * left = static_cast<OrderedInput *>(*_left);
OrderedInput * right = static_cast<OrderedInput *>(*_right);
Expand Down
2 changes: 1 addition & 1 deletion common/thorhelper/thorstep2.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,6 @@ private:
};

void associateRemoteInputs(CIArrayOf<OrderedInput> & orderedInputs, unsigned numPriorityInputs);
int compareInitialInputOrder(CInterface * * _left, CInterface * * _right);
int compareInitialInputOrder(CInterface * const * _left, CInterface * const * _right);

#endif
2 changes: 1 addition & 1 deletion common/thorhelper/thortalgo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ StringBuffer & LRTable::trace(StringBuffer & out)
//---------------------------------------------------------------------------
//-- LRTableBuilder --

static int compareActions(CInterface * * _left, CInterface * * _right)
static int compareActions(CInterface * const * _left, CInterface * const * _right)
{
LRActionItem * left = static_cast<LRActionItem *>(*_left);
LRActionItem * right = static_cast<LRActionItem *>(*_right);
Expand Down
2 changes: 1 addition & 1 deletion common/thorhelper/thortparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ TomitaResultIterator::~TomitaResultIterator()
def->Release();
}

int compareStartPtr(CInterface * * pLeft, CInterface * * pRight)
int compareStartPtr(CInterface * const * pLeft, CInterface * const * pRight)
{
//try and make it different to improve sort performance, and so results are reproducible between windows and linux, but it can't be guaranteed.
GrammarSymbol * left = static_cast<GrammarSymbol *>(*pLeft);
Expand Down
4 changes: 2 additions & 2 deletions common/thorhelper/thorxmlread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,7 @@ class CXMLParse : public CInterface, implements IXMLParse
{
CXPath xpath;
IXMLSelect *iXMLSelect; // NOTE - not linked - creates circular links
CopyCIArrayOf<CParseStackInfo> stack, freeParseInfo;
CICopyArrayOf<CParseStackInfo> stack, freeParseInfo;
IPTreeMaker *maker;
Linked<CMarkReadBase> marking;
Owned<COffsetNodeCreator> nodeCreator;
Expand Down Expand Up @@ -1679,7 +1679,7 @@ class CXMLParse : public CInterface, implements IXMLParse
CParseStackInfo *stackInfo;
if (freeParseInfo.ordinality())
{
stackInfo = &freeParseInfo.pop();
stackInfo = &freeParseInfo.popGet();
stackInfo->reset();
}
else
Expand Down
2 changes: 1 addition & 1 deletion common/workunit/pkgimpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ class CPackageMapOf : public CInterface, implements IHpccPackageMap
StringArray libnames, unresolvedLibs;
gatherLibraryNames(libnames, unresolvedLibs, *wufactory, *cw, qs);

PointerIArrayOf<IHpccPackage> libraries;
IPointerArrayOf<IHpccPackage> libraries;
ForEachItemIn(libitem, libnames)
{
const char *libname = libnames.item(libitem);
Expand Down
4 changes: 2 additions & 2 deletions common/workunit/workflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,8 +945,8 @@ void WorkflowMachine::performItem(unsigned wfid, unsigned scheduledWfid)
currentWfid = wfid;
currentScheduledWfid = scheduledWfid;
process->perform(ctx, wfid);
scheduledWfid = wfidStack.pop();
currentWfid = wfidStack.pop();
scheduledWfid = wfidStack.popGet();
currentWfid = wfidStack.popGet();
if(currentWfid)
{
#ifdef TRACE_WORKFLOW
Expand Down
4 changes: 2 additions & 2 deletions common/workunit/workunit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4907,7 +4907,7 @@ void CLocalWorkUnit::setSnapshot(const char * val)
p->setProp("SNAPSHOT", val);
}

static int comparePropTrees(IInterface **ll, IInterface **rr)
static int comparePropTrees(IInterface * const *ll, IInterface * const *rr)
{
IPropertyTree *l = (IPropertyTree *) *ll;
IPropertyTree *r = (IPropertyTree *) *rr;
Expand Down Expand Up @@ -5940,7 +5940,7 @@ IWURoxieQueryInfo* CLocalWorkUnit::updateRoxieQueryInfo(const char *wuid, const
return roxieQueryInfo.getLink();
}

static int compareResults(IInterface **ll, IInterface **rr)
static int compareResults(IInterface * const *ll, IInterface * const *rr)
{
CLocalWUResult *l = (CLocalWUResult *) *ll;
CLocalWUResult *r = (CLocalWUResult *) *rr;
Expand Down
2 changes: 1 addition & 1 deletion dali/base/daaudit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class CDaliAuditServer: public IDaliServer, public Thread
CriticalSection handlemessagesect;
StringAttr auditdir;

static int compfile(IInterface **v1, IInterface **v2) // for bAdd only
static int compfile(IInterface * const *v1, IInterface * const *v2) // for bAdd only
{
IFile *e1 = (IFile *)*v1;
IFile *e2 = (IFile *)*v2;
Expand Down
6 changes: 3 additions & 3 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9287,7 +9287,7 @@ class CInitGroups
}
// add remaining
ForEachItemIn(e, *eps) {
SocketEndpoint &ep = eps->item(e);
const SocketEndpoint &ep = eps->item(e);
StringBuffer ipStr;
ep.getIpText(ipStr);
IPropertyTree *node = createPTree();
Expand All @@ -9306,7 +9306,7 @@ class CInitGroups
IPropertyTree *existing = root->queryPropTree(xpath.str());
if (existing) {
ForEachItemIn(e, *eps) {
SocketEndpoint &ep = eps->item(e);
const SocketEndpoint &ep = eps->item(e);
StringBuffer ipStr;
ep.getIpText(ipStr);
VStringBuffer xpath("Node[@ip=\"%s\"]", ipStr.str());
Expand Down Expand Up @@ -11646,7 +11646,7 @@ bool CDistributedFileDirectory::publishMetaFileXML(const CDfsLogicalFileName &lo
void Do(unsigned i)
{
UnsignedArray parts;
SocketEndpoint &ep = ips.item(i);
const SocketEndpoint &ep = ips.item(i);
if (ep.isNull())
return;
ForEachItemIn(j,ips) {
Expand Down
Loading

0 comments on commit 20c8c68

Please sign in to comment.