// // compute topological order for types; this functions assumes that // there are no cycles and that the typeOrder map is initialized to -1 // for all class types // static int computeOrder(AggregateType* ct) { if (typeOrder.get(ct) != -1) return typeOrder.get(ct); typeOrder.put(ct, -2); int order = 0; for_fields(field, ct) { if (AggregateType* fct = toAggregateType(field->type)) { int fieldOrder = computeOrder(fct); if (fieldOrder >= order) order = fieldOrder+1; } } typeOrder.put(ct, order); return order; }
// Processes the next frame interval's worth of media for the flow graph. // For now, this method always returns success. OsStatus MpFlowGraphBase::processNextFrame(void) { UtlBoolean boolRes; int i; OsStatus res; // Call processMessages() to handle any messages that have been posted // to either resources in the flow graph or to the flow graph itself. res = processMessages(); assert(res == OS_SUCCESS); // If resources or links have been added/removed from the flow graph, // then we need to recompute the execution order for resources in the // flow graph. This is done to ensure that resources producing output // buffers are executed before other resources in the flow graph that // expect to consume those buffers. if (mRecomputeOrder) { res = computeOrder(); assert(res == OS_SUCCESS); } // If the flow graph is "STOPPED" then there is no further processing // required for this frame interval. However, if the flow graph is // "STARTED", we invoke the processFrame() method for each of the // resources in the flow graph. if (getState() == STARTED) { for (i=0; i < mResourceCnt; i++) { mpResourceInProcess = mExecOrder[i]; boolRes = mExecOrder[i]->processFrame(); if (!boolRes) { osPrintf("MpMedia: called %s, which indicated failure\n", mpResourceInProcess->mName.data()); } } } mpResourceInProcess = NULL; mPeriodCnt++; return OS_SUCCESS; }
void FPPLayout::doCall( const Graph &G, adjEntry adjExternal, GridLayout &gridLayout, IPoint &boundingBox, bool fixEmbedding) { // check for double edges & self loops OGDF_ASSERT(isSimple(G)); // handle special case of graphs with less than 3 nodes if (G.numberOfNodes() < 3) { node v1, v2; switch (G.numberOfNodes()) { case 0: boundingBox = IPoint(0, 0); return; case 1: v1 = G.firstNode(); gridLayout.x(v1) = gridLayout.y(v1) = 0; boundingBox = IPoint(0, 0); return; case 2: v1 = G.firstNode(); v2 = G.lastNode(); gridLayout.x(v1) = gridLayout.y(v1) = gridLayout.y(v2) = 0; gridLayout.x(v2) = 1; boundingBox = IPoint(1, 0); return; } } // make a copy for triangulation GraphCopy GC(G); // embed if (!fixEmbedding) { if (planarEmbed(GC) == false) { OGDF_THROW_PARAM(PreconditionViolatedException, pvcPlanar); } } triangulate(GC); // get edges for outer face (triangle) adjEntry e_12; if (adjExternal != 0) { edge eG = adjExternal->theEdge(); edge eGC = GC.copy(eG); e_12 = (adjExternal == eG->adjSource()) ? eGC->adjSource() : eGC->adjTarget(); } else { e_12 = GC.firstEdge()->adjSource(); } adjEntry e_2n = e_12->faceCycleSucc(); NodeArray<int> num(GC); NodeArray<adjEntry> e_wp(GC); // List of predecessors on circle C_k NodeArray<adjEntry> e_wq(GC); // List of successors on circle C_k computeOrder(GC, num , e_wp, e_wq, e_12, e_2n, e_2n->faceCycleSucc()); computeCoordinates(GC, boundingBox, gridLayout, num, e_wp, e_wq); }