void PerlIndicationProviderProxy::activateFilter( const ProviderEnvironmentIFCRef& env, const WQLSelectStatement& filter, const String& eventType, const String& nameSpace, const StringArray& classes) { bool firstActivation = (m_activationCount++ == 0); OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "activateFilter"); if (m_ftable->fp_activateFilter != NULL) { OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "activateFilter2"); ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext}; NPIHandleFreer nhf(_npiHandle); ProviderEnvironmentIFCRef env2(env); _npiHandle.thisObject = static_cast<void *>(&env2); //WQLSelectStatement mutableFilter(filter); //CIMObjectPath mutablePath(classes[0], nameSpace); //SelectExp exp = {&mutableFilter}; //::CIMObjectPath cop = {&mutablePath}; SelectExp exp; ::CIMObjectPath cop; m_ftable->fp_activateFilter( &_npiHandle, exp, eventType.c_str(), cop, firstActivation); if (_npiHandle.errorOccurred) { OW_THROWCIMMSG(CIMException::FAILED, _npiHandle.providerError); } } }
void runProblemSet2(char *problems, int multiplier) { Map *map = new Map(gDefaultMap); map->Scale(512, 512); msa = new MapSectorAbstraction(map, 8, multiplier); Graph *g = msa->GetAbstractGraph(1); GraphAbstractionHeuristic gah1(msa, 1); GraphDistanceHeuristic localGDH(g); localGDH.SetPlacement(kAvoidPlacement); for (unsigned int x = 0; x < 10; x++) localGDH.AddHeuristic(); GraphHeuristicContainer ghc(g); GraphRefinementEnvironment env1(msa, 1, &localGDH); GraphRefinementEnvironment env2(msa, 1, 0); // ghc.AddHeuristic(&localGDH); // ghc.AddHeuristic(&gah1); env1.SetDirected(false); FILE *f = fopen(problems, "r"); if (f == 0) { printf("Cannot open file: '%s'\n", problems); exit(0); } Timer t; printf("len\tnodes\ttoucht\tlen\ttime\tdiff_n\tdiff_t\tdiff_l\ttime\n"); while (!feof(f)) { int from, to, cost; if (fscanf(f, "%d\t%d\t%d\n", &from, &to, &cost) != 3) break; node *s1 = g->GetNode(from); node *g1 = g->GetNode(to); graphState gs, gg; gs = s1->GetNum(); gg = g1->GetNum(); std::vector<graphState> thePath; t.StartTimer(); astar.GetPath(&env2, gs, gg, thePath); t.EndTimer(); printf("%d\t", cost); printf("%llu\t%llu\t%1.2f\t%e\t", astar.GetNodesExpanded(), astar.GetNodesTouched(), env1.GetPathLength(thePath), t.GetElapsedTime()); t.StartTimer(); astar.GetPath(&env1, gs, gg, thePath); t.EndTimer(); printf("%llu\t%llu\t%1.2f\t%e", astar.GetNodesExpanded(), astar.GetNodesTouched(), env1.GetPathLength(thePath), t.GetElapsedTime()); printf("\n"); } fclose(f); exit(0); }
Envelope NetworkDetails::getEnvelope(ConstNetworkEdgePtr e) { auto_ptr<Envelope> env(e->getMembers()[0]->getEnvelope(_map)); for (int i = 1; i < e->getMembers().size(); ++i) { auto_ptr<Envelope> env2(e->getMembers()[i]->getEnvelope(_map)); env->expandToInclude(env2.get()); } return *env; }
bool CAI302Device::EnableBulkMode(OperationEnvironment &env) { /* this operation should not be cancellable, because we don't know what to do with a partial result */ NoCancelOperationEnvironment env2(env); return !config.UsesSpeed() || config.bulk_baud_rate == 0 || config.bulk_baud_rate == config.baud_rate || SetBaudRate(config.bulk_baud_rate, env2); }
bool CAI302Device::DisableBulkMode(OperationEnvironment &env) { /* even if the operation was cancelled, switch back to the normal baud rate safely */ NoCancelOperationEnvironment env2(env); return !config.UsesSpeed() || config.bulk_baud_rate == 0 || config.bulk_baud_rate == config.baud_rate || SetBaudRate(config.baud_rate, env2); }
void test_vector_ifft() { logMsg("playing IFFT crossfade..."); IFFT vox1, vox2; vox1.set_bin_mag_phase(2, 0.25, 0); vox1.set_bin_mag_phase(4, 0.25, 0); vox2.set_bin_mag_phase(6, 0.25, 0); vox2.set_bin_mag_phase(8, 0.25, 0); LineSegment env1(3, 1, 0); // fade out LineSegment env2(3, 0, 1); // fade in MulOp mul1(vox1, env1); MulOp mul2(vox2, env2); AddOp add3(mul1, mul2); run_test(add3); logMsg("IFFT crossfade done."); }
int PerlIndicationProviderProxy::mustPoll( const ProviderEnvironmentIFCRef& env, const WQLSelectStatement& filter, const String& eventType, const String& nameSpace, const StringArray& classes) { OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "mustPoll"); if (m_ftable->fp_mustPoll != NULL) { ::NPIHandle _npiHandle = { 0, 0, 0, 0, m_ftable->npicontext}; NPIHandleFreer nhf(_npiHandle); OW_LOG_DEBUG(env->getLogger(COMPONENT_NAME), "mustPoll2"); ProviderEnvironmentIFCRef env2(env); _npiHandle.thisObject = static_cast<void *>(&env2); //WQLSelectStatement mutableFilter(filter); //CIMObjectPath mutablePath(classes[0], nameSpace); //SelectExp exp = {&mutableFilter}; //::CIMObjectPath cop = {&mutablePath}; SelectExp exp; ::CIMObjectPath cop; int rval = m_ftable->fp_mustPoll( &_npiHandle, exp, eventType.c_str(), cop); if (_npiHandle.errorOccurred) { OW_THROWCIMMSG(CIMException::FAILED, _npiHandle.providerError); } // Perl providers only return 0 or 1 for mustPoll. // OpenWBEM expects mustPoll to return the polling interval, // so we'll return a reasonable polling interval (5 mins.) if (rval > 0) { return 5 * 60; } } return 0; }
void runProblemSet(char *problems, int multiplier) { Map *map = new Map(gDefaultMap); map->Scale(512, 512); msa = new MapSectorAbstraction(map, 8, multiplier); Graph *g = msa->GetAbstractGraph(1); GraphAbstractionHeuristic gah2(msa, 2); GraphAbstractionHeuristic gah1(msa, 1); GraphRefinementEnvironment env2(msa, 2, &gah2); GraphRefinementEnvironment env1(msa, 1, &gah1); env1.SetDirected(false); env2.SetDirected(false); FILE *f = fopen(problems, "r"); if (f == 0) { printf("Cannot open file: '%s'\n", problems); exit(0); } printf("len\tlvl2n\tlvl2nt\tlvl2len\tlvl2tim\tlvl1nf\tlvl1ntf\tlvl1tn\tlvl1tt\tlvl1len_f\ttot\ttott\ttot_len\n"); Timer t; while (!feof(f)) { int from, to, cost; if (fscanf(f, "%d\t%d\t%d\n", &from, &to, &cost) != 3) break; node *s1 = g->GetNode(from); node *g1 = g->GetNode(to); node *s2 = msa->GetParent(s1); node *g2 = msa->GetParent(g1); uint64_t nodesExpanded = 0; uint64_t nodesTouched = 0; double totalTime = 0; // printf("Searching from %d to %d in level 1; %d to %d in level 2\n", // s1->GetNum(), g1->GetNum(), s2->GetNum(), g2->GetNum()); graphState gs1, gs2; gs1 = s2->GetNum(); gs2 = g2->GetNum(); std::vector<graphState> thePath; std::vector<graphState> abstractPath; t.StartTimer(); astar.GetPath(&env2, gs1, gs2, abstractPath); totalTime = t.EndTimer(); printf("%d\t", cost); printf("%llu\t%llu\t%1.2f\t%f\t", astar.GetNodesExpanded(), astar.GetNodesTouched(), env2.GetPathLength(abstractPath), totalTime); if (abstractPath.size() == 0) { printf("%llu\t%llu\t%llu\t%llu\t%1.2f\t%f\t", (uint64_t)0, (uint64_t)0, astar.GetNodesExpanded(), astar.GetNodesTouched(), 0.0, 0.0); printf("%llu\t%llu\t%1.2f\t%f\t%d\t%d\n", astar.GetNodesExpanded(), astar.GetNodesTouched(), 0.0, 0.0, 0, 0); // printf("\n"); continue; } nodesExpanded += astar.GetNodesExpanded(); nodesTouched += astar.GetNodesTouched(); env1.SetPlanningCorridor(abstractPath, 2); gs1 = s1->GetNum(); gs2 = g1->GetNum(); t.StartTimer(); astar.GetPath(&env1, gs1, gs2, thePath); t.EndTimer(); printf("%llu\t%llu\t%llu\t%llu\t%1.2f\t%f\t", astar.GetNodesExpanded(), astar.GetNodesTouched(), astar.GetNodesExpanded()+nodesExpanded, astar.GetNodesTouched()+nodesTouched, env1.GetPathLength(thePath), totalTime+t.GetElapsedTime()); int abstractStart = 0; gs1 = s1->GetNum(); double totalLength = 0; int refineAmt = 2; int refinedPathNodes = 0; do { // not working yet -- fully check! env1.SetPlanningCorridor(abstractPath, 2, abstractStart); gs2 = g1->GetNum(); if (abstractPath.size()-abstractStart > refineAmt) { env1.SetUseAbstractGoal(true, 2); gs2 = abstractPath[abstractStart+refineAmt]; } else { env1.SetUseAbstractGoal(false, 0); } t.StartTimer(); astar.GetPath(&env1, gs1, gs2, thePath); t.EndTimer(); refinedPathNodes += thePath.size(); totalTime+=t.GetElapsedTime(); abstractStart += refineAmt; gs1 = thePath.back(); nodesExpanded += astar.GetNodesExpanded(); nodesTouched += astar.GetNodesTouched(); totalLength += env1.GetPathLength(thePath); if (thePath.back() == gs2) break; } while (thePath.back() != g1->GetNum()); // printf("%llu\t%llu\t%1.2f\t", astar.GetNodesExpanded(), astar.GetNodesTouched(), env1.GetPathLength(thePath)); thePath.resize(0); printf("%llu\t%llu\t%1.2f\t%f\t%d\t%d\n", nodesExpanded, nodesTouched, totalLength, totalTime, abstractPath.size(), refinedPathNodes); // gs1 = s1->GetNum(); // gs2 = g1->GetNum(); // env1.SetPlanningCorridor(abstractPath, 2); // astar.GetPath(&env1, gs1, gs2, thePath); // printf("%llu\t%1.2f\n", astar.GetNodesExpanded(), env1.GetPathLength(thePath)); } fclose(f); exit(0); }