本文整理汇总了C++中AlcFree函数的典型用法代码示例。如果您正苦于以下问题:C++ AlcFree函数的具体用法?C++ AlcFree怎么用?C++ AlcFree使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AlcFree函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RecSecFree
/*!
* \ingroup Reconstruct
* \brief Free's the given section.
* \param sec Section to free.
*/
void RecSecFree(RecSection *sec)
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_FN|REC_DBG_LVL_1),
("RecSecFree FE 0x%lx\n",
(unsigned long )sec));
if(sec)
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_3),
("RecSecFree 01 %d\n",
sec->linkcount));
if(--(sec->linkcount) <= 0)
{
if(sec->imageFile)
{
AlcFree(sec->imageFile);
}
if(sec->transform)
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_3),
("RecSecFree 02 %d\n",
sec->transform->linkcount));
(void )WlzFreeAffineTransform(sec->transform);
}
if(sec->obj)
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_3),
("RecSecFree 03 %d\n",
sec->obj->linkcount));
(void )WlzFreeObj(sec->obj);
}
if(sec->transObj)
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_3),
("RecSecFree 04 %d\n",
sec->transObj->linkcount));
(void )WlzFreeObj(sec->transObj);
}
if(sec->cumTransform)
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_3),
("RecSecFree 05 %d\n",
sec->cumTransform->linkcount));
(void )WlzFreeAffineTransform(sec->cumTransform);
}
if(sec->cumTransObj && (sec->cumTransObj->linkcount > 0))
{
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_3),
("RecSecFree 05 %d\n",
sec->cumTransObj->linkcount));
(void )WlzFreeObj(sec->cumTransObj);
}
AlcFree(sec);
}
}
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_FN|REC_DBG_LVL_1),
("RecSecFree FX\n"));
}
示例2: WlzDistMetricDirGM
/*!
* \return Woolz error code.
* \ingroup WlzFeatures
* \brief Computes any combination of the directed Hausdorff, mean
* nearest neighbour, median nearest neighbour and minimum
* nearest neighbour distances
* between the vertices of the given geometric models.
* See WlzDistMetricDirVertex2D() for details of the metrics.
* \param model0 First geometric model.
* \param model1 Second geometric model.
* \param dstDistH Destination pointer for the directed
* Hausdorff distance, may be NULL.
* \param dstDistM Destination pointer for the directed
* mean nearest neighbour distance, may
* be NULL.
* \param dstDistN Destination pointer for the directed
* median nearest neighbour distance, may
* be NULL.
* \param dstDistI Destination pointer for the minimum
* nearest neighbour distance, may
* be NULL.
*/
WlzErrorNum WlzDistMetricDirGM(WlzGMModel *model0, WlzGMModel *model1,
double *dstDistH, double *dstDistM,
double *dstDistN, double *dstDistI)
{
int nV[2];
WlzVertexP vP[2];
WlzVertexType vType[2];
WlzErrorNum errNum = WLZ_ERR_NONE;
vP[0].v = vP[1].v = NULL;
if((model0 == NULL) || (model1 == NULL))
{
errNum = WLZ_ERR_DOMAIN_NULL;
}
else if(model0->type != model1->type)
{
errNum = WLZ_ERR_DOMAIN_TYPE;
}
else
{
vP[0] = WlzVerticesFromGM(model0, NULL, NULL, nV + 0, vType + 0, &errNum);
}
if(errNum == WLZ_ERR_NONE)
{
vP[1] = WlzVerticesFromGM(model1, NULL, NULL, nV + 1, vType + 1, &errNum);
}
if(errNum == WLZ_ERR_NONE)
{
if(vType[0] != vType[1])
{
errNum = WLZ_ERR_DOMAIN_TYPE;
}
}
if(errNum == WLZ_ERR_NONE)
{
switch(vType[0])
{
case WLZ_VERTEX_D2:
errNum = WlzDistMetricDirVertex2D(nV[0], vP[0].d2, nV[1], vP[1].d2,
dstDistH, dstDistM, dstDistN,
dstDistI);
break;
case WLZ_VERTEX_D3:
errNum = WlzDistMetricDirVertex3D(nV[0], vP[0].d3, nV[1], vP[1].d3,
dstDistH, dstDistM, dstDistN,
dstDistI);
break;
default:
errNum = WLZ_ERR_DOMAIN_DATA;
break;
}
}
AlcFree(vP[0].v);
AlcFree(vP[1].v);
return(errNum);
}
示例3: AlcPtr3Calloc
/*!
* \return Error code.
* \ingroup AlcArray
* \brief Allocates a 3 dimensional array of pointers to void.
* \note Should be free'd using Alc3Free().
* \note Array size is limited only by address space.
* \param dest Destination for allocated array
* pointer.
* \param mElem Number of 2D arrays.
* \param nElem Number of 1D arrays.
* \param oElem Number of elements in each 1D
* array.
*/
AlcErrno AlcPtr3Calloc(void *****dest, size_t mElem, size_t nElem,
size_t oElem)
{
size_t index0,
index1;
void **dump0 = NULL,
***dump1 = NULL,
****dump2 = NULL;
AlcErrno alcErrno = ALC_ER_NONE;
if((dest) == NULL)
{
alcErrno = ALC_ER_NULLPTR;
}
else if((mElem < 1) || (nElem < 1) || (oElem < 1))
{
alcErrno = ALC_ER_NUMELEM;
}
else if(((dump0 = (void **)AlcCalloc(mElem * nElem * oElem,
sizeof(void *))) == NULL) ||
((dump1 = (void ***)AlcMalloc(mElem * nElem *
sizeof(void **))) == NULL) ||
((dump2 = (void ****)AlcMalloc(mElem * sizeof(void ***))) == NULL))
{
alcErrno = ALC_ER_ALLOC;
}
if(alcErrno == ALC_ER_NONE)
{
*(dest) = dump2;
for(index0 = 0; index0 < mElem; ++index0)
{
for(index1=0; index1 < nElem; ++index1)
{
dump1[index1] = dump0;
dump0 += oElem;
}
(*(dest))[index0] = dump1;
dump1 += nElem;
}
}
else
{
if(dest)
{
*(dest) = NULL;
}
AlcFree(dump2);
AlcFree(dump1);
AlcFree(dump0);
}
return(alcErrno);
}
示例4: WlzBoundaryToPolyObjArray
/*!
* \return Woolz error code.
* \ingroup WlzBoundary
* \brief decomposes a boundary into it's component polygons.
* \param bndObj Given boundary.
* \param dstNumObjs Destination pointer for the number of polygons.
* \param dstObjArray Destination pointer for the array of polygons.
*/
WlzErrorNum WlzBoundaryToPolyObjArray(
WlzObject *bndObj,
int *dstNumObjs,
WlzObject ***dstObjArray)
{
WlzErrorNum errNum=WLZ_ERR_NONE;
WlzDomain domain;
WlzValues values;
WlzObject *obj, **objs;
WlzPolygonDomain **polyArray;
int i, numPolys;
/* check inputs */
if( bndObj == NULL ){
errNum = WLZ_ERR_OBJECT_NULL;
}
else if((dstNumObjs == NULL) || (dstObjArray == NULL)){
errNum = WLZ_ERR_PARAM_NULL;
}
else {
/* generate array of poly domains */
errNum = WlzBoundObjToPolyDomArray(bndObj, &numPolys, &polyArray);
}
/* convert to polygon objects */
if( errNum == WLZ_ERR_NONE ){
if((objs = (WlzObject **) AlcMalloc(sizeof(WlzObject *)*numPolys)) == NULL){
errNum = WLZ_ERR_MEM_ALLOC;
for(i=0; i < numPolys; i++){
WlzFreePolyDmn(polyArray[i]);
}
AlcFree(polyArray);
numPolys = 0;
}
else {
for(i=0; i < numPolys; i++){
domain.poly = polyArray[i];
values.core = NULL;
obj = WlzMakeMain(WLZ_2D_POLYGON, domain, values,
NULL, NULL, &errNum);
objs[i] = WlzAssignObject(obj, NULL);
WlzFreePolyDmn(polyArray[i]);
}
AlcFree(polyArray);
}
}
*dstNumObjs = numPolys;
*dstObjArray = objs;
return errNum;
}
示例5: HGU_XmFileListItemFree
void HGU_XmFileListItemFree(
void *entry)
{
HGU_XmFileListCallbackStruct *cbs;
if( entry ){
cbs = (HGU_XmFileListCallbackStruct *) entry;
if( cbs->file ){
AlcFree(cbs->file);
}
AlcFree(cbs);
}
return;
}
示例6: HGU_XmFileListWriteHeader
void HGU_XmFileListWriteHeader(
FILE *fp)
{
BibFileRecord *bibfileRecord;
time_t tmpTime;
char *tmpS, tmpBuf[256];
char *dateS = NULL;
char *hostS = NULL;
char *userS = NULL;
static char unknownS[] = "unknown";
/* write some sort of identifier */
bibfileRecord =
BibFileRecordMake("Ident", "0",
BibFileFieldMakeVa("Text",
"HGU_Xm Image File List",
"Version", "1.0",
NULL));
BibFileRecordWrite(fp, NULL, bibfileRecord);
BibFileRecordFree(&bibfileRecord);
/* now a comment with user, machine, date etc. */
tmpS = getenv("USER");
(void )sprintf(tmpBuf, "User: %s", tmpS?tmpS:unknownS);
userS = AlcStrDup(tmpBuf);
tmpTime = time(NULL);
tmpS = ctime(&tmpTime);
*(tmpS + strlen(tmpS) - 1) = '\0';
(void )sprintf(tmpBuf, "Date: %s", tmpS?tmpS:unknownS);
dateS = AlcStrDup(tmpBuf);
tmpS = getenv("HOST");
(void )sprintf(tmpBuf, "Host: %s", tmpS?tmpS:unknownS);
hostS = AlcStrDup(tmpBuf);
bibfileRecord =
BibFileRecordMake("Comment", "0",
BibFileFieldMakeVa("Text", userS,
"Text", dateS,
"Text", hostS,
NULL));
BibFileRecordWrite(fp, NULL, bibfileRecord);
BibFileRecordFree(&bibfileRecord);
AlcFree(userS);
AlcFree(dateS);
AlcFree(hostS);
return;
}
示例7: WlzGreyValueFreeWSp
/*!
* \return void
* \ingroup WlzAccess
* \brief Free's the given grey value work space created by
* WlzGreyValueMakeWSp().
* \param gVWSp Given grey value work space.
*/
void WlzGreyValueFreeWSp(WlzGreyValueWSpace *gVWSp)
{
WLZ_DBG((WLZ_DBG_LVL_1),
("WlzGreyValueFreeWSp FE %p\n",
gVWSp));
if(gVWSp)
{
(void )WlzFreeAffineTransform(gVWSp->invTrans);
AlcFree((void *)(gVWSp->gTabTypes3D));
AlcFree(gVWSp);
}
WLZ_DBG((WLZ_DBG_LVL_FN|WLZ_DBG_LVL_1),
("WlzGreyValueFreeWSp FX\n"));
}
示例8: WlzEffAmFreeHead
/*!
* \return <void>
* \ingroup WlzExtFF
* \brief Free's entries in the Amira file header data structure
* before freeing the header data structure itself.
* \param head The given file header data structure.
*/
static void WlzEffAmFreeHead(WlzEffAmHead *head)
{
WlzEffAmMaterial *e0;
AlcFree(head->imageData);
if(head)
{
e0 = head->materials;
while(e0)
{
AlcFree(e0->name);
e0 = e0->next;
}
}
}
示例9: AlcPtr2Malloc
/*!
* \return Error code.
* \ingroup AlcArray
* \brief Allocates a 2 dimensional non-zero'd array of pointers
* to void.
* \note Should be free'd using Alc2Free().
* \note Array size is limited only by address space.
* \param dest Destination for allocated array
* pointer.
* \param mElem Number of 1D arrays.
* \param nElem Number of elements in each 1D
* array.
*/
AlcErrno AlcPtr2Malloc(void ****dest, size_t mElem, size_t nElem)
{
size_t index;
void **dump0 = NULL;
void ***dump1 = NULL;
AlcErrno alcErrno = ALC_ER_NONE;
/* Template doesn't work for pointer types. */
if(dest == NULL)
{
alcErrno = ALC_ER_NULLPTR;
}
else if((mElem < 1) || (nElem < 1))
{
alcErrno = ALC_ER_NUMELEM;
}
else if(((dump0 = (void **)AlcMalloc(mElem * nElem *
sizeof(void *))) == NULL) ||
((dump1 = (void ***)AlcMalloc(mElem * sizeof(void **))) == NULL))
{
alcErrno = ALC_ER_ALLOC;
}
if(alcErrno == ALC_ER_NONE)
{
*dest = dump1;
for(index = 0; index < mElem; ++index)
{
(*dest)[index] = dump0;
dump0 += nElem;
}
}
else
{
if(dest)
{
*dest = NULL;
}
if(dump0)
{
AlcFree(dump0);
}
if(dump1)
{
AlcFree(dump1);
}
}
return(alcErrno);
}
示例10: WlzFreeContour
/*!
* \ingroup WlzAllocation
* \brief Free's a WlzContour data structure.
*
* \return Error number, values: WLZ_ERR_NONE, WLZ_ERR_DOMAIN_NULL, WLZ_ERR_DOMAIN_TYPE and from WlzUnlink().
* \param ctr Contour to be freed.
* \par Source:
* WlzFreeSpace.c
*/
WlzErrorNum WlzFreeContour(WlzContour *ctr)
{
WlzErrorNum errNum = WLZ_ERR_NONE;
if(ctr == NULL)
{
errNum = WLZ_ERR_DOMAIN_NULL;
}
else if(ctr->type != WLZ_CONTOUR)
{
errNum = WLZ_ERR_DOMAIN_TYPE;
}
else
{
if(WlzUnlink(&(ctr->linkcount), &errNum))
{
if(ctr->model && WlzUnlink(&(ctr->model->linkcount), &errNum))
{
(void )WlzGMModelFree(ctr->model);
}
AlcFree((void *)ctr);
}
}
return(errNum);
}
示例11: WlzFreeValues
/*!
* \ingroup WlzAllocation
* \brief Free a values structure, currently only WlzRagRValues
and WlzRectValues DO NOT call this function with any
other values structure types!
*
* \return Error number, values: WLZ_ERR_NONE, WLZ_ERR_VALUES_DATA.
* \param values Values union to be freed.
* \par Source:
* WlzFreeSpace.c
*/
WlzErrorNum WlzFreeValues(WlzValues values)
{
WlzErrorNum errNum = WLZ_ERR_NONE;
/* check the object pointer and linkcount */
if (values.v == NULL){
return( WLZ_ERR_NONE );
}
if( WlzUnlink(&(values.v->linkcount), &errNum) ){
/* if there is a freeptr then free it */
if (values.v->freeptr != NULL){
/* it is illegal for a table to point to itself */
if( values.v->original_table.v != NULL ){
return( WLZ_ERR_VALUES_DATA );
}
(void )AlcFreeStackFree(values.v->freeptr);
}
if( values.v->original_table.v ){
errNum = WlzFreeValues( values.v->original_table );
}
AlcFree((void *) values.v);
}
return( errNum );
}
示例12: WlzRsvFilterFreeFilter
/*!
* \return void
* \ingroup WlzValueFilters
* \brief Free a recursive filter.
* \param ftr Filter to free.
*/
void WlzRsvFilterFreeFilter(WlzRsvFilter *ftr)
{
if(ftr != NULL)
{
AlcFree(ftr);
}
}
示例13: REC_DBG
/*!
* \return New registration section.
* \ingroup Reconstruct
* \brief Makes a registration section using the given member values.
* \param index Section index.
* \param iterations Number of iterations to find
* section transform.
* \param correlation Section correlation value.
* \param imageFile Image file path, this is duplicated
* so that the original may be freed
* The image file path must not be NULL.
* \param transform Section transform, if NULL an identity
* transform is created.
* \param obj Woolz object corresponding to the given
* image file. This may be NULL without
* causing the object to be read from the
* associated file.
*/
RecSection *RecSecMake(int index, int iterations, double correlation,
char *imageFile,
WlzAffineTransform *transform, WlzObject *obj)
{
RecSection *sec = NULL;
char *newImageFile = NULL;
WlzAffineTransform *newTransform = NULL;
WlzErrorNum wlzErr = WLZ_ERR_NONE;
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_FN|REC_DBG_LVL_1),
("RecSecMake FE %d %d %g 0x%lx 0x%lx 0x%lx\n",
index, iterations, correlation,
(unsigned long )imageFile, (unsigned long )transform,
(unsigned long )obj));
if(imageFile)
{
newImageFile = AlcStrDup(imageFile);
}
if(newImageFile && (transform == NULL))
{
newTransform = WlzAffineTransformFromPrimVal(WLZ_TRANSFORM_2D_AFFINE,
0.0, 0.0, 0.0,
1.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0, &wlzErr);
}
if(newImageFile && (newTransform || transform) && (wlzErr == WLZ_ERR_NONE))
{
sec = (RecSection *)AlcMalloc(sizeof(RecSection));
}
if(sec == NULL)
{
if(newImageFile)
{
AlcFree(newImageFile);
}
if(newTransform)
{
WlzFreeAffineTransform(newTransform);
}
}
else
{
sec->linkcount = 0;
sec->index = index;
sec->iterations = iterations;
sec->correl = correlation;
sec->obj = WlzAssignObject(obj, NULL);
sec->imageFile = newImageFile;
sec->transform = WlzAssignAffineTransform(transform? transform:
newTransform, NULL);
sec->transObj = NULL;
sec->cumTransform = NULL;
sec->cumTransObj = NULL;
}
REC_DBG((REC_DBG_SEC|REC_DBG_LVL_FN|REC_DBG_LVL_1),
("RecSecMake FX 0x%lx\n",
(unsigned long )sec));
return(sec);
}
示例14: WlzJavaArray1DFree
/************************************************************************
* Function: WlzJavaArray1DFree
* Returns: void
* Purpose: Free's a temporary native 1D array.
* Global refs: -
* Parameters: void *aDat: Array data structure.
* int aSz: Array size.
* int dSKey: Data structure identification.
* jboolean isCpy: Copy flag for JNI functions.
************************************************************************/
void WlzJavaArray1DFree(void *aDat, int aSz,
int dSKey, jboolean isCpy)
{
if(isCpy && aDat && (aSz > 0))
{
AlcFree(aDat);
}
}
示例15: freechain
static int freechain(WlzLLink *l)
{
if (l != NULL) {
freechain(l->l_link);
AlcFree((char *) l);
}
return( 0 );
}