Loading...
Searching...
No Matches
LeftvHelper Class Reference

This class implements some recurrent code sniplets to be used with `leftv` and `idhdl.implements` a reference counter which we can use. More...

`#include <countedref.h>`

## Static Public Member Functions

static leftv | idify (leftv head, idhdl *root)
static idhdl | newid (leftv head, idhdl *root)
static void | clearid (idhdl handle, idhdl *root)
template<class Type>
static Type * | cpy (Type *result, Type *data)
template<class Type>
static Type * | cpy (Type *data)
template<class Type>
static Type * | recursivecpy (Type *data)
template<class Type>
static Type * | shallowcpy (Type *result, Type *data)
template<class Type>
static Type * | shallowcpy (Type *data)
template<class Type>
static void | recursivekill (Type *current)
static leftv | allocate ()

## Detailed Description

This class implements some recurrent code sniplets to be used with `leftv` and `idhdl.implements` a reference counter which we can use.

Definition at line 213 of file countedref.h.

## Member Function Documentation

## allocate()

leftv LeftvHelper::allocate | ( |  | ) |

inline static

Definition at line 273 of file countedref.h.

{ return (leftv)omAlloc0(sizeof(sleftv)); }
omAlloc0
#define omAlloc0(size)
Definition omAllocDecl.h:211
leftv
sleftv * leftv
Definition structs.h:53

## clearid()

void LeftvHelper::clearid | ( | idhdl | handle,
|  | idhdl * | root )

inline static

Definition at line 237 of file countedref.h.

{
IDDATA(handle)=NULL;
IDTYP(handle)=NONE;
killhdl2(handle, root, NULL);
}
killhdl2
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition ipid.cc:445
IDDATA
#define IDDATA(a)
Definition ipid.h:126
IDTYP
#define IDTYP(a)
Definition ipid.h:119
NULL
#define NULL
Definition omList.c:12
NONE
#define NONE
Definition tok.h:223

## cpy() [1/2]

template<class Type>

Type * LeftvHelper::cpy | ( | Type * | data | ) |

inline static

Definition at line 248 of file countedref.h.

{
return cpy((Type*)omAlloc0(sizeof(Type)), data);
}
LeftvHelper::cpy
static Type * cpy(Type *result, Type *data)
Definition countedref.h:244

## cpy() [2/2]

template<class Type>

Type * LeftvHelper::cpy | ( | Type * | result,
|  | Type * | data )

inline static

Definition at line 244 of file countedref.h.

{
return (Type*)memcpy(result, data, sizeof(Type));
}
result
return result
Definition facAbsBiFact.cc:76

## idify()

leftv LeftvHelper::idify | ( | leftv | head,
|  | idhdl * | root )

inline static

Definition at line 215 of file countedref.h.

{
idhdl handle = newid(head, root);
leftv res = (leftv)omAlloc0(sizeof(*res));
res->data =(void*) handle;
res->rtyp = IDHDL;
return res;
}
head
CanonicalForm head(const CanonicalForm &f)
Definition canonicalform.h:360
LeftvHelper::newid
static idhdl newid(leftv head, idhdl *root)
Definition countedref.h:223
res
CanonicalForm res
Definition facAbsFact.cc:60
idhdl
idrec * idhdl
Definition ring.h:22
IDHDL
#define IDHDL
Definition tok.h:31

## newid()

idhdl LeftvHelper::newid | ( | leftv | head,
|  | idhdl * | root )

inline static

Definition at line 223 of file countedref.h.

{
STATIC_VAR unsigned int counter = 0;
char* name = (char*) omAlloc0(512);
sprintf(name, " :%u:%p:_shared_: ", ++counter, head->data);
if ((*root) == NULL )
enterid(name, 0, head->rtyp, root, TRUE, FALSE);
else
*root = (*root)->set(name, 0, head->rtyp, TRUE);
IDDATA(*root) = (char*) head->data;
return *root;
}
TRUE
#define TRUE
Definition auxiliary.h:101
FALSE
#define FALSE
Definition auxiliary.h:97
idrec::set
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition ipid.cc:237
name
char name(const Variable &v)
Definition factory.h:189
STATIC_VAR
#define STATIC_VAR
Definition globaldefs.h:7
enterid
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition ipid.cc:279

## recursivecpy()

template<class Type>

Type * LeftvHelper::recursivecpy | ( | Type * | data | ) |

inline static

Definition at line 252 of file countedref.h.

{
if (data == NULL) return data;
Type* result = cpy(data);
result->next = recursivecpy(data->next);
return result;
}
LeftvHelper::recursivecpy
static Type * recursivecpy(Type *data)
Definition countedref.h:252

## recursivekill()

template<class Type>

void LeftvHelper::recursivekill | ( | Type * | current | ) |

inline static

Definition at line 268 of file countedref.h.

{
if(current == NULL) return;
recursivekill(current->next);
omFree(current);
}
LeftvHelper::recursivekill
static void recursivekill(Type *current)
Definition countedref.h:268
omFree
#define omFree(addr)
Definition omAllocDecl.h:261

## shallowcpy() [1/2]

template<class Type>

Type * LeftvHelper::shallowcpy | ( | Type * | data | ) |

inline static

Definition at line 264 of file countedref.h.

{
return shallowcpy((Type*) omAlloc0(sizeof(Type)), data);
}
LeftvHelper::shallowcpy
static Type * shallowcpy(Type *result, Type *data)
Definition countedref.h:259

## shallowcpy() [2/2]

template<class Type>

Type * LeftvHelper::shallowcpy | ( | Type * | result,
|  | Type * | data )

inline static

Definition at line 259 of file countedref.h.

{
cpy(result, data)->e = recursivecpy(data->e);
return result;
}

The documentation for this class was generated from the following file:

- Singular/countedref.h