本文整理汇总了C++中Matcher类的典型用法代码示例。如果您正苦于以下问题:C++ Matcher类的具体用法?C++ Matcher怎么用?C++ Matcher使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Matcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: min
Transformation<double> StereoCartography::estimateOdometry(const vector<Feature> & featureVec)
{
//Matching
int numLandmarks = LM.size();
int numActive = min(300, numLandmarks);
vector<Feature> lmFeatureVec;
// cout << "ca va" << endl;
for (unsigned int i = numLandmarks - numActive; i < numLandmarks; i++)
{
lmFeatureVec.push_back(Feature(Vector2d(0, 0), LM[i].d));
}
// cout << "ca va" << endl;
Matcher matcher;
vector<int> matchVec;
matcher.bruteForce(featureVec, lmFeatureVec, matchVec);
Odometry odometry(trajectory.back(), stereo.TbaseCam1, stereo.cam1);
// cout << "ca va" << endl;
for (unsigned int i = 0; i < featureVec.size(); i++)
{
const int match = matchVec[i];
if (match == -1) continue;
odometry.observationVec.push_back(featureVec[i].pt);
odometry.cloud.push_back(LM[numLandmarks - numActive + match].X);
}
// cout << "cloud : " << odometry.cloud.size() << endl;
//RANSAC
odometry.Ransac();
// cout << odometry.TorigBase << endl;
//Final transformation computation
odometry.computeTransformation();
// cout << odometry.TorigBase << endl;
return odometry.TorigBase;
}
示例2:
std::list<const LLToast*> LLScreenChannel::findToasts(const Matcher& matcher)
{
std::list<const LLToast*> res;
// collect stored toasts
for (std::vector<ToastElem>::iterator it = mStoredToastList.begin(); it
!= mStoredToastList.end(); it++)
{
const LLToast* toast = it->getToast();
if (toast && matcher.matches(toast->getNotification()))
{
res.push_back(toast);
}
}
// collect displayed toasts
for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
!= mToastList.end(); it++)
{
const LLToast* toast = it->getToast();
if (toast && matcher.matches(toast->getNotification()))
{
res.push_back(toast);
}
}
return res;
}
示例3: main
int main() {
Matcher match;
for (int i=1000; i<=100000; i+=1000) {
clock_timer timer;
list.clear();
for(int j = 0; j <= i; ++j){
list.push_back(j);
}
timer.start_timer();
int hits1 = match.nSquare(i*2+1, list);
//int hits2 = match.nLogn(i*2+1, list);
timer.stop_timer();
dataVector.push_back(std::make_pair(i, timer.duration));
std::cout << "found: " << hits1 << std::endl;
}
std::ofstream myfile;
myfile.open("A.txt");
while(!dataVector.empty()) {
std::cout<<dataVector.front().first <<" , "<<dataVector.front().second <<std::endl;
myfile<< dataVector.front().first << "\t" << dataVector.front().second << "\n";
dataVector.pop_front();
}
myfile.close();
return 0;
}
示例4: WordMatcher
void AddWordMatcherImpl::operator()( boost::ptr_vector<Matcher> & matchers, const std::string & base, SpeechPart speechPart, uint index, boost::ptr_vector< Restriction > & restrictions ) const {
Matcher * matcher = new WordMatcher( base, speechPart );
matcher->variable = Variable( speechPart, index );
matcher->addRestrictions( restrictions );
matchers.push_back( matcher );
}
示例5: TEST
TEST(MatcherTest, PropertyTesting)
{
Matcher<Sut&> m = Field(&Sut::d, Eq(0));
MockIntf mock;
Sut testObj(&mock);
EXPECT_FALSE(m.Matches(testObj));
testObj.d=0;
EXPECT_TRUE(m.Matches(testObj));
}
示例6: takeNext
/// unlinkNode - Unlink the specified node from this chain. If Other == this,
/// we unlink the next pointer and return it. Otherwise we unlink Other from
/// the list and return this.
Matcher *Matcher::unlinkNode(Matcher *Other) {
if (this == Other)
return takeNext();
// Scan until we find the predecessor of Other.
Matcher *Cur = this;
for (; Cur && Cur->getNext() != Other; Cur = Cur->getNext())
/*empty*/;
if (Cur == 0) return 0;
Cur->takeNext();
Cur->setNext(Other->takeNext());
return this;
}
示例7: closeHiddenToasts
void LLScreenChannel::closeHiddenToasts(const Matcher& matcher)
{
// since we can't guarantee that close toast operation doesn't change mToastList
// we collect matched toasts that should be closed into separate list
std::list<LLToast*> toasts;
for (std::vector<ToastElem>::iterator it = mToastList.begin(); it
!= mToastList.end(); it++)
{
LLToast* toast = it->getToast();
// add to list valid toast that match to provided matcher criteria
if (toast != NULL && !toast->isDead() && toast->getNotification() != NULL
&& !toast->getVisible() && matcher.matches(toast->getNotification()))
{
toasts.push_back(toast);
}
}
// close collected toasts
for (std::list<LLToast*>::iterator it = toasts.begin(); it
!= toasts.end(); it++)
{
LLToast* toast = *it;
toast->closeFloater();
}
}
示例8: sched_call
//------------------------------sched_call-------------------------------------
uint Block::sched_call( Matcher &m, Block_Array &bbs, uint node_cnt, Node_List &worklist, int *ready_cnt, MachCallNode *mcall, VectorSet &next_call ) {
RegMask regs;
// Schedule all the users of the call right now. All the users are
// projection Nodes, so they must be scheduled next to the call.
// Collect all the defined registers.
for (DUIterator_Fast imax, i = mcall->fast_outs(imax); i < imax; i++) {
Node* n = mcall->fast_out(i);
assert( n->Opcode()==Op_MachProj, "" );
--ready_cnt[n->_idx];
assert( !ready_cnt[n->_idx], "" );
// Schedule next to call
_nodes.map(node_cnt++, n);
// Collect defined registers
regs.OR(n->out_RegMask());
// Check for scheduling the next control-definer
if( n->bottom_type() == Type::CONTROL )
// Warm up next pile of heuristic bits
needed_for_next_call(n, next_call, bbs);
// Children of projections are now all ready
for (DUIterator_Fast jmax, j = n->fast_outs(jmax); j < jmax; j++) {
Node* m = n->fast_out(j); // Get user
if( bbs[m->_idx] != this ) continue;
if( m->is_Phi() ) continue;
if( !--ready_cnt[m->_idx] )
worklist.push(m);
}
}
// Act as if the call defines the Frame Pointer.
// Certainly the FP is alive and well after the call.
regs.Insert(m.c_frame_pointer());
// Set all registers killed and not already defined by the call.
uint r_cnt = mcall->tf()->range()->cnt();
int op = mcall->ideal_Opcode();
MachProjNode *proj = new (1) MachProjNode( mcall, r_cnt+1, RegMask::Empty, MachProjNode::fat_proj );
bbs.map(proj->_idx,this);
_nodes.insert(node_cnt++, proj);
for( OptoReg::Name r = OptoReg::Name(0); r < _last_Mach_Reg; r=OptoReg::add(r,1) ) {
if( !regs.Member(r) ) { // Not already defined by the call
// Save-on-call register?
if( (m._register_save_policy[r] == 'C') ||
(m._register_save_policy[r] == 'A') ||
((m._register_save_policy[r] == 'E') &&
(op == Op_CallRuntime ||
op == Op_CallNative ||
op == Op_CallInterpreter ||
op == Op_CallLeaf)) ) {
proj->_rout.Insert(r);
}
}
}
return node_cnt;
}
示例9: readPapers
void readPapers(int papers, Scanner scanIn) {
int paper;
for (paper = 1; paper <= papers; paper++) {
String paperAuthors;
paperAuthors = scanIn.nextLine();
#ifdef DEBUG
printf("paper #%d %s\n", paper, paperAuthors);
#endif
Author authors[] = new Author[Author.MAX_PAPER_AUTHORS];
int authorsIndex = 0;
Pattern p = Pattern.compile("\\s*(\\S*)[,]\\s*(\\S*)[,:]");
Matcher m = p.matcher(paperAuthors);
while (m.find()) {
String lname = m.group(1);
String fname = m.group(2);
if (debug) {
printf("\t'%s' => '%s', '%s'\n", paperAuthors, lname, fname);
}
authors[authorsIndex] = Author.find(fname, lname);
if (authors[authorsIndex] == null) {
if (lname.length() == 0 || fname.length() == 0) {
continue;
}
authors[authorsIndex] = new Author(fname, lname);
}
authorsIndex++;
}
for (int i = 0; i < authorsIndex; i++) {
for (int j = 0; j < authorsIndex; j++) {
authors[i].publicouCom(authors[j]);
}
}
}
}
示例10: Unresolve
void Tok::Unresolve(Matcher const &matcher)
{
int i;
TokIdNode *nd;
for(i = node.size(); i--;)
{
for(nd = node[i]; nd->v_prev != 0 && !matcher.Match(nd); nd = nd->v_prev)
{
unres[i + 1].push_front(nd->id[0]);
}
}
}
示例11: find
void find(string text, string pattern, int expect) {
Matcher * impl = getImpl(pattern);
clock_t start_time = clock();
int pos = impl->find(text);
clock_t end_time = clock();
printf("pos :%d\texpect : %d\n", pos, expect);
assert(pos == expect);
// cout << pattern.size() << endl;
string out_text = (text.size() <= 100) ? text : "Too Long";
string out_pattern =(pattern.size() <= 100) ? pattern : "Too Long";
printf("start time : %lu\n", start_time);
printf("end time : %lu\n", end_time);
printf("text : %s\npattern : %s\nmatch positon : %d\nexecution time: %lfs\n\n",
out_text.c_str(), out_pattern.c_str() , pos, ((double) end_time - start_time) / CLOCKS_PER_SEC);
delete impl;
}
示例12: MatcherDecode
int MatcherDecode(SimpleImage* image,char code[4])
{
SimpleImage* gray = siCreateImage(image->width,image->height,1);
if (image->nChannels != 1)
{
siRgbToGray(image,gray);
}
//siThreshold(gray,gray,150,255);
siThreshold(gray,gray,115,255);
int ret = thiz.Decode(gray,code);
siReleaseImage(&gray);
return ret;
}
示例13: split
void QueryPreProcessor::parseQuery(string query) {
vector<string> first_split = split(query, ';'); //
vector<string> result_part;
vector<string> query_part;
Matcher* m = new Matcher();
for(size_t i = 0 ; i < first_split.size() ; i ++)
{
if(!m->checkTokens(first_split[i], "select"))
result_part.push_back(first_split[i]);
else
query_part.push_back(first_split[i]);
}
delete m;
if(query_part.size() == 0) {
exc->throwException();
}
//writeVector(result_part);
//cout << m->checkProcName(result_part[0]) << endl;
//cout << m->checkVarName(result_part[0]) << endl;
//cout << m->checkStmt_(result_part[0]) << endl;
//cout << m->checkAll(result_part[0]) << endl;
vector<Field> fields = makeFields(result_part);
setFields(fields);
//writeVector(query_part);
makeTree(query_part);
/*
for (int j = 0; j < fields.size(); j++) {
cout << fields[j].getType() << " " << fields[j].getValue() << endl;
}*/
}
示例14: readCases
int readCases(int names, Scanner *scanIn, Collection<Entry<String, Author>> *theMap,
Set<Author> *targets) {
int nameInd;
for (nameInd = 1; nameInd <= names; nameInd++) {
String bigname;
bigname = scanIn.nextLine();
#ifdef DEBUG
printf("\tname #%d %s\n", nameInd, bigname);
#endif
Pattern p = Pattern.compile("\\s*(\\S*)[,]\\s*(\\S*)");
Matcher m = p.matcher(bigname);
if (m.find()) {
String lname = m.group(1);
String fname = m.group(2);
#ifdef DEBUG
printf("\tmatcher2'%s' => '%s', '%s'\n", bigname, lname, fname);
#endif
Author a = Author.find(fname, lname);response
theMap.add(new MyEntry(bigname, a));
if (a != null) {
targets.add(a);
#ifdef DEBUG
printf("\tauthor case '%s' is #%d\n", a.lname, targets.size());
#endif
}
} else {
theMap.add(new Entry<String, Author>(bigname, null));
}
}
return nameInd;
}
示例15: GetDescendants
TokArr Tok::GetDescendants(Matcher const &matcher) const
{
TokIdNode *nd[2];
TokArr rv;
for(nd[0] = TokIdNode::GetLeaf(nd[1] = Node()); nd[0] != nd[1]; nd[0] = TokIdNode::GetNext(nd[0], nd[1]))
{
if(matcher.Match(nd[0]))
{
rv.push_back(nd[0]);
}
}
return rv;
}