本文整理汇总了C++中LogRecord::get_op_type方法的典型用法代码示例。如果您正苦于以下问题:C++ LogRecord::get_op_type方法的具体用法?C++ LogRecord::get_op_type怎么用?C++ LogRecord::get_op_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogRecord
的用法示例。
在下文中一共展示了LogRecord::get_op_type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
Transaction::InTransactionListKeysWithOpType( int op_type, std::list<std::string> &new_keys )
{
LogRecord *log;
ordered_op_log.Rewind();
while( (log = ordered_op_log.Next()) ) {
if( log->get_op_type() == op_type ) {
new_keys.push_back( log->get_key() );
}
}
}
示例2: hkey
bool
ClassAdLog::AdExistsInTableOrTransaction(const char *key)
{
bool adexists = false;
// first see if it exists in the "commited" hashtable
HashKey hkey(key);
ClassAd *ad = NULL;
table.lookup(hkey, ad);
if ( ad ) {
adexists = true;
}
// if there is no pending transaction, we're done
if (!active_transaction) {
return adexists;
}
// see what is going on in any current transaction
for (LogRecord *log = active_transaction->FirstEntry(key); log;
log = active_transaction->NextEntry())
{
switch (log->get_op_type()) {
case CondorLogOp_NewClassAd: {
adexists = true;
break;
}
case CondorLogOp_DestroyClassAd: {
adexists = false;
break;
}
default:
break;
}
}
return adexists;
}
示例3: strdup
int
ClassAdLog::ExamineTransaction(const char *key, const char *name, char *&val, ClassAd* &ad)
{
bool AdDeleted=false, ValDeleted=false, ValFound=false;
int attrsAdded = 0;
if (!active_transaction) return 0;
for (LogRecord *log = active_transaction->FirstEntry(key); log;
log = active_transaction->NextEntry()) {
switch (log->get_op_type()) {
case CondorLogOp_NewClassAd: {
if (AdDeleted) { // check to see if ad is created after a delete
AdDeleted = false;
}
break;
}
case CondorLogOp_DestroyClassAd: {
AdDeleted = true;
if ( ad ) {
delete ad;
ad = NULL;
attrsAdded = 0;
}
break;
}
case CondorLogOp_SetAttribute: {
char const *lname = ((LogSetAttribute *)log)->get_name();
if (name && strcasecmp(lname, name) == 0) {
if (ValFound) {
free(val);
}
val = strdup(((LogSetAttribute *)log)->get_value());
ValFound = true;
ValDeleted = false;
}
if (!name) {
if ( !ad ) {
ad = new ClassAd;
ASSERT(ad);
}
if (val) {
free(val);
val = NULL;
}
ExprTree* expr = ((LogSetAttribute *)log)->get_expr();
if (expr) {
expr = expr->Copy();
ad->Insert(lname, expr, false);
} else {
val = strdup(((LogSetAttribute *)log)->get_value());
ad->AssignExpr(lname, val);
}
attrsAdded++;
}
break;
}
case CondorLogOp_DeleteAttribute: {
char const *lname = ((LogDeleteAttribute *)log)->get_name();
if (name && strcasecmp(lname, name) == 0) {
if (ValFound) {
free(val);
}
ValFound = false;
ValDeleted = true;
}
if (!name) {
if (ad) {
ad->Delete(lname);
attrsAdded--;
}
}
break;
}
default:
break;
}
}
if ( name ) {
if (AdDeleted || ValDeleted) return -1;
if (ValFound) return 1;
return 0;
} else {
if (attrsAdded < 0 ) {
return 0;
}
return attrsAdded;
}
}