• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ MDB函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中MDB函数的典型用法代码示例。如果您正苦于以下问题:C++ MDB函数的具体用法?C++ MDB怎么用?C++ MDB使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了MDB函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: MUGIDFromName

int MUGIDFromName(

  char *GName)

  {
  struct group *buf;
  int tmpGID = 0;

  const char *FName = "MUGIDFromName";

  MDB(7,fSTRUCT) MLog("%s(%s)\n",
    FName,
    (GName != NULL) ? GName : "NULL");

  if ((GName == NULL) || !strcmp(GName,NONE))
    {
    return(-1);
    }

  errno = 0;

  buf = getgrnam(GName);

  if (buf == NULL)
    {
    MDB(3,fSTRUCT) MLog("ALERT:    error looking up group '%s' - %s (errno:%d)\n",
      GName,
      strerror(errno),
      errno);
    
    /* look for GID??? format */

    if (!strncmp(GName,"GID",strlen("GID")))
      {
      return(atoi(GName + strlen("GID")));
      }

    /* check to see if GName is the GID number itself (group names cannot start
     * with a number) */

    tmpGID = (int)strtol(GName,NULL,10);

    if (tmpGID != 0)
      {
      return(tmpGID);
      }

    return(-1);
    }

  return(buf->gr_gid);
  }    /* END MUGIDFromName() */
开发者ID:dhh1128,项目名称:cbase,代码行数:52,代码来源:MUsersGroups.c


示例2: MCacheRemoveVM

int MCacheRemoveVM(

    char *Name)

  {
  if (MCache == NULL)
    {
    return(FAILURE);
    }

  if (MUStrIsEmpty(Name))
    {
    MDB(3,fSCHED) MLog("INFO:     Blank name given. Cannot remove from cache.\n");

    return(FAILURE);
    }

  pthread_rwlock_wrlock(&MCache->VMLock);

  MUHTRemove(&MCache->VMs,Name,&MVMTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MMongoDeleteO(Name,mxoxVM);
    }


  pthread_rwlock_unlock(&MCache->VMLock);

  return(SUCCESS);
  }
开发者ID:dhh1128,项目名称:cbase,代码行数:31,代码来源:MCache.c


示例3: MCacheWriteVM

int MCacheWriteVM(

  mtransvm_t *VM) /* I */

  {
  int rc;

  const char *FName = "MCacheWriteVM";

  MDB(8,fSCHED) MLog("%s(%s)\n",
    FName,
    (VM != NULL) ? VM->VMID : NULL);

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  pthread_rwlock_wrlock(&MCache->VMLock);

  rc = MUHTAdd(&MCache->VMs,VM->VMID,(void *)VM,NULL,&MVMTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MTransOToMongo(VM,mxoxVM);
    }

  pthread_rwlock_unlock(&MCache->VMLock);

  return(rc);
  }  /* END MCacheWriteVM() */
开发者ID:dhh1128,项目名称:cbase,代码行数:31,代码来源:MCache.c


示例4: MCacheRemoveJob

int MCacheRemoveJob(

    char *JName)

  {
  if (MUStrIsEmpty(JName))
    {
    MDB(3,fSCHED) MLog("INFO:     Blank name given. Cannot remove from cache.\n");

    return(FAILURE);
    }

  pthread_rwlock_wrlock(&MCache->JobLock);

  MUHTRemove(&MCache->Jobs,JName,&MJobTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MMongoDeleteO(JName,mxoJob);
    }

  pthread_rwlock_unlock(&MCache->JobLock);

  return(SUCCESS);
  }
开发者ID:dhh1128,项目名称:cbase,代码行数:25,代码来源:MCache.c


示例5: MCacheWriteNode

int MCacheWriteNode(

  mtransnode_t    *N)

  {
  int rc;

  const char *FName = "MCacheWriteNode";

  MDB(7,fTRANS) MLog("%s(%s)\n",
    FName,
    (MUStrIsEmpty(N->Name)) ? "NULL" : N->Name);

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  /* Obtain the write lock and write the object */

  pthread_rwlock_wrlock(&MCache->NodeLock);
  rc = MUHTAdd(&MCache->Nodes,N->Name,(void*)N,NULL,&MNodeTransitionFree);

  if (DBWRITE)
    {
    MMongoInterface::MTransOToMongo(N,mxoNode);
    }

  pthread_rwlock_unlock(&MCache->NodeLock);

  return(rc);
  }  /* END MCacheWriteNode() */
开发者ID:dhh1128,项目名称:cbase,代码行数:32,代码来源:MCache.c


示例6: MCacheReadVMs

int MCacheReadVMs(

  marray_t *VMArray,        /* O */
  marray_t *ConstraintList) /* I */

  {
  mhashiter_t HTIter;
  char *VMID;
  mtransvm_t *VM;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->VMLock);

  while (MUHTIterate(&MCache->VMs,&VMID,(void **)&VM,NULL,&HTIter) == SUCCESS)
    {
    if (MVMTransitionMatchesConstraints(VM,ConstraintList))
      {
      MUArrayListAppendPtr(VMArray,VM);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     VM %s does not meet constraints.\n",VM->VMID);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->VMLock);

  return(SUCCESS);
  }  /* END MCacheReadVMs() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c


示例7: MCacheReadTriggers

int MCacheReadTriggers(

  marray_t *TArray,         /* O */
  marray_t *ConstraintList) /* I */

  {
  mhashiter_t HTIter;
  char *TrigID;
  mtranstrig_t *T;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->TriggerLock);

  while (MUHTIterate(&MCache->Triggers,&TrigID,(void **)&T,NULL,&HTIter) == SUCCESS)
    {
    if (MTrigTransitionMatchesConstraints(T,ConstraintList))
      {
      MUArrayListAppendPtr(TArray,T);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     Trigger %s does not meet constraints.\n",T->TrigID);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->TriggerLock);

  return(SUCCESS);
  }  /* END MCacheReadTriggers() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c


示例8: MCacheReadJobs

int MCacheReadJobs(

  marray_t *JArray,
  marray_t *ConstraintList)

  {
  mhashiter_t HTIter;
  char *Name;
  mtransjob_t *J;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->JobLock);

  while (MUHTIterate(&MCache->Jobs,&Name,(void **)&J,NULL,&HTIter) == SUCCESS)
    {
    if (MJobTransitionMatchesConstraints(J,ConstraintList))
      {
      MUArrayListAppendPtr(JArray,J);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     Job %s does not meet constraints.\n",J->Name);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->JobLock);

  return(SUCCESS);
  }  /* END MCacheReadJobs() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c


示例9: MCacheReadRsvs

int MCacheReadRsvs(

  marray_t *RArray,
  marray_t *ConstraintList)

  {
  mhashiter_t HTIter;
  char *Name;
  mtransrsv_t *R;

  if (MCache == NULL)
    {
    return(FAILURE);
    }

  MUHTIterInit(&HTIter);

  pthread_rwlock_rdlock(&MCache->RsvLock);

  while (MUHTIterate(&MCache->Rsvs,&Name,(void **)&R,NULL,&HTIter) == SUCCESS)
    {
    if (MRsvTransitionMatchesConstraints(R,ConstraintList))
      {
      MUArrayListAppendPtr(RArray,R);
      }
    else
      {
      MDB(8,fSCHED) MLog("INFO:     Reservation %s does not meet constraints.\n",R->Name);
      }
    } /* END while (MUHTIterate) */

  pthread_rwlock_unlock(&MCache->RsvLock);

  return(SUCCESS);
  }  /* END MCacheReadRsvs() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MCache.c


示例10: MDAGDestroy

int MDAGDestroy(

  marray_t *DList)  /* I (modified) */

  {
  int index;
  mdepend_t **DArray;
  mdepend_t  *tmpD;

  const char *FName = "MDAGDestroy";

  MDB(9,fALL) MLog("%s(DList)\n",
    FName);

  if (DList == NULL)
    {
    return(FAILURE);
    }

  DArray = (mdepend_t **)DList->Array;

  for (index = 0;index < DList->NumItems;index++)
    {
    tmpD = DArray[index];

    MUFree(&tmpD->Value);
    MUFree(&tmpD->SValue);

    MUFree((char **)&DArray[index]);
    }

  MUArrayListFree(DList);

  return(SUCCESS);
  } /* END MDAGDestroy() */
开发者ID:dhh1128,项目名称:cbase,代码行数:35,代码来源:MDAG.c


示例11: MSysDequeueSocket

int MSysDequeueSocket(
  
  msocket_t **S)  /* O */

  {
  if (S == NULL)
    {
    return(FAILURE);
    }

  if (MUDLListSize(MSocketQueue) == 0)
    {
    /* queue is empty */
    
    return(FAILURE);
    }

  MUMutexLock(&MSocketQueueMutex);

  *S = (msocket_t *)MUDLListRemoveFirst(MSocketQueue);

  MSched.TransactionCount--;

  MUMutexUnlock(&MSocketQueueMutex);

  MUGetMS(NULL,(long *)&(*S)->ProcessTime);

  MDB(7,fSOCK) MLog("INFO:     socket %d being serviced after %lu milli-sec wait\n",
    (*S)->sd,
    (*S)->ProcessTime - (*S)->CreateTime);
   
  return(SUCCESS);    
  }  /* END MSysDequeueSocket() */
开发者ID:dhh1128,项目名称:cbase,代码行数:33,代码来源:MSysSocketQueue.c


示例12: MWikiSDUpdate

int MWikiSDUpdate(

  char        *AString,  /* I */
  msdata_t    *SD,       /* I (modified) */
  mrm_t       *R)        /* I */

  {
  char *ptr;
  char *tail;

  char  SDAttr[MMAX_BUFFER];

  char  EMsg[MMAX_LINE];
  char  tmpLine[MMAX_LINE];

  const char *FName = "MWikiSDUpdate";

  MDB(2,fWIKI) MLog("%s(AString,SD,%s)\n",
    FName,
    (R != NULL) ? R->Name : "NULL");

  if ((SD == NULL) || (AString == NULL))
    {
    return(FAILURE);
    }

  ptr = AString;

  /* FORMAT:  <FIELD>=<VALUE> [<FIELD>=<VALUE>]... */

  while (ptr[0] != '\0')
    {
    if ((tail = MUStrChr(ptr,' ')) != NULL)
      {
      strncpy(SDAttr,ptr,MIN(MMAX_BUFFER - 1,tail - ptr));
      SDAttr[tail - ptr] = '\0';
      }
    else
      {
      MUStrCpy(SDAttr,ptr,MMAX_BUFFER);
      }

    if (MWikiSDUpdateAttr(SDAttr,SD,R,EMsg) == FAILURE)
      {
      snprintf(tmpLine,sizeof(tmpLine),"info corrupt for staging-data '%s -> %s' - %s",
        SD->SrcLocation,
        SD->DstLocation,
        EMsg);

      MMBAdd(&R->MB,tmpLine,NULL,mmbtNONE,0,0,NULL);
      }

    if (tail == NULL)
      break;

    ptr = tail + 1;
    }  /* END while ((tail = MUStrChr(ptr,';')) != NULL) */

  return(SUCCESS);
  }  /* END MWikiSDUpdate() */
开发者ID:dhh1128,项目名称:cbase,代码行数:60,代码来源:MWikiSD.c


示例13: MLocalCheckFairnessPolicy

int MLocalCheckFairnessPolicy(

  mjob_t *J,
  long    StartTime,
  char   *Message)

  {
  const char *FName = "MLocalCheckFairnessPolicy";

  MDB(6,fSCHED) MLog("%s(%s,%ld,Message)\n",
    FName,
    (J != NULL) ? J->Name : "NULL",
    (unsigned long)StartTime);

/*
  if (ContribJobLengthFairnessPolicy(J,StartTime,Message) == FAILURE)
    {
    return(FAILURE);
    }
*/

/*
  if (ContribASCBackgroundJobPolicy(J,StartTime,Message) == FAILURE)
    {
    return(FAILURE);
    }
*/

  /* all local policies passed */

  return(SUCCESS);
  }  /* END MLocalFairnessPolicy() */
开发者ID:dhh1128,项目名称:cbase,代码行数:32,代码来源:MLocal.c


示例14: MDAGCopy

int MDAGCopy(

  marray_t *DList,
  marray_t *SList)

  {
  mdepend_t *tmpS;

  const char *FName = "MDAGCopy";

  MDB(5,fALL) MLog("%s(DList,SList)\n",
    FName);

  if ((SList == NULL) || (DList == NULL))
    {
    return(FAILURE);
    }

 if (DList->Array != NULL)
    {
    MUArrayListFree(DList);
    }

  if (SList->Array == NULL)
    {
    /* nothing to copy */

    return(SUCCESS);
    }

  MUArrayListCreate(DList,SList->ElementSize,SList->NumItems);

  tmpS = ((mdepend_t **)SList->Array)[0];

  if (tmpS == NULL)
    {
    /* nothing to copy */

    return(SUCCESS);
    }

  while (tmpS != NULL)
    {
    MDAGSetAnd(DList,tmpS->Type,tmpS->Value,tmpS->SValue,&tmpS->BM);

    tmpS = tmpS->NextAnd;
    }

  tmpS = ((mdepend_t **)SList->Array)[0]->NextOr;

  while (tmpS != NULL)
    {
    MDAGSetOr(DList,tmpS->Type,tmpS->Value,NULL);

    tmpS = tmpS->NextOr;
    }

  return(SUCCESS);
  }  /* END MDAGCopy */
开发者ID:dhh1128,项目名称:cbase,代码行数:59,代码来源:MDAG.c


示例15: MDAGCreate

int MDAGCreate(

  marray_t   *DList,  /* I */
  mdepend_t **DP)     /* O (modified) */

  {
  mdepend_t *NewD = NULL;

  const char *FName = "MDAGCreate";

  MDB(5,fALL) MLog("%s(DList,DP)\n",
    FName);

  if (DP != NULL)
    {
    *DP = NULL;
    }

  if ((DList == NULL) || (DP == NULL))
    {
    return(FAILURE);
    }

  NewD = (mdepend_t *)MUCalloc(1,sizeof(mdepend_t));

  if (NewD == NULL)
    {
    MDB(1,fALL) MLog("ALERT:    could not allocate new dependency\n");

    return(FAILURE);
    }

  NewD->Satisfied = MBNOTSET;

  if (MUArrayListAppendPtr(DList,NewD) == FAILURE)
    {
    return(FAILURE);
    }

  *DP = NewD;

  NewD->Index = DList->NumItems-1;

  return(SUCCESS);
  }  /* END MDAGCreate() */
开发者ID:dhh1128,项目名称:cbase,代码行数:45,代码来源:MDAG.c


示例16: MMBCopyAll

int MMBCopyAll(

  mmb_t **DstHead,  /* O (modified/alloc) */
  mmb_t  *SrcHead)  /* I */

  {
  mmb_t *mptr;

  mmb_t *MB;

  const char *FName = "MMBCopyAll";

  MDB(7,fSTRUCT) MLog("%s(DstHead,SrcHead)\n",
    FName);

  if (DstHead == NULL)
    {
    return(FAILURE);
    }

  if (SrcHead == NULL)
    {
    return(SUCCESS);
    }

  for (mptr = SrcHead;mptr != NULL;mptr = mptr->Next)
    {
    if (MMBAdd(
          DstHead,
          mptr->Data,
          mptr->Owner,
          mptr->Type,
          mptr->ExpireTime,
          mptr->Priority,
          &MB) == FAILURE)
      {
      continue;
      }

    MB->Count     = mptr->Count;
    MB->IsPrivate = mptr->IsPrivate;
    MB->CTime     = mptr->CTime;

    if (mptr->Label != NULL)
      MUStrDup(&MB->Label,mptr->Label);

    if (mptr->Source != NULL)
      MUStrDup(&MB->Source,mptr->Source); 
    }  /* END for (mptr) */

  return(SUCCESS);
  }  /* END MMBCopyAll() */
开发者ID:dhh1128,项目名称:cbase,代码行数:52,代码来源:MMB.c


示例17: MDAGSetAnd

int MDAGSetAnd(

  marray_t          *DP,       /* I */
  enum MDependEnum   DType,    /* I */
  char              *Value,    /* I (optional) */
  char              *SValue,   /* I (optional) */
  mbitmap_t         *FlagBM)   /* I */

  {
  mdepend_t *tmpD;
  mdepend_t *NewD;

  const char *FName = "MDAGSetAnd";

  MDB(5,fALL) MLog("%s(DP,%s,%s,%s)\n",
    FName,
    MDependType[DType],
    (Value != NULL) ? Value : "NULL",
    (SValue != NULL) ? SValue : "NULL");

  if ((DP == NULL) ||
      (DP->Array == NULL))
    return(FAILURE);

  tmpD = ((mdepend_t **)DP->Array)[0];

  if (MDAGCreate(DP,&NewD) == FAILURE)
    {
    return(FAILURE);
    }

  if (tmpD != NULL)
    {
    while (tmpD->NextAnd != NULL)
      {
      tmpD = tmpD->NextAnd;
      }

    tmpD->NextAnd = NewD;
    }

  NewD->Type = DType;

  MUStrDup(&NewD->SValue,SValue);
  MUStrDup(&NewD->Value,Value);

  bmcopy(&NewD->BM,FlagBM);

  return(SUCCESS);
  }  /* END MDAGSetAnd() */
开发者ID:dhh1128,项目名称:cbase,代码行数:50,代码来源:MDAG.c


示例18: MUMutexUnlock

int MUMutexUnlock(

  mmutex_t *Mutex)  /* I */

  {
#ifdef MTHREADSAFE
  if (pthread_mutex_unlock(Mutex) != 0)
    {
    MDB(0,fCORE) MLog("ALERT:  cannot unlock mutex!\n");

    return(FAILURE);
    }
#endif /* MTHREADSAFE */

  return(SUCCESS);
  }  /* END MUMutexUnlock() */
开发者ID:dhh1128,项目名称:cbase,代码行数:16,代码来源:MUMutex.c


示例19: MDAGSetOr

int MDAGSetOr(

  marray_t          *DList,
  enum MDependEnum   DType,
  char              *Value,
  char              *SValue)

  {
  mdepend_t *tmpD;
  mdepend_t *NewD;

  const char *FName = "MDAGSetOr";

  MDB(5,fALL) MLog("%s(DList,%s,%s,%s)\n",
    FName,
    MDependType[DType],
    (Value != NULL) ? Value : "NULL",
    (SValue != NULL) ? SValue : "NULL");

  if ((DList == NULL) ||
      (DList->Array == NULL))
    return(FAILURE);

  tmpD = (mdepend_t *)MUArrayListGetPtr(DList,0);

  if (MDAGCreate(DList,&NewD) == FAILURE)
    {
    return(FAILURE);
    }

  if (tmpD != NULL)
    {
    while (tmpD->NextOr != NULL)
      {
      tmpD = tmpD->NextOr;
      }

    tmpD->NextOr = NewD;
    }

  NewD->Type = DType;

  MUStrDup(&NewD->SValue,SValue);
  MUStrDup(&NewD->Value,Value);

  return(SUCCESS);
  }  /* END MDAGSetOr() */
开发者ID:dhh1128,项目名称:cbase,代码行数:47,代码来源:MDAG.c


示例20: MRsvAdjustTime

int MRsvAdjustTime(

  long Delta)  /* I (time change in seconds) */

  {
  rsv_iter RTI;

  int nindex;

  mnode_t *N;
  mrsv_t  *R;
  mre_t   *RE;

  const char *FName = "MRsvAdjustTime";

  MDB(4,fSTRUCT) MLog("%s(%ld)\n",
    FName,
    Delta);

  MRsvIterInit(&RTI);

  while (MRsvTableIterate(&RTI,&R) == SUCCESS)
    {
    R->StartTime = MIN(R->StartTime + Delta,MMAX_TIME);
    R->EndTime   = MIN(R->EndTime + Delta,MMAX_TIME);
    }

  for (nindex = 0;nindex < MSched.M[mxoNode];nindex++)
    {
    N = MNode[nindex];

    if ((N == NULL) || (N->Name[0] == '\0'))
      break;

    if (N->Name[0] == '\1')
      continue;

    for (RE = N->RE;RE != NULL;MREGetNext(RE,&RE))
      {
      RE->Time = MIN(RE->Time + Delta,MMAX_TIME);
      }  /* END for (MREGetNext) */
    }    /* END for (nindex) */

  return(SUCCESS);
  }  /* END MRsvAdjustTime() */
开发者ID:dhh1128,项目名称:cbase,代码行数:45,代码来源:MRsvAdjust.c



注:本文中的MDB函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MDB_CHECKARG函数代码示例发布时间:2022-05-30
下一篇:
C++ MD5_Update函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap