本文整理汇总了C++中qp函数的典型用法代码示例。如果您正苦于以下问题:C++ qp函数的具体用法?C++ qp怎么用?C++ qp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qp函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char * argv[] ){
argc-=(argc>0); argv+=(argc>0); // skip program name argv[0] if present
option::Stats stats(usage, argc, argv);
option::Option options[stats.options_max], buffer[stats.buffer_max];
option::Parser parse(usage, argc, argv, options, buffer);
if (parse.error())
return 1;
if (options[HELP]) {
option::printUsage(std::cout, usage);
return 0;
}
if (options[VERB] && options[VERB].arg)
Log::setGlobalVerbosityForAllLoggers(atoi(options[VERB].arg));
int buckets = (options[QP] && options[QP].arg) ? atoi(options[QP].arg) : 0;
int limit = (options[LIMIT] && options[LIMIT].arg) ? atoi(options[LIMIT].arg) : CONSTS::MAXD;
int offset = (options[OFFSET] && options[OFFSET].arg) ? atoi(options[OFFSET].arg) : 0;
int topk = (options[TOPK] && options[TOPK].arg) ? atoi(options[TOPK].arg) : 10;
int layer = (options[LAYER] && options[LAYER].arg) ? atoi(options[LAYER].arg) : 0;
if(options[BUILD]) {
const std::string& trecRawRoot = options[BUILD].arg ? std::string(options[BUILD].arg) : CONSTS::trecRawRoot;
std::string outputPath = (options[OUTPATH] && options[OUTPATH].arg) ? std::string(options[OUTPATH].arg): CONSTS::trecRoot;
stringIntVectorsPair tmap; //empty one
TrecReader* tr = TrecFactory(trecRawRoot);
TrecFactory(*tr,outputPath, offset,limit,tmap);
delete tr;
return 0;
}
std::string queryFile = (options[QPATH] && options[QPATH].arg) ? std::string(options[QPATH].arg): CONSTS::ikQuery;
SingleHashBlocker::expectedBlockSize = (options[OFFSET] && options[OFFSET].arg) ? atoi(options[OFFSET].arg) : 8;
//COUT3 << "Expected block size: " << SingleHashBlocker::expectedBlockSize << Log::endl; // togo
//togo
//std::cout << "########### expected block size: 2^" << SingleHashBlocker::expectedBlockSize << std::endl;
if(nice(-3)) {}
termsCache Cache;
if(options[ONDEMAND] )
onDemandCpool::initPool(CONSTS::STORAGE_CAPACITY); //prepare the cache but load none
else {
// load different terms_mapping
if (layer == 0)
Cache.fill_cache(CONSTS::termsMapping.c_str()); //load terms //
else
Cache.fill_cache(CONSTS::termsMapping_Layer.c_str()); //load terms Layering
}
QueryProcessing qp(Cache);
qp(queryFile.c_str(), buckets, limit, topk, layer); //process the queries
qp.printReport();
COUT1 << "start cleanup" << Log::endl;
return 0;
}
开发者ID:Sparklexs,项目名称:WSDM13,代码行数:60,代码来源:main.cpp
示例2: _init
virtual void _init() {
if ( qp().scanAndOrderRequired() ) {
throw MsgAssertionException( OutOfOrderDocumentsAssertionCode, "order spec cannot be satisfied with index" );
}
_c = qp().newCursor();
_capped = _c->capped();
mayAdvance();
}
开发者ID:MSchireson,项目名称:mongo,代码行数:8,代码来源:queryoptimizercursor.cpp
示例3: _init
virtual void _init() {
if ( requireIndex_ && strcmp( qp().indexKey().firstElement().fieldName(), "$natural" ) == 0 )
throw MsgAssertionException( 9011 , "Not an index cursor" );
c_ = qp().newCursor();
if ( !c_->ok() ) {
setComplete();
}
}
开发者ID:mapleoin,项目名称:mongo,代码行数:8,代码来源:dbhelpers.cpp
示例4: init
virtual void init() {
if ( requireIndex_ && strcmp( qp().indexKey().firstElement().fieldName(), "$natural" ) == 0 )
throw MsgAssertionException( 9011 , "Not an index cursor" );
c_ = qp().newCursor();
if ( !c_->ok() )
setComplete();
else
matcher_.reset( new CoveredIndexMatcher( qp().query(), qp().indexKey() ) );
}
开发者ID:IlyaM,项目名称:mongo,代码行数:9,代码来源:dbhelpers.cpp
示例5: TEST
TEST(QueryPlannerTest, createTripleGraph) {
try {
{
ParsedQuery pq = SparqlParser::parse(
"PREFIX : <http://rdf.myprefix.com/>\n"
"PREFIX ns: <http://rdf.myprefix.com/ns/>\n"
"PREFIX xxx: <http://rdf.myprefix.com/xxx/>\n"
"SELECT ?x ?z \n "
"WHERE \t {?x :myrel ?y. ?y ns:myrel ?z.?y xxx:rel2 "
"<http://abc.de>}");
pq.expandPrefixes();
QueryPlanner qp(nullptr);
auto tg = qp.createTripleGraph(&pq._rootGraphPattern);
ASSERT_EQ(
"0 {s: ?x, p: <http://rdf.myprefix.com/myrel>, o: ?y} : (1, 2)\n"
"1 {s: ?y, p: <http://rdf.myprefix.com/ns/myrel>, o: ?z} : (0, 2)\n"
"2 {s: ?y, p: <http://rdf.myprefix.com/xxx/rel2>, o: "
"<http://abc.de>} : (0, 1)",
tg.asString());
}
{
ParsedQuery pq = SparqlParser::parse(
"SELECT ?x WHERE {?x ?p <X>. ?x ?p2 <Y>. <X> ?p <Y>}");
pq.expandPrefixes();
QueryPlanner qp(nullptr);
auto tg = qp.createTripleGraph(&pq._rootGraphPattern);
ASSERT_EQ(
"0 {s: ?x, p: ?p, o: <X>} : (1, 2)\n"
"1 {s: ?x, p: ?p2, o: <Y>} : (0)\n"
"2 {s: <X>, p: ?p, o: <Y>} : (0)",
tg.asString());
}
{
ParsedQuery pq = SparqlParser::parse(
"SELECT ?x WHERE { ?x <is-a> <Book> . \n"
"?x <Author> <Anthony_Newman_(Author)> }");
pq.expandPrefixes();
QueryPlanner qp(nullptr);
auto tg = qp.createTripleGraph(&pq._rootGraphPattern);
ASSERT_EQ(
"0 {s: ?x, p: <is-a>, o: <Book>} : (1)\n"
"1 {s: ?x, p: <Author>, o: <Anthony_Newman_(Author)>} : (0)",
tg.asString());
}
} catch (const ad_semsearch::Exception& e) {
std::cout << "Caught: " << e.getFullErrorMessage() << std::endl;
FAIL() << e.getFullErrorMessage();
} catch (const std::exception& e) {
std::cout << "Caught: " << e.what() << std::endl;
FAIL() << e.what();
}
}
开发者ID:Buchhold,项目名称:SparqlEngineDraft,代码行数:54,代码来源:QueryPlannerTest.cpp
示例6: init
virtual void init() {
query_ = spec_.getObjectField( "query" );
c_ = qp().newCursor();
matcher_.reset( new KeyValJSMatcher( query_, c_->indexKeyPattern() ) );
if ( qp().exactKeyMatch() && ! matcher_->needRecord() ) {
query_ = qp().simplifiedQuery( qp().indexKey() );
bc_ = dynamic_cast< BtreeCursor* >( c_.get() );
bc_->forgetEndKey();
}
skip_ = spec_["skip"].numberLong();
limit_ = spec_["limit"].numberLong();
}
开发者ID:mharris717,项目名称:mongo,代码行数:13,代码来源:query.cpp
示例7: draw
void testApp :: draw()
{
//ofQuaternion constructor: angle, ofVec3f axis
ofQuaternion qr (roll, Znormal); // quat roll.
ofQuaternion qp (pitch, Xnormal); // quat pitch.
ofQuaternion qh (heading, Ynormal); // quat heading or yaw.
ofQuaternion qt; // quat total.
// The order IS IMPORTANT. Apply roll first, then pitch, then heading.
qt = qr * qp * qh;
ofPushMatrix();
ofTranslate( ofGetWidth() * 0.5, ofGetHeight() * 0.5, 0 );
/******************************/
/*
//GYMBAL LOCK!!
EulerRot = qt.getEuler();
ofRotateX(EulerRot.x);
ofRotateY(EulerRot.y);
ofRotateZ(EulerRot.z);
*/
ofVec3f qaxis; float qangle;
qt.getRotate(qangle, qaxis);
ofRotate(qangle, qaxis.x, qaxis.y, qaxis.z);
ofScale( 200, 200, 200 );
/******************************/
drawCube();
ofPopMatrix();
ofSetColor( 0x000000 );
ofDrawBitmapString
(
"fps :: " + ofToString(ofGetFrameRate(), 2) + "\n\n"
"incDir :: press i to change :: " + ofToString( incDir ) + "\n\n"
"roll :: press 1 to change :: " + ofToString( roll ) + "\n\n"
"pitch :: press 2 to change :: " + ofToString( pitch ) + "\n\n"
"heading :: press 3 to change :: " + ofToString( heading ) + "\n\n",
20,
20
);
}
开发者ID:glBeatriz,项目名称:Simple-OF-quaternions,代码行数:60,代码来源:testApp.cpp
示例8: yzisUserDir
void YResourceMgr::initConfig()
{
// handle ~/.yzis/
QString yzisSuffix = ".yzis";
bool isTmpDir = false;
mYzisUserDir = QDir::homePath() + "/" + yzisSuffix + "/";
QDir yzisUserDir(mYzisUserDir);
if(! yzisUserDir.exists()) {
dbg().SPrintf("User dir does not exist, creating it: %s", qp(mYzisUserDir));
yzisUserDir.cdUp();
if(! yzisUserDir.mkdir(yzisSuffix)) {
isTmpDir = true;
mYzisUserDir = QDir::tempPath() + "/";
err() << "initConfig(): could not create yzis user directory, falling back on " << mYzisUserDir;
}
}
yzisUserDir.setPath(mYzisUserDir);
if((!QFileInfo(mYzisUserDir).isWritable()) && (!isTmpDir)) {
mYzisUserDir = QDir::tempPath() + "/";
err() << "initConfig(): yzis user directory is not writable, falling back on " << mYzisUserDir;
isTmpDir = true;
}
if((! QFileInfo(mYzisUserDir).isWritable())) {
err() << "initConfig(): yzis user directory " << mYzisUserDir << " is not writable, falling back on " << mYzisUserDir;
err() << "initConfig(): Yzis will not function properly" << endl;
}
dbg() << "initConfig(): yzis user directory set to " << mYzisUserDir << endl;
}
开发者ID:sandsmark,项目名称:yzis,代码行数:34,代码来源:resourcemgr.cpp
示例9: qp
void Widget::paintEvent(QPaintEvent *e) {
QPainter qp(this);
drawWidget(qp);
QFrame::paintEvent(e);
}
开发者ID:artisdom,项目名称:cpp_snippets,代码行数:7,代码来源:widget.cpp
示例10: Q_UNUSED
void Lines::paintEvent(QPaintEvent *e){
Q_UNUSED(e);
QPainter qp(this);
/*Create serial object */
try {
// Make a SimpleSerial object with the parameter for your Wunderboard/OS
this->tmp = this->wunder->readLine();
/*handles odd SimpleSerial Problems*/
if(this->tmp.length() != 3)
adcval = MADC; //send it back to the middle
else
adcval = atoi(this->tmp.c_str()) - MADC ;
} catch(boost::system::system_error& e)
{
std::cerr<<tmp<<": Error: "<<std::endl;//<<e.what()<<std::endl;
}
qp.setWindow(0,0, 800, 600);
drawBoundary(&qp);
drawPaddle(&qp);
drawBall(&qp);
drawBlocks(&qp);
check_collision();
}
开发者ID:nomath4u,项目名称:wunder-breakout,代码行数:30,代码来源:Lines.cpp
示例11: sei
void AP_TimerProcess::run(void)
{
// we enable the interrupt again immediately and also enable
// interrupts. This allows other time critical interrupts to
// run (such as the serial receive interrupt). We catch the
// timer calls taking too long using _in_timer_call.
// This approach also gives us a nice uniform spacing between
// timer calls
TCNT2 = _period;
sei();
uint32_t tnow = micros();
if (_in_timer_call) {
// the timer calls took longer than the period of the
// timer. This is bad, and may indicate a serious
// driver failure. We can't just call the drivers
// again, as we could run out of stack. So we only
// call the _failsafe call. It's job is to detect if
// the drivers or the main loop are indeed dead and to
// activate whatever failsafe it thinks may help if
// need be. We assume the failsafe code can't
// block. If it does then we will recurse and die when
// we run out of stack
if (_failsafe != NULL) {
_failsafe(tnow);
}
return;
}
_in_timer_call = true;
if (!_suspended) {
// now call the timer based drivers
for (int i = 0; i < _pidx; i++) {
if (_proc[i] != NULL) {
_proc[i](tnow);
}
}
// run any queued processes
uint8_t oldSREG = SREG;
cli();
ap_procedure qp = _queued_proc;
_queued_proc = NULL;
SREG = oldSREG;
if( qp != NULL ) {
_suspended = true;
qp(tnow);
_suspended = false;
}
}
// and the failsafe, if one is setup
if (_failsafe != NULL) {
_failsafe(tnow);
}
_in_timer_call = false;
}
开发者ID:Helibank,项目名称:APM-Vision,代码行数:59,代码来源:AP_TimerProcess.cpp
示例12: resizeImageBuffer
void Reverb1LCD::paintEvent(QPaintEvent* event) {
(void) event;
resizeImageBuffer();
QPainter qp(this);
qp.drawImage(0,0,img);
}
开发者ID:k-a-z-u,项目名称:KSynth,代码行数:9,代码来源:Reverb1LCD.cpp
示例13: qp
void QScope::refresh_all(timeref_t t) {// DB modification, extracted from refresh
if (t) {
qss.endtime = t;
nspikes = 0;
}
QPainter qp(this);
drawContents_all(&qp);
//drawContents_together(&qp);
}
开发者ID:maru-n,项目名称:meabench_robot,代码行数:9,代码来源:QScope.C
示例14: prepareToYield
virtual bool prepareToYield() {
if ( _c && !_cc ) {
_cc.reset( new ClientCursor( QueryOption_NoCursorTimeout , _c , qp().ns() ) );
}
if ( _cc ) {
_posBeforeYield = currLoc();
return _cc->prepareToYield( _yieldData );
}
// no active cursor - ok to yield
return true;
}
开发者ID:MSchireson,项目名称:mongo,代码行数:11,代码来源:queryoptimizercursor.cpp
示例15: main
int
main(int argc, char* argv[])
{
if (argc < 2) {
std::cout << "USAGE:\n\t qppub <sensor-id>" << std::endl;
return -1;
}
int sid = atoi(argv[1]);
const int N = 100;
/*segment1-start*/
dds::core::QosProvider qp("file://defaults.xml", "DDS DefaultQosProfile");
// create a Domain Participant, -1 defaults to value defined in configuration file
dds::domain::DomainParticipant dp(-1);
dds::topic::qos::TopicQos topicQos = qp.topic_qos();
dds::topic::Topic<tutorial::TempSensorType> topic(dp, "TempSensor", topicQos);
dds::pub::qos::PublisherQos pubQos = qp.publisher_qos();
dds::pub::Publisher pub(dp, pubQos);
dds::pub::qos::DataWriterQos dwqos = qp.datawriter_qos();
dds::pub::DataWriter<tutorial::TempSensorType> dw(pub, topic, dwqos);
/*segment1-end*/
const float avgT = 25;
const float avgH = 0.6;
const float deltaT = 5;
const float deltaH = 0.15;
// Initialize random number generation with a seed
srandom(clock());
// Write some temperature randomly changing around a set point
float temp = avgT + ((random()*deltaT)/RAND_MAX);
float hum = avgH + ((random()*deltaH)/RAND_MAX);
tutorial::TempSensorType sensor( sid, temp, hum, tutorial::CELSIUS );
// Write the data
for (unsigned int i = 0; i < N; ++i) {
dw.write(sensor);
std::cout << "DW << " << sensor << std::endl;
std::this_thread::sleep_for(std::chrono::seconds(1));
temp = avgT + ((random()*deltaT)/RAND_MAX);
sensor.temp(temp);
hum = avgH + ((random()*deltaH)/RAND_MAX);
sensor.hum(hum);
}
return 0;
}
开发者ID:PrismTech,项目名称:opensplice,代码行数:54,代码来源:qppub.cpp
示例16: qp
void KReportPage::renderPage(int page)
{
d->page = page - 1;
d->pixmap.fill();
QPainter qp(&d->pixmap);
if (d->reportDocument) {
KReportRendererContext cxt;
cxt.painter = &qp;
d->renderer->render(cxt, d->reportDocument, d->page);
}
update();
}
开发者ID:nimxor,项目名称:kreport,代码行数:12,代码来源:KReportPage.cpp
示例17: ibv_post_recv
void IBConnection::post_recv(struct ibv_recv_wr* wr)
{
struct ibv_recv_wr* bad_recv_wr;
int err = ibv_post_recv(qp(), wr, &bad_recv_wr);
if (err) {
L_(fatal) << "ibv_post_recv failed: " << strerror(err);
throw InfinibandException("ibv_post_recv failed");
}
++total_recv_requests_;
}
开发者ID:cbm-fles,项目名称:flesnet,代码行数:12,代码来源:IBConnection.cpp
注:本文中的qp函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论