本文整理汇总了C++中Trigger::GetText方法的典型用法代码示例。如果您正苦于以下问题:C++ Trigger::GetText方法的具体用法?C++ Trigger::GetText怎么用?C++ Trigger::GetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Trigger
的用法示例。
在下文中一共展示了Trigger::GetText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: event
bool
Triggerd::PerformQueries()
{
ClassAdList result;
CondorError errstack;
QueryResult status;
Trigger* trig = NULL;
CondorQuery* query;
bool ret_val = true;
std::map<uint32_t,Trigger*>::iterator iter;
ClassAd* ad = NULL;
std::string eventText;
char* token = NULL;
std::string triggerText;
char* queryString = NULL;
ExprTree* attr = NULL;
std::list<std::string> missing_nodes;
size_t pos;
size_t prev_pos;
bool bad_trigger = false;
const char* token_str = NULL;
if (0 < triggers.size())
{
dprintf(D_FULLDEBUG, "Triggerd: Evaluating %d triggers\n", (int)triggers.size());
query = new CondorQuery(ANY_AD);
for (iter = triggers.begin(); iter != triggers.end(); iter++)
{
// Clear any pre-exhisting custom contraints and add the constraint
// for this trigger
trig = iter->second;
query->clearORCustomConstraints();
query->clearANDCustomConstraints();
queryString = strdup(trig->GetQuery().c_str());
ReplaceAllChars(queryString, '\'', '"');
query->addANDConstraint(queryString);
free(queryString);
// Perform the query and check the result
if (NULL != query_collector)
{
status = query->fetchAds(result, query_collector->addr(), &errstack);
}
else
{
status = collectors->query(*query, result, &errstack);
}
if (Q_OK != status)
{
// Problem with the query
if (Q_COMMUNICATION_ERROR == status)
{
dprintf(D_ALWAYS, "Triggerd Error: Error contacting the collecter - %s\n", errstack.getFullText(true).c_str());
if (CEDAR_ERR_CONNECT_FAILED == errstack.code(0))
{
dprintf(D_ALWAYS, "Triggerd Error: Couldn't contact the collector on the central manager\n");
}
}
else
{
dprintf(D_ALWAYS, "Triggerd Error: Could not retrieve ads - %s\n", getStrQueryResult(status));
}
ret_val = false;
break;
}
else
{
dprintf(D_FULLDEBUG, "Query successful. Parsing results\n");
// Query was successful, so parse the results
result.Open();
while ((ad = result.Next()))
{
if (true == bad_trigger)
{
// Avoid processing a bad trigger multiple times. Remove
// all result ads and reset the flag
dprintf(D_FULLDEBUG, "Cleaning up after a bad trigger\n");
result.Delete(ad);
while ((ad = result.Next()))
{
result.Delete(ad);
}
bad_trigger = false;
break;
}
eventText = "";
triggerText = trig->GetText();
dprintf(D_FULLDEBUG, "Parsing trigger text '%s'\n", triggerText.c_str());
prev_pos = pos = 0;
while (prev_pos < triggerText.length())
{
pos = triggerText.find("$(", prev_pos, 2);
if (std::string::npos == pos)
{
// Didn't find the start of a varible, so append the
// remaining string
dprintf(D_FULLDEBUG, "Adding text string to event text\n");
eventText += triggerText.substr(prev_pos, std::string::npos);
//.........这里部分代码省略.........