/* compare the supplied system to the given point * this is used to identify focus for reports * if !PointValid will report TRUE for all systems */ boolean CompareSystemPoint(SystemData *systemp, Point *point) { if (!PointValid(point)) return TRUE; switch (point->Type) { case POINT_TYPE_NONE: return FALSE; case POINT_TYPE_PORT: return (systemp == point->u.portp->nodep->systemp); case POINT_TYPE_PORT_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u.portList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { PortData *portp = (PortData*)ListObj(i); if (systemp == portp->nodep->systemp) return TRUE; } } return FALSE; case POINT_TYPE_NODE: return (systemp == point->u.nodep->systemp); case POINT_TYPE_NODE_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u.nodeList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { NodeData *nodep = (NodeData*)ListObj(i); if (systemp == nodep->systemp) return TRUE; } } return FALSE; #if !defined(VXWORKS) || defined(BUILD_DMC) case POINT_TYPE_IOC: return (systemp == point->u.iocp->ioup->nodep->systemp); case POINT_TYPE_IOC_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u.nodeList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { IocData *iocp = (IocData*)ListObj(i); if (systemp == iocp->ioup->nodep->systemp) return TRUE; } } return FALSE; #endif case POINT_TYPE_SYSTEM: return (systemp == point->u.systemp); } return TRUE; // should not get here }
/* On failure will Destroy the whole dest point leaving it !PointValid */ FSTATUS PointElinkCopy(Point *dest, Point *src) { FSTATUS status; LIST_ITERATOR i; DLIST *pSrcList; PointElinkDestroy(dest); pSrcList = NULL; switch (src->ElinkType) { case POINT_ELINK_TYPE_NONE: case POINT_ELINK_TYPE_LINK: *dest = *src; break; case POINT_ELINK_TYPE_LINK_LIST: pSrcList = &src->u4.elinkList; break; } if (pSrcList) { for (i=ListHead(pSrcList); i != NULL; i = ListNext(pSrcList, i)) { /* on failure Append will Destroy the whole point */ status = PointElinkListAppend(dest, src->ElinkType, ListObj(i)); if (FSUCCESS != status) return status; } } return FSUCCESS; }
bool EScene::ContainsObject( CCustomObject* object, ObjClassID classfilter ) { VERIFY( object ); VERIFY( m_Valid ); ObjectList& lst = ListObj(classfilter); ObjectIt it = std::find(lst.begin(), lst.end(), object); if (it!=lst.end()) return true; return false; }
/* On failure will Destroy the whole dest point leaving it !PointValid */ FSTATUS PointFabricCopy(Point *dest, Point *src) { FSTATUS status; LIST_ITERATOR i; DLIST *pSrcList; PointFabricDestroy(dest); pSrcList = NULL; switch (src->Type) { case POINT_TYPE_PORT: case POINT_TYPE_NODE: #if !defined(VXWORKS) || defined(BUILD_DMC) case POINT_TYPE_IOC: #endif case POINT_TYPE_SYSTEM: default: *dest = *src; break; case POINT_TYPE_PORT_LIST: pSrcList = &src->u.portList; break; case POINT_TYPE_NODE_LIST: pSrcList = &src->u.nodeList; break; #if !defined(VXWORKS) || defined(BUILD_DMC) case POINT_TYPE_IOC_LIST: pSrcList = &src->u.iocList; break; #endif } if (pSrcList) { for (i=ListHead(pSrcList); i != NULL; i = ListNext(pSrcList, i)) { /* on failure Append will Destroy the whole point */ status = PointListAppend(dest, src->Type, ListObj(i)); if (FSUCCESS != status) return status; } } return FSUCCESS; }
/* compare the supplied ioc to the given point * this is used to identify focus for reports * if !PointValid will report TRUE for all iocs */ boolean CompareIocPoint(IocData *iocp, Point *point) { if (!PointValid(point)) return TRUE; switch (point->Type) { case POINT_TYPE_IOC: return (iocp == point->u.iocp); case POINT_TYPE_IOC_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u.nodeList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { IocData *iocp2 = (IocData*)ListObj(i); if (iocp == iocp2) return TRUE; } } return FALSE; default: return CompareNodePoint(iocp->ioup->nodep, point); } }
/* If possible compress a point into a simpler format * This looks for lists which consist of a single entry */ void PointElinkCompress(Point *point) { switch (point->ElinkType) { case POINT_ELINK_TYPE_NONE: break; case POINT_ELINK_TYPE_LINK: break; case POINT_ELINK_TYPE_LINK_LIST: { ASSERT(ListCount(&point->u4.elinkList) >= 1); if (ListCount(&point->u4.elinkList) == 1) { /* degenerate case, simplify as a single ExpectedLink */ LIST_ITERATOR head = ListHead(&point->u4.elinkList); ExpectedLink *elinkp; ASSERT(head); elinkp = (ExpectedLink*)ListObj(head); PointElinkDestroy(point); PointInitElinkSimple(point, POINT_ELINK_TYPE_LINK, elinkp); } break; } } }
/* If possible compress a point into a simpler format * This looks for lists which consist of a single entry */ void PointEsmCompress(Point *point) { switch (point->EsmType) { case POINT_ESM_TYPE_NONE: break; case POINT_ESM_TYPE_SM: break; case POINT_ESM_TYPE_SM_LIST: { ASSERT(ListCount(&point->u3.esmList) >= 1); if (ListCount(&point->u3.esmList) == 1) { /* degenerate case, simplify as a single ExpectedSM */ LIST_ITERATOR head = ListHead(&point->u3.esmList); ExpectedSM *esmp; ASSERT(head); esmp = (ExpectedSM*)ListObj(head); PointEsmDestroy(point); PointInitEsmSimple(point, POINT_ESM_TYPE_SM, esmp); } break; } } }
/* If possible compress a point into a simpler format * This looks for lists which consist of a single entry */ void PointEnodeCompress(Point *point) { switch (point->EnodeType) { case POINT_ENODE_TYPE_NONE: break; case POINT_ENODE_TYPE_NODE: break; case POINT_ENODE_TYPE_NODE_LIST: { ASSERT(ListCount(&point->u2.enodeList) >= 1); if (ListCount(&point->u2.enodeList) == 1) { /* degenerate case, simplify as a single ExpectedNode */ LIST_ITERATOR head = ListHead(&point->u2.enodeList); ExpectedNode *enodep; ASSERT(head); enodep = (ExpectedNode*)ListObj(head); PointEnodeDestroy(point); PointInitEnodeSimple(point, POINT_ENODE_TYPE_NODE, enodep); } break; } } }
/* compare the supplied ExpectedLink to the given point * this is used to identify focus for reports * if !PointValid will report TRUE for all ExpectedLink */ boolean CompareExpectedLinkPoint(ExpectedLink *elinkp, Point *point) { if (!PointValid(point)) return TRUE; switch (point->ElinkType) { case POINT_ELINK_TYPE_NONE: return FALSE; case POINT_ELINK_TYPE_LINK: return (elinkp == point->u4.elinkp); case POINT_ELINK_TYPE_LINK_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u4.elinkList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { ExpectedLink *elinkp2 = (ExpectedLink*)ListObj(i); if (elinkp == elinkp2) return TRUE; } } return FALSE; } return TRUE; // should not get here }
/* compare the supplied ExpectedSM to the given point * this is used to identify focus for reports * if !PointValid will report TRUE for all ExpectedSM */ boolean CompareExpectedSMPoint(ExpectedSM *esmp, Point *point) { if (!PointValid(point)) return TRUE; switch (point->EsmType) { case POINT_ESM_TYPE_NONE: return FALSE; case POINT_ESM_TYPE_SM: return (esmp == point->u3.esmp); case POINT_ESM_TYPE_SM_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u3.esmList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { ExpectedSM *esmp2 = (ExpectedSM*)ListObj(i); if (esmp == esmp2) return TRUE; } } return FALSE; } return TRUE; // should not get here }
/* compare the supplied ExpectedNode to the given point * this is used to identify focus for reports * if !PointValid will report TRUE for all ExpectedNodes */ boolean CompareExpectedNodePoint(ExpectedNode *enodep, Point *point) { if (!PointValid(point)) return TRUE; switch (point->EnodeType) { case POINT_ENODE_TYPE_NONE: return FALSE; case POINT_ENODE_TYPE_NODE: return (enodep == point->u2.enodep); case POINT_ENODE_TYPE_NODE_LIST: { LIST_ITERATOR i; DLIST *pList = &point->u2.enodeList; for (i=ListHead(pList); i != NULL; i = ListNext(pList, i)) { ExpectedNode *enodep2 = (ExpectedNode*)ListObj(i); if (enodep == enodep2) return TRUE; } } return FALSE; } return TRUE; // should not get here }
/* If possible compress a point into a simpler format * This looks for lists which consist of a single entry or * lists which include all the components of a higher level type */ void PointFabricCompress(Point *point) { switch (point->Type) { case POINT_TYPE_NONE: break; case POINT_TYPE_PORT: break; case POINT_TYPE_PORT_LIST: { PortData *portp; LIST_ITERATOR head = ListHead(&point->u.portList); ASSERT(head); ASSERT(ListCount(&point->u.portList) >= 1); portp = (PortData*)ListObj(head); if (ListCount(&point->u.portList) == 1) { /* degenerate case, simplify as a single port */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_PORT, portp); } else if (ListCount(&point->u.portList) == cl_qmap_count(&portp->nodep->Ports)) { /* maybe we can consolidate to a single node */ LIST_ITERATOR i; DLIST *pList = &point->u.portList; for (i=ListHead(pList); portp && i != NULL; i = ListNext(pList, i)) { if (portp->nodep != ((PortData*)ListObj(i))->nodep) portp = NULL; /* not in same node, flag for below */ } if (portp) { /* degenerate case, simplify as a single node */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_NODE, portp->nodep); } #if 0 } else { // the likelihood of this is low for port oriented searches // and it would present just the system image guide in the summary // and may be less obvious to the user than a list of ports /* maybe we can consolidate to a single system */ LIST_ITERATOR i; DLIST *pList = &point->u.portList; for (i=ListHead(pList); portp && i != NULL; i = ListNext(pList, i)) { if (portp->nodep->systemp != ((PortData*)ListObj(i))->nodep->systemp) portp = NULL; /* not in same system, flag for below */ } if (portp) { /* all ports are in same system. is it a complete list? */ /* count ports in the system */ uint32 count = 0; cl_map_item_t *p; for (p=cl_qmap_head(&portp->nodep->systemp->Nodes); p != cl_qmap_end(&portp->nodep->systemp->Nodes); p = cl_qmap_next(p)) { NodeData *nodep = PARENT_STRUCT(p, NodeData, SystemNodesEntry); count += cl_qmap_count(&nodep->Ports); } if (ListCount(&point->u.portList) != count) portp = NULL; /* incomplete list, flag for below */ } if (portp) { /* degenerate case, simplify as a single system */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_SYSTEM, portp->nodep->systemp); } #endif } break; } case POINT_TYPE_NODE: break; case POINT_TYPE_NODE_LIST: { NodeData *nodep; LIST_ITERATOR head = ListHead(&point->u.nodeList); ASSERT(head); ASSERT(ListCount(&point->u.nodeList) >= 1); nodep = (NodeData*)ListObj(head); if (ListCount(&point->u.nodeList) == 1) { /* degenerate case, simplify as a single node */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_NODE, nodep); } else if (ListCount(&point->u.nodeList) == cl_qmap_count(&nodep->systemp->Nodes)) { /* maybe we can consolidate to a single system */ LIST_ITERATOR i; DLIST *pList = &point->u.nodeList; for (i=ListHead(pList); nodep && i != NULL; i = ListNext(pList, i)) { if (nodep->systemp != ((NodeData*)ListObj(i))->systemp) nodep = NULL; /* not in same system, flag for below */ } if (nodep) { /* degenerate case, simplify as a single system */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_SYSTEM, nodep->systemp); } } break; } #if !defined(VXWORKS) || defined(BUILD_DMC) case POINT_TYPE_IOC: break; case POINT_TYPE_IOC_LIST: { IocData *iocp; LIST_ITERATOR head = ListHead(&point->u.iocList); ASSERT(head); ASSERT(ListCount(&point->u.iocList) >= 1); iocp = (IocData*)ListObj(head); if (ListCount(&point->u.iocList) == 1) { /* degenerate case, simplify as a single IOC */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_IOC, iocp); } else if (ListCount(&point->u.iocList) == QListCount(&iocp->ioup->Iocs)) { /* maybe we can consolidate to a single node */ LIST_ITERATOR i; DLIST *pList = &point->u.iocList; for (i=ListHead(pList); iocp && i != NULL; i = ListNext(pList, i)) { if (iocp->ioup != ((IocData*)ListObj(i))->ioup) iocp = NULL; /* not in same iou, flag for below */ } if (iocp) { /* degenerate case, simplify as a single node */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_NODE, iocp->ioup->nodep); } #if 0 } else { // the likelihood of this is low for ioc oriented searches // and it would present just the system image guide in the summary // and may be less obvious to the user than a list of iocs /* maybe we can consolidate to a single system */ LIST_ITERATOR i; DLIST *pList = &point->u.iocList; for (i=ListHead(pList); iocp && i != NULL; i = ListNext(pList, i)) { if (iocp->ioup->nodep->systemp != ((IocData*)ListObj(i))->ioup->nodep->systemp) iocp = NULL; /* not in same system, flag for below */ } if (iocp) { /* all IOCs are in same system. is it a complete list? */ /* count IOCs in the system */ uint32 count = 0; cl_map_item_t *p; for (p=cl_qmap_head(&iocp->ioup->nodep->systemp->Nodes); p != cl_qmap_end(&iocp->ioup->nodep->systemp->Nodes); p = cl_qmap_next(p)) { NodeData *nodep = PARENT_STRUCT(p, NodeData, SystemNodesEntry); if (nodep->ioup) count += QListCount(&nodep->ioup->Iocs); } if (ListCount(&point->u.iocList) != count) iocp = NULL; /* incomplete list, flag for below */ } if (iocp) { /* degenerate case, simplify as a single system */ PointFabricDestroy(point); PointInitSimple(point, POINT_TYPE_SYSTEM, iocp->ioup->nodep->systemp); } #endif } break; } #endif case POINT_TYPE_SYSTEM: break; } }