本文整理汇总了C++中Trigger::SetQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ Trigger::SetQuery方法的具体用法?C++ Trigger::SetQuery怎么用?C++ Trigger::SetQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trigger
的用法示例。
在下文中一共展示了Trigger::SetQuery方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dprintf
Manageable::status_t
Triggerd::AddTriggerToCollection(uint32_t key, ClassAd* ad, std::string& text)
{
Trigger* trig;
char* value;
Manageable::status_t ret_val;
dprintf(D_FULLDEBUG, "Triggerd::AddTriggerToCollection called\n");
if (triggers.end() != triggers.find(key))
{
text = "Failed to create new trigger. A trigger already exists with id ";
text += key;
ret_val = STATUS_USER + 1;
}
else
{
trig = new Trigger(singleton->getInstance(), key);
if (NULL == trig)
{
text = "Failed to create new trigger. Out of memory";
ret_val = STATUS_USER + 2;
}
else
{
if (0 != ad->LookupString(ATTR_TRIGGER_NAME, &value))
{
ret_val = trig->SetName(value, text);
}
else
{
dprintf(D_ALWAYS, "Triggerd Error: '%s' not found in classad. Failed to create new trigger.\n", ATTR_TRIGGER_NAME);
text = "Failed to create new trigger. Unable to find ";
text += ATTR_TRIGGER_NAME;
text += " in classad";
ret_val = STATUS_USER + 3;
delete trig;
}
if (STATUS_OK == ret_val)
{
if (0 != ad->LookupString(ATTR_TRIGGER_QUERY, &value))
{
ret_val = trig->SetQuery(value, text);
}
else
{
dprintf(D_ALWAYS, "Triggerd Error: '%s' not found in classad. Failed to create new trigger.\n", ATTR_TRIGGER_QUERY);
text = "Failed to create new trigger. Unable to find ";
text += ATTR_TRIGGER_QUERY;
text += " in classad";
ret_val = STATUS_USER + 3;
delete trig;
}
}
if (STATUS_OK == ret_val)
{
if (0 != ad->LookupString(ATTR_TRIGGER_TEXT, &value))
{
ret_val = trig->SetText(value, text);
}
else
{
dprintf(D_ALWAYS, "Triggerd Error: '%s' not found in classad. Failed to create new trigger.\n", ATTR_TRIGGER_TEXT);
text = "Failed to create new trigger. Unable to find ";
text += ATTR_TRIGGER_TEXT;
text += " in classad";
ret_val = STATUS_USER + 3;
delete trig;
}
}
if (STATUS_OK == ret_val)
{
triggers.insert(std::pair<uint32_t, Trigger*>(key, trig));
}
}
}
dprintf(D_FULLDEBUG, "Triggerd::AddTriggerToCollection exited with return value %d\n", ret_val);
return ret_val;
}