3a7264f9a458e02a5e28a048151f14034fbe0d3d tdreszer Thu Oct 17 17:46:17 2013 -0700 Speeding up trix file generation by using the mdb and cv lib code. Redmine #11951 diff --git src/hg/inc/mdb.h src/hg/inc/mdb.h index a6836ec..e431fb4 100644 --- src/hg/inc/mdb.h +++ src/hg/inc/mdb.h @@ -310,30 +310,42 @@ // mdbObjs list will be reordered. Sort fails when vars are missing in objs. char *mdbObjVarValPairsAsLine(struct mdbObj *mdbObj,boolean objTypeExclude,boolean cvLabels); // returns NULL or a line for a single mdbObj as "var1=val1; var2=val2 ...". Must be freed. void mdbByVarPrint(struct mdbByVar *mdbByVars,boolean raStyle); // prints var=val pairs and objs that go with them single lines or ra style int mdbObjCount(struct mdbObj *mdbObjs, boolean objs); // returns the count of vars belonging to this obj or objs; int mdbByVarCount(struct mdbByVar *mdbByVars,boolean vars, boolean vals); // returns the count of objs belonging to this set of vars; // ----------------- Utilities ----------------- +struct hash *mdbObjsHash(struct mdbObj *mdbObjs); +// Returns a hash object for this set of mdbObjs, keyed on the obj. +// WARNING: any changes to the members of the mdbObjs list may lead to invalid pointers in the hash + +struct mdbObj *mdbObjLookUp(struct hash *mdbObjsHash, char *obj); +// Returns an mdbObj from the objsHash +// WARNING: any changes to the members of the mdbObjs list used to make the mdbObjsHash +// may lead to invalid pointers in the hash + +void mdbObjsHashFree(struct hash **pMdbObjsHash); +// Frees an mdbObjs hash. + struct mdbVar *mdbObjFind(struct mdbObj *mdbObj, char *var); // Finds the val associated with the var or retruns NULL char *mdbObjFindValue(struct mdbObj *mdbObj, char *var); // Finds the val associated with the var or retruns NULL struct slName *mdbObjsFindAllVals(struct mdbObj *mdbObjs, char *var, char *emptyToken); // Returns a list of all vals in mdbObjs for a requested var // Will add empty only if there is atleast one empty val and at least one val found boolean mdbObjContains(struct mdbObj *mdbObj, char *var, char *val); // Returns TRUE if object contains var, val or both boolean mdbObjsContainAltleastOneMatchingVar(struct mdbObj *mdbObjs, char *var, char *val); // Returns TRUE if any object in set contains var