本文整理汇总了C++中CERTIFY函数的典型用法代码示例。如果您正苦于以下问题:C++ CERTIFY函数的具体用法?C++ CERTIFY怎么用?C++ CERTIFY使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CERTIFY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TermQuery_Dump_IMP
Obj*
TermQuery_Dump_IMP(TermQuery *self) {
TermQueryIVARS *ivars = TermQuery_IVARS(self);
TermQuery_Dump_t super_dump
= SUPER_METHOD_PTR(TERMQUERY, LUCY_TermQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
Hash_Store_Utf8(dump, "term", 4, Freezer_dump(ivars->term));
return (Obj*)dump;
}
示例2: PolyHLReader_init
PolyHighlightReader*
PolyHLReader_init(PolyHighlightReader *self, VArray *readers,
I32Array *offsets) {
HLReader_init((HighlightReader*)self, NULL, NULL, NULL, NULL, -1);
for (uint32_t i = 0, max = VA_Get_Size(readers); i < max; i++) {
CERTIFY(VA_Fetch(readers, i), HIGHLIGHTREADER);
}
self->readers = (VArray*)INCREF(readers);
self->offsets = (I32Array*)INCREF(offsets);
return self;
}
示例3: S_do_init
static PhraseQuery*
S_do_init(PhraseQuery *self, String *field, Vector *terms, float boost) {
Query_init((Query*)self, boost);
PhraseQueryIVARS *const ivars = PhraseQuery_IVARS(self);
for (uint32_t i = 0, max = Vec_Get_Size(terms); i < max; i++) {
CERTIFY(Vec_Fetch(terms, i), OBJ);
}
ivars->field = field;
ivars->terms = terms;
return self;
}
示例4: PolyDocReader_init
PolyDocReader*
PolyDocReader_init(PolyDocReader *self, Vector *readers, I32Array *offsets) {
DocReader_init((DocReader*)self, NULL, NULL, NULL, NULL, -1);
PolyDocReaderIVARS *const ivars = PolyDocReader_IVARS(self);
for (uint32_t i = 0, max = Vec_Get_Size(readers); i < max; i++) {
CERTIFY(Vec_Fetch(readers, i), DOCREADER);
}
ivars->readers = (Vector*)INCREF(readers);
ivars->offsets = (I32Array*)INCREF(offsets);
return self;
}
示例5: BBSortEx_feed
void
BBSortEx_feed(BBSortEx *self, void *data) {
SortEx_feed((SortExternal*)self, data);
// Flush() if necessary.
ByteBuf *bytebuf = (ByteBuf*)CERTIFY(*(ByteBuf**)data, BYTEBUF);
self->mem_consumed += BB_Get_Size(bytebuf);
if (self->mem_consumed >= self->mem_thresh) {
BBSortEx_Flush(self);
}
}
示例6: StrIter_Compare_To_IMP
int32_t
StrIter_Compare_To_IMP(StringIterator *self, Obj *other) {
StringIterator *twin = (StringIterator*)CERTIFY(other, STRINGITERATOR);
if (self->string != twin->string) {
THROW(ERR, "Can't compare iterators of different strings");
UNREACHABLE_RETURN(int32_t);
}
if (self->byte_offset < twin->byte_offset) { return -1; }
if (self->byte_offset > twin->byte_offset) { return 1; }
return 0;
}
示例7: PolyAnalyzer_Dump_IMP
Obj*
PolyAnalyzer_Dump_IMP(PolyAnalyzer *self) {
PolyAnalyzerIVARS *const ivars = PolyAnalyzer_IVARS(self);
PolyAnalyzer_Dump_t super_dump
= SUPER_METHOD_PTR(POLYANALYZER, LUCY_PolyAnalyzer_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
if (ivars->analyzers) {
Hash_Store_Utf8(dump, "analyzers", 9,
Freezer_dump((Obj*)ivars->analyzers));
}
return (Obj*)dump;
}
示例8: ProximityQuery_Dump_IMP
Obj*
ProximityQuery_Dump_IMP(ProximityQuery *self) {
ProximityQueryIVARS *ivars = ProximityQuery_IVARS(self);
ProximityQuery_Dump_t super_dump
= SUPER_METHOD_PTR(PROXIMITYQUERY, LUCY_ProximityQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
Hash_Store_Utf8(dump, "terms", 5, Freezer_dump((Obj*)ivars->terms));
Hash_Store_Utf8(dump, "within", 6,
(Obj*)Str_newf("%i64", (int64_t)ivars->within));
return (Obj*)dump;
}
示例9: S_do_init
static PhraseQuery*
S_do_init(PhraseQuery *self, CharBuf *field, VArray *terms, float boost)
{
uint32_t i, max;
Query_init((Query*)self, boost);
for (i = 0, max = VA_Get_Size(terms); i < max; i++) {
CERTIFY(VA_Fetch(terms, i), OBJ);
}
self->field = field;
self->terms = terms;
return self;
}
示例10: LeafQuery_Dump_IMP
Obj*
LeafQuery_Dump_IMP(LeafQuery *self) {
LeafQueryIVARS *ivars = LeafQuery_IVARS(self);
LeafQuery_Dump_t super_dump
= SUPER_METHOD_PTR(LEAFQUERY, LUCY_LeafQuery_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
if (ivars->field) {
Hash_Store_Utf8(dump, "field", 5, Freezer_dump((Obj*)ivars->field));
}
Hash_Store_Utf8(dump, "text", 4, Freezer_dump((Obj*)ivars->text));
return (Obj*)dump;
}
示例11: PolyHLReader_init
PolyHighlightReader*
PolyHLReader_init(PolyHighlightReader *self, Vector *readers,
I32Array *offsets) {
HLReader_init((HighlightReader*)self, NULL, NULL, NULL, NULL, -1);
PolyHighlightReaderIVARS *const ivars = PolyHLReader_IVARS(self);
for (size_t i = 0, max = Vec_Get_Size(readers); i < max; i++) {
CERTIFY(Vec_Fetch(readers, i), HIGHLIGHTREADER);
}
ivars->readers = (Vector*)INCREF(readers);
ivars->offsets = (I32Array*)INCREF(offsets);
return self;
}
示例12: S_add_string_field
static void
S_add_string_field(Schema *self, String *field, FieldType *type) {
SchemaIVARS *const ivars = Schema_IVARS(self);
StringType *string_type = (StringType*)CERTIFY(type, STRINGTYPE);
Similarity *sim = StringType_Make_Similarity(string_type);
// Cache helpers.
Hash_Store(ivars->sims, field, (Obj*)sim);
// Store FieldType.
Hash_Store(ivars->types, field, INCREF(type));
}
示例13: SnowStop_Dump_IMP
Obj*
SnowStop_Dump_IMP(SnowballStopFilter *self) {
SnowballStopFilterIVARS *ivars = SnowStop_IVARS(self);
SnowStop_Dump_t super_dump
= SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, LUCY_SnowStop_Dump);
Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
if (ivars->stoplist) {
Hash_Store_Utf8(dump, "stoplist", 8,
Freezer_dump((Obj*)ivars->stoplist));
}
return (Obj*)dump;
}
示例14: test_Peek_and_Pop_All
static void
test_Peek_and_Pop_All(TestBatchRunner *runner) {
NumPriorityQueue *pq = NumPriQ_new(5);
Float64 *val;
S_insert_num(pq, 3);
S_insert_num(pq, 1);
S_insert_num(pq, 2);
S_insert_num(pq, 20);
S_insert_num(pq, 10);
val = (Float64*)CERTIFY(NumPriQ_Peek(pq), FLOAT64);
TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 1,
"peek at the least item in the queue");
VArray *got = NumPriQ_Pop_All(pq);
val = (Float64*)CERTIFY(VA_Fetch(got, 0), FLOAT64);
TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 20, "pop_all");
val = (Float64*)CERTIFY(VA_Fetch(got, 1), FLOAT64);
TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 10, "pop_all");
val = (Float64*)CERTIFY(VA_Fetch(got, 2), FLOAT64);
TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 3, "pop_all");
val = (Float64*)CERTIFY(VA_Fetch(got, 3), FLOAT64);
TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 2, "pop_all");
val = (Float64*)CERTIFY(VA_Fetch(got, 4), FLOAT64);
TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 1, "pop_all");
DECREF(got);
DECREF(pq);
}
示例15: test_offsets
static void
test_offsets(TestBatchRunner *runner) {
Folder *folder = S_folder_with_contents();
CompoundFileWriter *cf_writer = CFWriter_new(folder);
Hash *cf_metadata;
Hash *files;
CFWriter_Consolidate(cf_writer);
cf_metadata = (Hash*)CERTIFY(
Json_slurp_json(folder, cfmeta_file), HASH);
files = (Hash*)CERTIFY(
Hash_Fetch_Utf8(cf_metadata, "files", 5), HASH);
bool offsets_ok = true;
TEST_TRUE(runner, Hash_Get_Size(files) > 0, "Multiple files");
HashIterator *iter = HashIter_new(files);
while (HashIter_Next(iter)) {
String *file = HashIter_Get_Key(iter);
Hash *stats = (Hash*)CERTIFY(HashIter_Get_Value(iter), HASH);
Obj *offset = CERTIFY(Hash_Fetch_Utf8(stats, "offset", 6), OBJ);
int64_t offs = Obj_To_I64(offset);
if (offs % 8 != 0) {
offsets_ok = false;
FAIL(runner, "Offset %" PRId64 " for %s not a multiple of 8",
offset, Str_Get_Ptr8(file));
break;
}
}
DECREF(iter);
if (offsets_ok) {
PASS(runner, "All offsets are multiples of 8");
}
DECREF(cf_metadata);
DECREF(cf_writer);
DECREF(folder);
}