本文整理汇总了C++中Trigger类的典型用法代码示例。如果您正苦于以下问题:C++ Trigger类的具体用法?C++ Trigger怎么用?C++ Trigger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Trigger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SDPASSERT
Trigger* DatabaseManager::getTrigger(const QString& id) {
SDPASSERT(Logger::instancePtr());
Trigger* trig = NULL;
if ( __db.isOpen() ) {
Logger::instancePtr()->addMessage(Logger::CRITICAL, __func__,
QString("Failed to fetch trigger %1. Database couldn't be opened.")
.arg(id), true);
return trig;
}
QSqlQuery query(QString("SELECT data FROM main.Trigger WHERE id LIKE '%1'").arg(id));
if ( query.next() ) {
QByteArray data = qUncompress(query.value(0).toByteArray());
QDataStream stream(&data, QIODevice::ReadOnly);
#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
stream.setVersion(QDataStream::Qt_4_8);
#else
stream.setVersion(QDataStream::Qt_4_6);
#endif
trig = Trigger::create("");
trig->fromDataStream(stream);
}
return trig;
}
示例2: faultcheck_packet_setTriggerAfterIterations
void faultcheck_packet_setTriggerAfterIterations(const char *identifier, unsigned long iterations) {
Trigger *trg = packetTool.trigger(identifier);
if (trg) {
trg->setAfterItr(iterations);
}
}
示例3: query
DatabaseManager::TriggerList
DatabaseManager::triggers(const QString& detectionID) {
TriggerList l;
if ( !__db.isOpen() )
return l;
QSqlQuery query(QString("SELECT data FROM main.Trigger WHERE detection_id LIKE '%1'")
.arg(detectionID));
while ( query.next() ) {
QByteArray data = qUncompress(query.value(0).toByteArray());
QDataStream stream(&data, QIODevice::ReadOnly);
#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
stream.setVersion(QDataStream::Qt_4_8);
#else
stream.setVersion(QDataStream::Qt_4_6);
#endif
Trigger* trig = Trigger::create("");
trig->fromDataStream(stream);
l << trig;
}
return l;
}
示例4: faultcheck_packet_setDurationAfterTrigger
void faultcheck_packet_setDurationAfterTrigger(const char *identifier, int iterations) {
Trigger *trg = packetTool.trigger(identifier);
if (trg) {
trg->setDuration(iterations);
}
}
示例5: callback
int callback(void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *dataPointer)
{
Trigger *trigger = static_cast<Trigger *>(dataPointer);
StkFloat *samples = static_cast<StkFloat *>(inputBuffer);
trigger->feedMe(samples, nBufferFrames);
return (0);
}
示例6: collisionFilter
void collisionFilter(SceneObject* object,void *key)
{
SceneContainer::CallbackInfo* info = reinterpret_cast<SceneContainer::CallbackInfo*>(key);
ShapeBase* ptr = reinterpret_cast<ShapeBase*>(info->key);
if (object->getTypeMask() & ItemObjectType) {
// We've hit it's bounding box, that's close enough for items.
Item* item = static_cast<Item*>(object);
if (ptr != item->getCollisionObject())
ptr->queueCollision(item,ptr->getVelocity() - item->getVelocity());
}
else
if (object->getTypeMask() & TriggerObjectType) {
// We've hit it's bounding box, that's close enough for triggers
Trigger* pTrigger = static_cast<Trigger*>(object);
pTrigger->potentialEnterObject(ptr);
}
else
if (object->getTypeMask() & CorpseObjectType) {
// Ok, guess it's close enough for corpses too...
ShapeBase* col = static_cast<ShapeBase*>(object);
ptr->queueCollision(col,ptr->getVelocity() - col->getVelocity());
}
else
object->buildPolyList(info->context,info->polyList,info->boundingBox,info->boundingSphere);
}
示例7: printf
bool Scenario::read(bool save_triggers)
{
printf("[R] Reading scenario\n");
FILE *scx=fopen("scndata.hex", "rb");
if (scx==NULL)
return false; //must open scn before reading data
trigger_start = skiptotriggers("scndata.hex");
long bytes_read = 0;
SKIP(scx, trigger_start);
int numtriggers;
READ(&numtriggers, sizeof(long), 1, scx);
printf("\t[R] numtriggers=%d\n",numtriggers);
long trigger_skip=0;
bool displayed=0;
std::vector<Trigger *> scen_triggers;
for (int i=0; i<numtriggers; i++)
{
//printf("[R] TRIGGER %d\n", i);
Trigger *t = new Trigger;
t->read(scx);
scen_triggers.push_back(t);
//printf("[R] END TRIGGER %d. triggerskip=%d\n", i, ftell(scx)-bytes_read);
}
if (save_triggers)
triggers = scen_triggers;
printf("\t[R] Done reading triggers\n");
trigger_skip = ftell(scx) - bytes_read;
bytes_read+=trigger_skip;
//at the end is numtriggers longs representing order of triggers.
//skip them. they're just the display order, not execution order
SKIP(scx, 4*numtriggers);
trigger_end = bytes_read;
scenario_end = skiptoscenarioend("scndata.hex");
long filesize=fsize("scndata.hex");
printf("\t[R] trigger start=%d, trigger end=%d\n", trigger_start, trigger_end);
printf("\t[R] scenario_end=%d\n", scenario_end);
printf("\t[R] scndata.hex size: %d, size without triggers: %d\n", filesize, filesize-trigger_skip-4*numtriggers-4);
printf("\t[R] Read done\n");
fclose(scx);
return true;
}
示例8: generateTriggers
int InstStrategyAutoGenTriggers::process( Node f, Theory::Effort effort, int e ){
int peffort = f.getNumChildren()==3 ? 2 : 1;
//int peffort = f.getNumChildren()==3 ? 2 : 1;
//int peffort = 1;
if( e<peffort ){
return STATUS_UNFINISHED;
}else{
bool gen = false;
if( e==peffort ){
if( d_counter.find( f )==d_counter.end() ){
d_counter[f] = 0;
gen = true;
}else{
d_counter[f]++;
gen = d_regenerate && d_counter[f]%d_regenerate_frequency==0;
}
}else{
gen = true;
}
if( gen ){
generateTriggers( f );
}
Debug("quant-uf-strategy") << "Try auto-generated triggers... " << d_tr_strategy << " " << e << std::endl;
//Notice() << "Try auto-generated triggers..." << std::endl;
for( std::map< Trigger*, bool >::iterator itt = d_auto_gen_trigger[f].begin(); itt != d_auto_gen_trigger[f].end(); ++itt ){
Trigger* tr = itt->first;
if( tr ){
bool processTrigger = itt->second;
if( effort!=Theory::EFFORT_LAST_CALL && tr->isMultiTrigger() ){
#ifdef MULTI_TRIGGER_FULL_EFFORT_HALF
processTrigger = d_counter[f]%2==0;
#endif
}
if( processTrigger ){
//if( tr->isMultiTrigger() )
Debug("quant-uf-strategy-auto-gen-triggers") << " Process " << (*tr) << "..." << std::endl;
InstMatch baseMatch;
int numInst = tr->addInstantiations( baseMatch );
//if( tr->isMultiTrigger() )
Debug("quant-uf-strategy-auto-gen-triggers") << " Done, numInst = " << numInst << "." << std::endl;
if( d_tr_strategy==Trigger::TS_MIN_TRIGGER ){
d_quantEngine->getInstantiationEngine()->d_statistics.d_instantiations_auto_gen_min += numInst;
}else{
d_quantEngine->getInstantiationEngine()->d_statistics.d_instantiations_auto_gen += numInst;
}
if( tr->isMultiTrigger() ){
d_quantEngine->d_statistics.d_multi_trigger_instantiations += numInst;
}
//d_quantEngine->d_hasInstantiated[f] = true;
}
}
}
Debug("quant-uf-strategy") << "done." << std::endl;
//Notice() << "done" << std::endl;
}
return STATUS_UNKNOWN;
}
示例9: _findContact
void Etherform::findContact(VectorF *contactNormal)
{
SceneObject *contactObject = NULL;
Vector<SceneObject*> overlapObjects;
_findContact(&contactObject, contactNormal, &overlapObjects );
// Check for triggers, corpses and items.
const U32 filterMask = isGhost() ? sClientCollisionContactMask : sServerCollisionContactMask;
for ( U32 i=0; i < overlapObjects.size(); i++ )
{
SceneObject *obj = overlapObjects[i];
U32 objectMask = obj->getTypeMask();
if ( !( objectMask & filterMask ) )
continue;
// Check: triggers, tactical zones, corpses and items...
//
if (objectMask & TriggerObjectType)
{
Trigger* pTrigger = static_cast<Trigger*>( obj );
pTrigger->potentialEnterObject(this);
}
else if (objectMask & TacticalZoneObjectType)
{
TacticalZone* pZone = static_cast<TacticalZone*>( obj );
pZone->potentialEnterObject(this);
}
else if (objectMask & CorpseObjectType)
{
// If we've overlapped the worldbounding boxes, then that's it...
if ( getWorldBox().isOverlapped( obj->getWorldBox() ) )
{
ShapeBase* col = static_cast<ShapeBase*>( obj );
queueCollision(col,getVelocity() - col->getVelocity());
}
}
else if (objectMask & ItemObjectType)
{
// If we've overlapped the worldbounding boxes, then that's it...
Item* item = static_cast<Item*>( obj );
if ( getWorldBox().isOverlapped(item->getWorldBox()) &&
item->getCollisionObject() != this &&
!item->isHidden() )
queueCollision(item,getVelocity() - item->getVelocity());
}
}
mContactInfo.clear();
mContactInfo.contacted = contactObject != NULL;
mContactInfo.contactObject = contactObject;
if(mContactInfo.contacted)
mContactInfo.contactNormal = *contactNormal;
}
示例10: SetIgnoreDefeatDraw
void TrigGeneralWindow::SetIgnoreDefeatDraw(bool ignoreDefeatDraw)
{
Trigger* trigger;
if ( CM->getTrigger(trigger, trigIndex) )
{
trigger->setIgnoreDefeatDraw(ignoreDefeatDraw);
CM->notifyChange(false);
RefreshWindow(trigIndex);
}
}
示例11: SetPausedTrigger
void TrigGeneralWindow::SetPausedTrigger(bool paused)
{
Trigger* trigger;
if ( CM->getTrigger(trigger, trigIndex) )
{
trigger->setFlagPaused(paused);
CM->notifyChange(false);
RefreshWindow(trigIndex);
}
}
示例12: START_TEST
END_TEST
START_TEST ( test_Trigger )
{
Trigger* t = new Trigger(2, 4);
fail_unless (t->hasRequiredAttributes());
delete t;
}
示例13: SetIgnoreMiscActionsOnce
void TrigGeneralWindow::SetIgnoreMiscActionsOnce(bool ignoreMiscActionsOnce)
{
Trigger* trigger;
if ( CM->getTrigger(trigger, trigIndex) )
{
trigger->setIgnoreMiscActionsOnce(ignoreMiscActionsOnce);
CM->notifyChange(false);
RefreshWindow(trigIndex);
}
}
示例14: SetDisabledTrigger
void TrigGeneralWindow::SetDisabledTrigger(bool disabled)
{
Trigger* trigger;
if ( CM->getTrigger(trigger, trigIndex) )
{
trigger->setDisabled(disabled);
CM->notifyChange(false);
RefreshWindow(trigIndex);
}
}
示例15: SetPreserveTrigger
void TrigGeneralWindow::SetPreserveTrigger(bool preserve)
{
Trigger* trigger;
if ( CM->getTrigger(trigger, trigIndex) )
{
trigger->setPreserveTriggerFlagged(preserve);
CM->notifyChange(false);
RefreshWindow(trigIndex);
}
}