int main() { std::thread t(daemon_sleep); t.detach(); assert(!t.joinable()); class_method(); return 0; }
RealPoint point = (structRealPoint *)my points -> item [i]; NUMscale (& point -> time, xminfrom, xmaxfrom, xminto, xmaxto); } } class_methods (RealTier, Function) { class_method_local (RealTier, destroy) class_method_local (RealTier, copy) class_method_local (RealTier, equal) class_method_local (RealTier, canWriteAsEncoding) class_method_local (RealTier, writeText) class_method_local (RealTier, readText) class_method_local (RealTier, writeBinary) class_method_local (RealTier, readBinary) class_method_local (RealTier, description) class_method (info) class_method (getNx) class_method (getX) class_method (getNcol) class_method (getVector) class_method (getFunction1) class_method (getUnitText) class_method (shiftX) class_method (scaleX) class_methods_end } void RealTier_init_e (I, double tmin, double tmax) { iam (RealTier); my xmin = tmin; my xmax = tmax;
AnyPoint point = (structAnyPoint *)my points -> item [i]; NUMscale (& point -> time, xminfrom, xmaxfrom, xminto, xmaxto); } } class_methods (AnyTier, Function) { class_method_local (AnyTier, destroy) class_method_local (AnyTier, copy) class_method_local (AnyTier, equal) class_method_local (AnyTier, canWriteAsEncoding) class_method_local (AnyTier, writeText) class_method_local (AnyTier, readText) class_method_local (AnyTier, writeBinary) class_method_local (AnyTier, readBinary) class_method_local (AnyTier, description) class_method (shiftX) class_method (scaleX) class_methods_end } long AnyTier_timeToLowIndex (I, double time) { iam (AnyTier); if (my points -> size == 0) return 0; // undefined long ileft = 1, iright = my points -> size; AnyPoint *points = (AnyPoint *) my points -> item; double tleft = points [ileft] -> time; if (time < tleft) return 0; // offleft double tright = points [iright] -> time; if (time >= tright) return iright; Melder_assert (time >= tleft && time < tright); Melder_assert (iright > ileft);
RealTier tier = (structRealTier *)my bandwidths -> item [i]; tier -> methods -> scaleX (tier, xminfrom, xmaxfrom, xminto, xmaxto); } } class_methods (FormantGrid, Function) { class_method_local (FormantGrid, destroy) class_method_local (FormantGrid, copy) class_method_local (FormantGrid, equal) class_method_local (FormantGrid, canWriteAsEncoding) class_method_local (FormantGrid, writeText) class_method_local (FormantGrid, readText) class_method_local (FormantGrid, writeBinary) class_method_local (FormantGrid, readBinary) class_method_local (FormantGrid, description) class_method (getVector) class_method (getFunction1) class_method (getUnitText) class_method (shiftX) class_method (scaleX) class_methods_end } int FormantGrid_init (I, double tmin, double tmax, long numberOfFormants) { iam (FormantGrid); my formants = Ordered_create (); cherror my bandwidths = Ordered_create (); cherror for (long iformant = 1; iformant <= numberOfFormants; iformant ++) { RealTier formant = RealTier_create (tmin, tmax); cherror Collection_addItem (my formants, formant); cherror RealTier bandwidth = RealTier_create (tmin, tmax); cherror
RecipeReader::RecipeReader(std::string filename) { XQilla xqilla; try{ AutoDelete<XQQuery> qinit(xqilla.parse(X("data(/cooker/init)"))); AutoDelete<DynamicContext> context (qinit->createDynamicContext()); Sequence seq = context->resolveDocument(X(filename.c_str())); if(!seq.isEmpty() && seq.first()->isNode()) { context->setContextItem(seq.first()); context->setContextPosition(1); context->setContextSize(1); } Result rinit=qinit->execute(context); InitXML=UTF8(rinit->next(context)->asString(context)); AutoDelete<XQQuery> qsrctree(xqilla.parse(X("data(/cooker/source)"))); Result rsrctree=qsrctree->execute(context); srctree=UTF8(rsrctree->next(context)->asString(context)); AutoDelete<XQQuery> qdsttree(xqilla.parse(X("data(/cooker/destination)"))); Result rdsttree=qdsttree->execute(context); dsttree=UTF8(rdsttree->next(context)->asString(context)); AutoDelete<XQQuery> qplugs(xqilla.parse(X("/cooker/plugins/plugin"))); Result rplugs=qplugs->execute(context); AutoDelete<XQQuery> qplname(xqilla.parse(X("data(./name)"))); AutoDelete<XQQuery> qplfile(xqilla.parse(X("data(./file)"))); AutoDelete<DynamicContext> context2 (qplname->createDynamicContext()); while(Node::Ptr item=rplugs->next(context)) { context2->setContextItem(item); context2->setContextPosition(1); context2->setContextSize(1); Result rname=qplname->execute(context2); Result rfile=qplfile->execute(context2); plugins[UTF8(rname->next(context2)->asString(context2))]=UTF8(rfile->next(context2)->asString(context2)); } AutoDelete<XQQuery> qdefineHistograms(xqilla.parse(X("/cooker/defineHistograms/*"))); Result rdefineHistograms=qdefineHistograms->execute(context); while(Node::Ptr item=rdefineHistograms->next(context)) { defineHistograms.push_back(class_method(UTF8(item->dmNodeName(context)->getName()), UTF8(item->dmStringValue(context)))); } AutoDelete<XQQuery> qstartup(xqilla.parse(X("/cooker/startup/*"))); Result rstartup=qstartup->execute(context); while(Node::Ptr item=rstartup->next(context)) { startup.push_back(class_method(UTF8(item->dmNodeName(context)->getName()), UTF8(item->dmStringValue(context)))); } AutoDelete<XQQuery> qexecute(xqilla.parse(X("/cooker/execute/*"))); Result rexecute=qexecute->execute(context); while(Node::Ptr item=rexecute->next(context)) { commands.push_back(class_method(UTF8(item->dmNodeName(context)->getName()), UTF8(item->dmStringValue(context)))); } AutoDelete<XQQuery> qfinalize(xqilla.parse(X("/cooker/finalize/*"))); Result rfinalize=qfinalize->execute(context); while(Node::Ptr item=rfinalize->next(context)) { finalize.push_back(class_method(UTF8(item->dmNodeName(context)->getName()), UTF8(item->dmStringValue(context)))); } } catch( XQException E) { std::cerr<<"Parsing of recipe XML failed, error type:"<<UTF8(E.getType())<<" Error:"<<UTF8(E.getError())<<std::endl; } }
iam (Sampled); inherited (Sampled) scaleX (me, xminfrom, xmaxfrom, xminto, xmaxto); NUMscale (& my x1, xminfrom, xmaxfrom, xminto, xmaxto); my dx *= (xmaxto - xminto) / (xmaxfrom - xminfrom); } class_methods (Sampled, Function) { class_method_local (Sampled, copy) class_method_local (Sampled, equal) class_method_local (Sampled, canWriteAsEncoding) class_method_local (Sampled, writeBinary) class_method_local (Sampled, readBinary) class_method_local (Sampled, writeText) class_method_local (Sampled, readText) class_method_local (Sampled, description) class_method (getNx) class_method (getDx) class_method (getX) class_method (getValueAtSample) class_method (shiftX) class_method (scaleX) class_methods_end } double Sampled_indexToX (I, long i) { iam (Sampled); return my x1 + (i - 1) * my dx; } double Sampled_xToIndex (I, double x) { iam (Sampled);