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

C++ MemNew函数代码示例

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

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



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

示例1: ReadPubMedRecords

static void ReadPubMedRecords (LinkSetPtr lsp, FILE *fp)

{
  Int4                  count;
  Int2                  num;
  MedlineEntryPtr PNTR  list;  /* see <objmedli.h> */
  MedlineEntryPtr       mep;

  if (lsp == NULL || lsp->num == 0 || lsp->uids == NULL) return;
  list = (MedlineEntryPtr PNTR) MemNew (lsp->num * sizeof (MedlineEntryPtr));
  if (list != NULL) {

    /* EntrezMedlineEntryListGet get a maximum of 32767 records at once */
    num = EntrezMedlineEntryListGet (list, lsp->num, lsp->uids, FALSE);

    for (count = 0; count < num; count++) {
      mep = list [count];
      if (mep != NULL) {
        /* the following call saves the record in traditional MEDLINE format */
        if (MedlineEntryToDataFile (mep, fp)) {
          fprintf (fp, "\n\n");
        }
      }
    }

    for (count = 0; count < lsp->num; count++) {
      list [count] = MedlineEntryFree (list [count]);
    }
    MemFree (list);
  }
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:31,代码来源:fetchent.c


示例2: SLRI_SSGetWholeString

/* Returns a concatenation of all stack contents */
CharPtr
SLRI_SSGetWholeString(SLRI_SStackPtr ssp)
{
  SLRI_SStackItemPtr ssipCurr = NULL;
  CharPtr wholeString = NULL;

  if (ssp == NULL) {
    ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSGetWholeString: stack pointer is NULL");
    return(NULL);
  }

  if (SLRI_SSIsEmpty(ssp)) {
    return(NULL);
  }

  wholeString = MemNew((ssp->totalStackSize + 1) * sizeof(Char));

  /* Initialize wholeString with first item */
  StringCpy(wholeString, ssp->bottom->string);

  /* Cycle through rest of stack to get remaining items */
  ssipCurr = ssp->bottom->next;
  while (ssipCurr != NULL) {
    StringCat(wholeString, ssipCurr->string);
    ssipCurr = ssipCurr->next;
  }

  return(wholeString);
}
开发者ID:iandonaldson,项目名称:slri,代码行数:30,代码来源:slri_sstack.c


示例3: GetProtListCallback

static void GetProtListCallback (BioseqPtr bsp, Pointer userdata)
{
  ValNodePtr PNTR   pList;
  SeqFeatPtr        sfp;
  SeqMgrFeatContext fcontext;
  ProtRefPtr        prp;
  AlphaProtPtr      app;
  
  if (bsp == NULL || userdata == NULL || ! ISA_aa (bsp->mol)) return;
  pList = (ValNodePtr PNTR) userdata;
  app = (AlphaProtPtr) MemNew (sizeof (AlphaProtData));
  if (app == NULL) return;
  app->bsp = bsp;
  app->prot_name = NULL;
  
  sfp = SeqMgrGetNextFeature (bsp, NULL, SEQFEAT_PROT, 0, &fcontext);
  if (sfp != NULL && sfp->data.value.ptrvalue != NULL) 
  {
    prp = (ProtRefPtr) sfp->data.value.ptrvalue;
    if (prp->name != NULL)
    {
      app->prot_name = StringSave (prp->name->data.ptrvalue);
    }
    else
    {
      app->prot_name = StringSave (fcontext.label);
    }
  }
  ValNodeAddPointer (pList, 0, app);
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:30,代码来源:vsmfile.c


示例4: DustForGraph

extern FloatHiPtr DustForGraph (DustRegionPtr drp, Int4 length,
                                Int4 start, Int4 stop)
{
    DustRegionPtr drphead;
    FloatHiPtr    fhi, fhead;
    Int4          i;

    if (drp == NULL)
        return NULL;
    if (stop > length)
        return NULL;


    drphead = drp;
    if ((fhead = (FloatHiPtr) MemNew ((size_t)((sizeof(FloatHi))*length)))
            == NULL)
        return NULL;

    while (drp != NULL)
    {
        fhi = fhead;
        if (drp->from >= start && drp->from < length && drp->to < length)
        {
            fhi += drp->from;
            for (i = drp->from; i <= drp->to; i++)
            {
                *fhi = drp->percent;
                fhi++;
            }
        }
        drp = drp->next;
    }
    return fhead;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:34,代码来源:urkdust.c


示例5: SLRI_SSPush

/* Pushes a StringStack item onto StringStack */
Int4 
SLRI_SSPush(SLRI_SStackPtr ssp, CharPtr string) 
{
  SLRI_SStackItemPtr newItem = NULL;

  if (ssp == NULL) {
    ErrPostEx(SEV_ERROR, 0, 0, "SLRI_SSPush: stack pointer is NULL");
    return(-1);
  }

  newItem = MemNew(sizeof(SLRI_SStackItem));

  newItem->string = string;
  newItem->prev = ssp->top;
  newItem->next = NULL; 

  if (ssp->top != NULL) {
    ssp->top->next = newItem;
  }

  ssp->top = newItem;
  ssp->totalStackSize += StringLen(newItem->string);
  ssp->totalNumItems++;

  /* If first item, set bottom pointer to top */
  if (ssp->bottom == NULL) {
    ssp->bottom = ssp->top;
  }

  return(0);
}
开发者ID:iandonaldson,项目名称:slri,代码行数:32,代码来源:slri_sstack.c


示例6: PngDecodeImage

bool PngDecodeImage(PngT *png, PixBufT *pixbuf) {
  if (png->ihdr.interlace_method != 0) {
    LOG("Interlaced PNG not supported.");
  } else if (png->ihdr.bit_depth != 8) {
    LOG("Non 8-bit components not supported.");
  } else {
    uint32_t pixelWidth = GetPixelWidth(png);
    uint32_t length = png->ihdr.width * png->ihdr.height * pixelWidth;
    uint32_t dstLength = length + png->ihdr.height;
    uint8_t *encoded = MemNew(dstLength);

    MergeIDATs(png);

    LOG("Uncompressing the image.");

    Inflate(png->idat.data + 2, encoded);

    LOG("Decoding pixels.");

    ReconstructImage(pixbuf->data, encoded,
                     png->ihdr.width, png->ihdr.height, pixelWidth);

    MemUnref(encoded);

    return true;
  }

  return false;
}
开发者ID:cahirwpz,项目名称:demoscene,代码行数:29,代码来源:png.c


示例7: MergeIDATs

/* Collapse multiple IDAT chunks into single one. */
static void MergeIDATs(PngT *png) {
  if (png->idat.next) {
    uint32_t length, i;
    uint8_t *data;
    IdatT *idat;

    for (idat = &png->idat, length = 0; idat; idat = idat->next)
      length += idat->length;

    LOG("Merged chunk length: %d.", length);

    data = MemNew(length);

    for (idat = &png->idat, i = 0; idat;) {
      IdatT *next = idat->next;

      MemCopy(data + i, idat->data, idat->length);
      i += idat->length;

      MemUnref(idat->data);
      if (idat != &png->idat)
        MemUnref(idat);

      idat = next;
    }

    png->idat.data = data;
    png->idat.length = length;
    png->idat.next = NULL;
  }
}
开发者ID:cahirwpz,项目名称:demoscene,代码行数:32,代码来源:png.c


示例8: Nlm_MonitorIntNewEx

NLM_EXTERN MonitorPtr LIBCALL Nlm_MonitorIntNewEx (Nlm_CharPtr title, Nlm_Int4 n1, Nlm_Int4 n2, Nlm_Boolean hasCancelBtn)
{
	AppMsgInfo *info = GetAppMsgInfo();
	Monitor *pMon = (Monitor*) MemNew(sizeof(Monitor));

	if (pMon != NULL)
	{
		MON_SET_MAGIC(pMon);
		pMon->type = MonType_Int;
		pMon->strTitle = title ? StrSave(title) : 0;
		pMon->num1 = n1;
		pMon->num2 = n2;
		pMon->cancel = FALSE;
		pMon->hasCancelBtn = (int) hasCancelBtn;
		if (!(*info->hookMonitor)(pMon,MonCode_Create))
		{
		    MonitorFree(pMon);
		    /* only post an information message here; it is expected
		    	that the hook function would report the real reason
		    	that the monitor creation failed. */
			ErrPostEx(SEV_INFO,0,0,"Unable to create monitor");
			return NULL;
		}
	}
	return pMon;
}
开发者ID:fbtestrepo,项目名称:hw,代码行数:26,代码来源:ncbimsg.c


示例9: SetUp

static XOSPtr SetUp (void)
{
  static GatherScope  gs;
  GatherScopePtr      gsp;
  XOSPtr              xosp;

  gsp = &gs;
  MemSet ((Pointer) gsp, 0, sizeof (GatherScope));
  MemSet ((Pointer) gsp->ignore, (int) (TRUE),
          (size_t) (OBJ_MAX * sizeof (Boolean)));
  gsp->ignore[OBJ_BIOSEQ] = FALSE;

  xosp = MemNew (sizeof (XOS));

  xosp->flagParamWindow = FALSE;
  xosp->gi = 0;
  xosp->filename = NULL;
  xosp->gsp = gsp;
  xosp->sep = NULL;
  xosp->bsp = NULL;

  xosp->pccp = PccDatNew ();

  return xosp;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:25,代码来源:ccpv.c


示例10: SetUp

static XOSPtr SetUp (void)
{
  static GatherScope  gs;
  GatherScopePtr      gsp;
  XOSPtr              xosp;

  gsp = &gs;
  MemSet ((Pointer) gsp, 0, sizeof (GatherScope));
  MemSet ((Pointer) gsp->ignore, (int) (TRUE),
          (size_t) (OBJ_MAX * sizeof (Boolean)));
  gsp->ignore[OBJ_BIOSEQ] = FALSE;

  xosp = MemNew (sizeof (XOS));

  xosp->flagParamWindow = FALSE;
  xosp->gi = 0;
  xosp->filename = NULL;
  xosp->gsp = gsp;
  xosp->sep = NULL;
  xosp->bsp = NULL;
  xosp->xdeltamin = 1;
  xosp->xdeltamax = 64;
  xosp->xdeltaval = 20;
  xosp->ydeltamin = 1;
  xosp->ydeltamax = 64;
  xosp->ydeltaval = 20;
  xosp->treestyle = 0;

  return xosp;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:30,代码来源:cnsrtv.c


示例11: GetGraphsProc

static Boolean GetGraphsProc (GatherObjectPtr gop)

{
  GphGetPtr    ggp;
  GphItemPtr   gip;
  SeqGraphPtr  sgp;

  if (gop == NULL || gop->itemtype != OBJ_SEQGRAPH) return TRUE;
  ggp = (GphGetPtr) gop->userdata;
  sgp = (SeqGraphPtr) gop->dataptr;
  if (ggp == NULL || sgp == NULL) return TRUE;
  /* only phrap or gap4 currently allowed */
  if (StringICmp (sgp->title, "Phrap Quality") == 0 ||
      StringICmp (sgp->title, "Gap4") == 0) {
    /* data type must be bytes */
    if (sgp->flags[2] == 3) {
      if (SeqIdForSameBioseq (SeqLocId (sgp->loc), SeqLocId (ggp->slp))) {
        gip = (GphItemPtr) MemNew (sizeof (GphItem));
        if (gip == NULL) return TRUE;
        gip->sgp = sgp;
        gip->left = GetOffsetInBioseq (sgp->loc, ggp->bsp, SEQLOC_LEFT_END);
        gip->right = GetOffsetInBioseq (sgp->loc, ggp->bsp, SEQLOC_RIGHT_END);
        ValNodeAddPointer (&(ggp->vnp), 0, (Pointer) gip);
      }
    }
  }
  return TRUE;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:28,代码来源:idcleanscan.c


示例12: tax_addNameClass

Boolean tax_addNameClass(Int4 class_cde, CharPtr class_txt, Int4 priority)
{
    Int2 i;

    if(name_class == NULL) {
	name_class= MemNew(sizeof(TaxNameClass)*class_alloced);
	if(name_class == NULL) return FALSE;
	
	for(i= 0; i < class_alloced; i++) {
	    name_class[i].priority= 1000;
	    name_class[i].class_txt[0]= name_class[i].class_txt[33]= '\0';	    
	}
    }
    
    if(class_cde < 0) return FALSE;

    if(class_cde >= class_alloced) {
	TaxNameClassPtr tmp= MemMore(name_class, sizeof(TaxNameClass)*(class_cde + 8));

	if(tmp == NULL) return FALSE;
	
	name_class= tmp;
	for(i= class_alloced; i < class_cde + 8; i++) {
	    name_class[i].priority= 1000;
	    name_class[i].class_txt[0]= name_class[i].class_txt[33]= '\0';	    
	}
	class_alloced= class_cde + 8;
    }

    name_class[class_cde].priority= priority;
    StringNCpy(name_class[class_cde].class_txt, class_txt, 33);

    return TRUE;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:34,代码来源:taxcs.c


示例13: tax_addRank

Boolean tax_addRank(Int2 rank_id, CharPtr rank_txt)
{
    Int2 i;

    rank_id+= d_rank;

    if(tax_rank == NULL) {
	tax_rank= MemNew(sizeof(TaxRank)*rank_alloced);
	if(tax_rank == NULL) return FALSE;
	
	for(i= 0; i < rank_alloced; i++) {
	    tax_rank[i].rank_txt[0]= tax_rank[i].rank_txt[63]= '\0';	    
	}
    }
    
    if(rank_id < 0) return FALSE;

    if(rank_id >= rank_alloced) {
	TaxRankPtr tmp= MemMore(tax_rank, sizeof(TaxRank)*(rank_id + 8));

	if(tmp == NULL) return FALSE;
	
	tax_rank= tmp;
	for(i= rank_alloced; i < rank_id + 8; i++) {
	    tax_rank[i].rank_txt[0]= tax_rank[i].rank_txt[63]= '\0';	    
	}
	rank_alloced= rank_id + 8;
    }

    StringNCpy(tax_rank[rank_id].rank_txt, rank_txt, 63);

    return TRUE;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:33,代码来源:taxcs.c


示例14: SeqEntryToFeat

static void SeqEntryToFeat (SeqEntryPtr sep, FILE *fp)

{
  AsnExpOptPtr  aeop;
  AsnIoPtr      aip;
  ExpStructPtr  esp;

  if (sep != NULL && fp != NULL) {
    esp = MemNew (sizeof (ExpStruct));
    if (esp != NULL) {
      aip = AsnIoNullOpen ();
      if (aip != NULL) {
        esp->fp = fp;
        esp->aip = AsnIoNew (ASNIO_TEXT_OUT, fp, NULL, NULL, NULL);
        esp->is_na = is_na;
        esp->feat = 3;  /* look for CdRegion SeqFeat */
        aeop = AsnExpOptNew (aip, "Seq-feat", (Pointer) esp, GetSeqFeat);
        if (aeop != NULL) {
          SeqEntryAsnWrite (sep, aip, NULL);
          fflush (fp);
          AsnExpOptFree (aip, aeop);
        }
        AsnIoClose (aip);
      }
      MemFree (esp);
    }
  }
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:28,代码来源:cdscan.c


示例15: FileListNew

/*****************************************************************************
*
*   Add a new file list element
*
*****************************************************************************/
static FileListPtr FileListNew (FileListPtr flp, Int2 cdnum,
                                CharPtr fdir, CharPtr fname)

{
  FileListPtr  newnode;

  newnode = (FileListPtr) MemNew (sizeof (FileList));
  if (newnode != NULL) {
    if (flp != NULL) {
      while (flp->next != NULL && flp->next->cdnum <= cdnum) {
        flp = flp->next;
      }
      newnode->next = flp->next;
      flp->next = newnode;
    }
    newnode->cdnum = cdnum;
    if (fdir != NULL && *fdir != '\0') {
      newnode->fdir = StringSave (fdir);
    }
    if (fname != NULL && *fname != '\0') {
      newnode->fname = StringSave (fname);
    }
  }
  return newnode;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:30,代码来源:cdscan.c


示例16: if

static NIOptions* s_GetNIOptions
(const Char *conf_file, const Char *conf_section)
{
  static TNlmTls s_NIOptionsTLS;

  NIOptions *nio;
  Char       conn_mode[64];

  if (NlmTlsGetValue(s_NIOptionsTLS, (VoidPtr *)&nio)
      &&  nio  &&  nio->interface != eNII_Default)
    return nio;

  if ( !nio )
    nio = (NIOptions *)MemNew(sizeof(NIOptions));

  NI_GetEnvParam(conf_file, conf_section, ENV_CONN_MODE,
                 conn_mode, sizeof(conn_mode), "");
  if (StringICmp(conn_mode, SERVICE_MODE) == 0)
    nio->interface = eNII_Service;
  else if (StringICmp(conn_mode, DEBUG_MODE) == 0)
    nio->interface = eNII_Debug;
  else
    nio->interface = NII_DEFAULT;

  if ( !NI_IsInterfaceSupported(nio->interface) )
    nio->interface = NII_DEFAULT;
  ASSERT ( NI_IsInterfaceSupported(nio->interface) );

  NlmTlsSetValue(&s_NIOptionsTLS, (VoidPtr)nio, s_NIOptionsTLS_Cleanup);
  return nio;
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:31,代码来源:ni_lib_.c


示例17: NewInstance

DistortionMapT *NewDistortionMap(size_t width, size_t height,
                                 DistortionMapTypeT type,
                                 size_t textureW, size_t textureH)
{
  DistortionMapT *map = NewInstance(DistortionMapT);
  size_t size = 0;

  switch (type) {
    case DMAP_OPTIMIZED:
      size = sizeof(uint16_t);
      break;
    case DMAP_ACCURATE:
      size = sizeof(UV16T);
      break;
  }

  map->map = MemNew(size * width * height);
  map->type = type;
  map->width = width;
  map->height = height;
  map->textureW = textureW;
  map->textureH = textureH;

  return map;
}
开发者ID:hilander,项目名称:demoscene,代码行数:25,代码来源:common.c


示例18: MakeFetchItemIndex

static void MakeFetchItemIndex(ValNodePtr fetch_list)
{
  Int4 num;
  ValNodePtr tmp_list = NULL, prev = NULL, vnp, vnp_new;

  if (sFetchIndex != NULL) {
    sFetchIndex = MemFree (sFetchIndex);
    sFetchIndexSize = 0;
  }

  if (fetch_list == NULL) {
    return;
  }

  tmp_list = ValNodeNew (NULL);
  tmp_list->data.ptrvalue = fetch_list->data.ptrvalue;
  prev = tmp_list;
  for (vnp = fetch_list->next; vnp != NULL; vnp = vnp->next) {
    vnp_new = ValNodeNew (prev);
    vnp_new->data.ptrvalue = vnp->data.ptrvalue;
    prev = vnp_new;
  }

  tmp_list = ValNodeSort (tmp_list, SortVnpByFetchItem);
  sFetchIndexSize = ValNodeLen (tmp_list);
  sFetchIndex = (FetchItemPtr PNTR) MemNew (sizeof (FetchItemPtr) * sFetchIndexSize);
  for (vnp = tmp_list, num = 0; vnp != NULL; vnp = vnp->next, num++) {
    sFetchIndex[num] = vnp->data.ptrvalue;
  }
  tmp_list = ValNodeFree (tmp_list);
}
开发者ID:hsptools,项目名称:hsp-wrap,代码行数:31,代码来源:tbl_chk.c


示例19: FillCSANWithStru

static Int4  FillCSANWithStru(PCSAN pcsanThis, PMMD pmmdThis, Int4 iLen)
{
     Int4 iCount = 0;
     CharPtr pcA;
     PDNMG pdnmgThis = NULL;
     PMGD pmgdThis = NULL;


     if (!pcsanThis) return 0;
     if (!pmmdThis) return 0;
     if (!IsProtein(pmmdThis)) return 0;
     if (!iLen) return 0;

     pcsanThis->pcSeqAln = (CharPtr)MemNew((size_t) (1+ sizeof(char) * iLen));
     pcA = pcsanThis->pcSeqAln;
     pdnmgThis = pmmdThis->pdnmgHead;
     iCount = 0;
     while ((pdnmgThis != NULL)  && (iCount < iLen))
      {
            iCount++;
            pmgdThis = (PMGD) pdnmgThis->data.ptrvalue;
            *pcA = (char) pmgdThis->pcIUPAC[0] ;
            pcA++;
            pdnmgThis = pdnmgThis->next;
      }
     while (iCount < iLen)
       {
            *pcA = '-';
            pcA++;
            iCount++;
       }
    pcsanThis->pcSeqAln[iLen] = '\0';
    return iCount;
}
开发者ID:iandonaldson,项目名称:slri,代码行数:34,代码来源:csan.c


示例20: NewCSAN

PCSAN LIBCALL NewCSAN(void)
{
   PCSAN pcsanThis = NULL;

   pcsanThis = (PCSAN) MemNew((size_t)sizeof(CSAN));
   return pcsanThis;
}
开发者ID:iandonaldson,项目名称:slri,代码行数:7,代码来源:csan.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ MemRead32函数代码示例发布时间:2022-05-30
下一篇:
C++ MemMove函数代码示例发布时间: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