本文整理汇总了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.");
}
}
示例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;
}
示例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.");
}
}
示例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.");
}
}
示例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;
}
示例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());
}
}
示例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());
}
}
示例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
}
示例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.");
}
}
示例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.");
}
}
示例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.");
}
}
示例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.");
}
}
示例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.");
}
}
示例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.");
}
}
示例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.");
}
}