当前位置: 首页>>代码示例>>C++>>正文


C++ Collection_addItem函数代码示例

本文整理汇总了C++中Collection_addItem函数的典型用法代码示例。如果您正苦于以下问题:C++ Collection_addItem函数的具体用法?C++ Collection_addItem怎么用?C++ Collection_addItem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Collection_addItem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TextGrids_merge

TextGrid TextGrids_merge (TextGrid me, TextGrid thee) {
	try {
		int at_end = 0, at_start = 1;

		autoTextGrid g1 = Data_copy (me);
		autoTextGrid g2 = Data_copy (thee);

		// The new TextGrid will have the domain
		// [min(g1->xmin, g2->xmin), max(g1->xmax, g2->xmax)]

		double extra_time_end = fabs (g2 -> xmax - g1 -> xmax);
		double extra_time_start = fabs (g2 -> xmin - g1 -> xmin);

		if (g1 -> xmin > g2 -> xmin) {
			TextGrid_extendTime (g1.peek(), extra_time_start, at_start);
		}
		if (g1 -> xmax < g2 -> xmax) {
			TextGrid_extendTime (g1.peek(), extra_time_end, at_end);
		}
		if (g2 -> xmin > g1 -> xmin) {
			TextGrid_extendTime (g2.peek(), extra_time_start, at_start);
		}
		if (g2 -> xmax < g1 -> xmax) {
			TextGrid_extendTime (g2.peek(), extra_time_end, at_end);
		}

		for (long i = 1; i <= g2 -> tiers -> size; i++) {
			autoFunction tier = Data_copy ( (Function) g2 -> tiers -> item [i]);
			Collection_addItem (g1 -> tiers, tier.transfer());
		}
		return g1.transfer();
	} catch (MelderError) {
		Melder_throw (me, " & ", thee, ": not merged.");
	}
}
开发者ID:Crisil,项目名称:praat,代码行数:35,代码来源:TextGrid_extensions.cpp

示例2: FFNet_Activation_to_Categories

Categories FFNet_Activation_to_Categories (FFNet me, Activation activation, int labeling)
{
	Categories thee = NULL, categories = my outputCategories;
	long i, (*labelingFunction) (I, const double act[]);
	
	if (! my outputCategories)
	{
		(void) Melder_error1 (L"FFNet & Activation: To Categories\n");
		return Melder_errorp1 (L"The neural net has no Categories (has the FFNet been trained yet?).");
	}
	if (my nOutputs != activation->nx)
	{
		(void) Melder_error1 (L"FFNet & Activation: To Categories\n");
		return Melder_errorp1 (L"The number of columns in the Activation must equal the number of outputs of FFNet.");
	}
	thee = Categories_create ();
	if (thee == NULL) return NULL;
	labelingFunction = labeling == 2 ? stochastic : winnerTakesAll;
	for (i = 1; i <= activation->ny; i++)
	{
		long index = labelingFunction (me, activation->z[i]);
		Data item = Data_copy (categories->item[index]);
		if (item == NULL || ! Collection_addItem (thee, item)) 
		{
			forget (thee);
			return Melder_errorp3 (L"FFNet & Activation: To Categories\n\nError creating label ",
				Melder_integer (i), L".");
		}
	}
	return thee;
}
开发者ID:alekstorm,项目名称:tala,代码行数:31,代码来源:FFNet_Activation_Categories.c

示例3: AnyTier_addPoint

void AnyTier_addPoint (I, Daata point) {
	iam (AnyTier);
	try {
		Collection_addItem (my points, point);
	} catch (MelderError) {
		Melder_throw (me, U": point not added.");
	}
}
开发者ID:eginhard,项目名称:praat,代码行数:8,代码来源:AnyTier.cpp

示例4: RealTier_addPoint

void RealTier_addPoint (RealTier me, double t, double value) {
	try {
		autoRealPoint point = RealPoint_create (t, value);
		Collection_addItem (my points, point.transfer());
	} catch (MelderError) {
		Melder_throw (me, U": point not added.");
	}
}
开发者ID:eginhard,项目名称:praat,代码行数:8,代码来源:RealTier.cpp

示例5: RealTier_addPoint

int RealTier_addPoint (I, double t, double value) {
	iam (RealTier);
	RealPoint point = RealPoint_create (t, value); cherror
	Collection_addItem (my points, point); cherror
end:
	iferror return 0;
	return 1;
}
开发者ID:alekstorm,项目名称:tala,代码行数:8,代码来源:RealTier.cpp

示例6: OrderedOfString_sequentialNumbers

void OrderedOfString_sequentialNumbers (OrderedOfString me, long n) {
	Collection_removeAllItems (me);
	for (long i = 1; i <= n; i++) {
		char32 s[40];
		Melder_sprint (s,40, i);
		autoSimpleString str = SimpleString_create (s);
		Collection_addItem (me, str.transfer());
	}
}
开发者ID:eginhard,项目名称:praat,代码行数:9,代码来源:Collection_extensions.cpp

示例7: OrderedOfString_sequentialNumbers

void OrderedOfString_sequentialNumbers (I, long n) {
	iam (OrderedOfString);
	Collection_removeAllItems (me);
	for (long i = 1; i <= n; i++) {
		wchar_t s[20];
		swprintf (s, 20, L"%ld", i);
		autoSimpleString str = SimpleString_create (s);
		Collection_addItem (me, str.transfer());
	}
}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:10,代码来源:Collection_extensions.cpp

示例8: f_addOption

void structGuiOptionMenu:: f_addOption (const wchar_t *text) {
	#if gtk
		gtk_combo_box_append_text (GTK_COMBO_BOX (d_widget), Melder_peekWcsToUtf8 (text));
	#elif motif
		GuiMenuItem menuItem = Thing_new (GuiMenuItem);
		menuItem -> d_widget = XtVaCreateManagedWidget (Melder_peekWcsToUtf8 (text), xmToggleButtonWidgetClass, d_widget, NULL);
		XtAddCallback (menuItem -> d_widget, XmNvalueChangedCallback, cb_optionChanged, (XtPointer) this);
		Collection_addItem (d_options, menuItem);
	#endif
}
开发者ID:dellison,项目名称:APILPraat,代码行数:10,代码来源:GuiOptionMenu.cpp

示例9: ResultsMFC_to_Categories_responses

Categories ResultsMFC_to_Categories_responses (ResultsMFC me) {
	try {
		autoCategories thee = Categories_create ();
		for (long trial = 1; trial <= my numberOfTrials; trial ++) {
			autoSimpleString category = SimpleString_create (my result [trial]. response);
			Collection_addItem (thee.peek(), category.transfer());
		}
		return thee.transfer();
	} catch (MelderError) {
		Melder_throw (me, U": responses not converted to Categories.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:12,代码来源:ExperimentMFC.cpp

示例10: TextTier_setLaterEndTime

void TextTier_setLaterEndTime (TextTier me, double xmax, const char32 *mark) {
	try {
		if (xmax <= my xmax) return; // nothing to be done
		if (mark != NULL) {
			autoTextPoint textpoint = TextPoint_create (my xmax, mark);
			Collection_addItem (my points, textpoint.transfer());
		}
		my xmax = xmax;
	} catch (MelderError) {
		Melder_throw (U"Larger end time of TextTier not set.");
	}
}
开发者ID:davideberdin,项目名称:praat,代码行数:12,代码来源:TextGrid_extensions.cpp

示例11: OrderedOfString_append

int OrderedOfString_append (OrderedOfString me, char32 *append) {
	try {
		if (append == nullptr) {
			return 1;    // BUG: lege string appenden??
		}
		autoSimpleString item = SimpleString_create (append);
		Collection_addItem (me, item.transfer());
		return 1;
	} catch (MelderError) {
		Melder_throw (me, U": text not appended.");
	}
}
开发者ID:eginhard,项目名称:praat,代码行数:12,代码来源:Collection_extensions.cpp

示例12: Regression_addParameter

void Regression_addParameter (Regression me, const char32 *label, double minimum, double maximum, double value) {
	try {
		autoRegressionParameter thee = Thing_new (RegressionParameter);
		thy label = Melder_dup (label);
		thy minimum = minimum;
		thy maximum = maximum;
		thy value = value;
		Collection_addItem (my parameters, thee.transfer());
	} catch (MelderError) {
		Melder_throw (me, U": parameter not added.");
	}
}
开发者ID:eginhard,项目名称:praat,代码行数:12,代码来源:Regression.cpp

示例13: IntervalTiers_append_inline

// Precondition: if (preserveTimes) { my xmax <= thy xmin }
// Postcondition: my xmin preserved
void IntervalTiers_append_inline (IntervalTier me, IntervalTier thee, bool preserveTimes) {
	try {
        double xmax_previous = my xmax, time_shift = my xmax - thy xmin;
		if (preserveTimes && my xmax < thy xmin) {
			autoTextInterval connection = TextInterval_create (my xmax, thy xmin, L"");
            xmax_previous = thy xmin;
			Collection_addItem (my intervals, connection.transfer());
		}
		for (long iint = 1; iint <= thy intervals -> size; iint++) {
			autoTextInterval ti = (TextInterval) Data_copy ((Data) thy intervals -> item[iint]);
			if (not preserveTimes) {
				ti -> xmin = xmax_previous;
				xmax_previous = ti -> xmax += time_shift;
            }
			Collection_addItem (my intervals, ti.transfer());
		}
		my xmax = preserveTimes ? thy xmax : xmax_previous;
	} catch (MelderError) {
		Melder_throw ("IntervalTiers not appended.");
	}
}
开发者ID:georgiee,项目名称:lip-sync-lpc,代码行数:23,代码来源:TextGrid_extensions.cpp

示例14: TextTier_setEarlierStartTime

void TextTier_setEarlierStartTime (TextTier me, double xmin, const char32 *mark) {
	try {
		if (xmin >= my xmin) return; // nothing to be done
		if (mark != NULL) {
			autoTextPoint textpoint = TextPoint_create (my xmin, mark);
			Collection_addItem (my points, textpoint.transfer());
		}
		my xmin = xmin;
	} catch (MelderError) {
		Melder_throw (U"Earlier start time of TextTier not set.");
	}
}
开发者ID:davideberdin,项目名称:praat,代码行数:12,代码来源:TextGrid_extensions.cpp

示例15: CrossCorrelationTables_and_Diagonalizer_diagonalize

CrossCorrelationTables CrossCorrelationTables_and_Diagonalizer_diagonalize (CrossCorrelationTables me, Diagonalizer thee) {
	try {
		autoCrossCorrelationTables him = CrossCorrelationTables_create ();
		for (long i = 1; i <= my size; i++) {
			CrossCorrelationTable item = (CrossCorrelationTable) my item[i];
			autoCrossCorrelationTable ct = CrossCorrelationTable_and_Diagonalizer_diagonalize (item, thee);
			Collection_addItem (him.peek(), ct.transfer());
		}
		return him.transfer();
	} catch (MelderError) {
		Melder_throw (U"CrossCorrelationTables not diagonalized.");
	}
}
开发者ID:psibre,项目名称:praat,代码行数:13,代码来源:ICA.cpp


注:本文中的Collection_addItem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。