FSU* insertSubjectName(FSU *head, char* name) { FIM* im; FSU* su; int si; /* Subject index of name to insert */ si = idFromName(name); /* First initial case, linked list of subjects is empty */ if (head == NULL) { /* printf("\n Adding %s, id %d, as first subject in linked list \n", name, si); */ im = makeFIM(name); su = makeFSU(si); su->images = im; return su; } /* Special case that current subject id is less than head of list */ if (head->id > si) { /* printf("Special Case: Current Subject id is less than head of list, adding %s, id %d to head. \n", name, si ); */ im = makeFIM(name); su = makeFSU(si); su->images = im; su->next = head; return su; } /* Special case that current subject id is equal to the head of the list */ if (head->id == si) { /* printf("Another image %s for subject id %d. \n", name, si); */ appendImage(head->images, makeFIM(name)); return head; } /* List is not empty, and current is not going to become the head */ insertSubjectNameRecurse(head, head->next, si, name); return head; }
bool childIsInTheSplit(const tree::nodeP & myNode, const split& mySplit, const map<string, int> & nameIdMap) { if (myNode->isInternal()) return childIsInTheSplit(myNode->getSon(0),mySplit,nameIdMap); else {// we are in a leaf return (mySplit.isMember(idFromName(myNode->name(),nameIdMap))); } }
inline int signalId(const std::string &signature) const { // Search id from signature int id = idFromName(_objectNameToIdx, signature, MetaObjectType_Signal); if (id == -1) { // if the name is a name and not a signature search directly inside the signal map for (const auto& ms : _events) if (ms.second.name() == signature) return ms.first; } return id; }
FIM* makeFIM(char* name) { char* tt; FIM* im; im = (FIM*) malloc(sizeof(FIM)); assert(im); tt = (char*) malloc(sizeof(char) * MAX_FSTRLEN); assert(tt); strcpy(tt, name); im->name = tt; im->subject = idFromName(name); im->next = NULL; return im; }
// returns true if all the sons of myNode are in the split. // return false if all the sons of myNode are NOT in the split // if some of the sons are in and some are not - set foundTheNodeAlready to true. // and set splitNode to be that node. static bool findNodeToSplitRecursive( const tree::nodeP myNode, const split& mySplit, tree::nodeP& splitNode, bool & foundTheNodeAlready, const map<string, int> & nameIdMap) { if (myNode->isLeaf()) return (mySplit.isMember(idFromName(myNode->name(),nameIdMap))); bool inSplit = findNodeToSplitRecursive(myNode->getSon(0),mySplit,splitNode,foundTheNodeAlready,nameIdMap); if (foundTheNodeAlready) return true; for (int i=1; i < myNode->getNumberOfSons(); ++i) { bool tmp = findNodeToSplitRecursive(myNode->getSon(i),mySplit,splitNode,foundTheNodeAlready,nameIdMap); if (foundTheNodeAlready) return true; if (tmp != inSplit) { foundTheNodeAlready = true; splitNode = myNode; return true; } } return inSplit; }
inline int propertyId(const std::string &signature) const { return idFromName(_objectNameToIdx, signature, MetaObjectType_Property); }
inline int methodId(const std::string &signature) const { return idFromName(_objectNameToIdx, signature, MetaObjectType_Method); }