All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Static Public Member Functions
LeftvHelper Class Reference

This class implements some recurrent code sniplets to be used with leftv and idhdl.implements a refernce 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 refernce counter which we can use.

Definition at line 213 of file countedref.h.

Member Function Documentation

static leftv LeftvHelper::allocate ( )
inlinestatic

Definition at line 273 of file countedref.h.

273 { return (leftv)omAlloc0(sizeof(sleftv)); }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static void LeftvHelper::clearid ( idhdl  handle,
idhdl root 
)
inlinestatic

Definition at line 237 of file countedref.h.

237  {
238  IDDATA(handle)=NULL;
239  IDTYP(handle)=NONE;
240  killhdl2(handle, root, NULL);
241  }
#define IDTYP(a)
Definition: ipid.h:116
void killhdl2(idhdl h, idhdl *ih, ring r)
Definition: ipid.cc:403
#define NULL
Definition: omList.c:10
#define IDDATA(a)
Definition: ipid.h:123
#define NONE
Definition: tok.h:216
template<class Type >
static Type* LeftvHelper::cpy ( Type *  result,
Type *  data 
)
inlinestatic

Definition at line 244 of file countedref.h.

244  {
245  return (Type*)memcpy(result, data, sizeof(Type));
246  }
return result
Definition: facAbsBiFact.cc:76
template<class Type >
static Type* LeftvHelper::cpy ( Type *  data)
inlinestatic

Definition at line 248 of file countedref.h.

248  {
249  return cpy((Type*)omAlloc0(sizeof(Type)), data);
250  }
static Type * cpy(Type *result, Type *data)
Definition: countedref.h:244
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static leftv LeftvHelper::idify ( leftv  head,
idhdl root 
)
inlinestatic

Definition at line 215 of file countedref.h.

215  {
216  idhdl handle = newid(head, root);
217  leftv res = (leftv)omAlloc0(sizeof(*res));
218  res->data =(void*) handle;
219  res->rtyp = IDHDL;
220  return res;
221  }
Class used for (list of) interpreter objects.
Definition: subexpr.h:84
sleftv * leftv
Definition: structs.h:60
Definition: idrec.h:34
#define IDHDL
Definition: tok.h:31
void * data
Definition: subexpr.h:90
poly res
Definition: myNF.cc:322
int rtyp
Definition: subexpr.h:93
static idhdl newid(leftv head, idhdl *root)
Definition: countedref.h:223
#define omAlloc0(size)
Definition: omAllocDecl.h:211
static idhdl LeftvHelper::newid ( leftv  head,
idhdl root 
)
inlinestatic

Definition at line 223 of file countedref.h.

223  {
224 
225  static unsigned int counter = 0;
226  char* name = (char*) omAlloc0(512);
227  sprintf(name, " :%u:%p:_shared_: ", ++counter, head->data);
228  if ((*root) == NULL )
229  enterid(name, 0, head->rtyp, root, TRUE, FALSE);
230  else
231  *root = (*root)->set(name, 0, head->rtyp, TRUE);
232 
233  IDDATA(*root) = (char*) head->data;
234  return *root;
235  }
#define FALSE
Definition: auxiliary.h:97
#define TRUE
Definition: auxiliary.h:101
void * data
Definition: subexpr.h:90
idhdl enterid(const char *s, int lev, int t, idhdl *root, BOOLEAN init, BOOLEAN search)
Definition: ipid.cc:259
char name(const Variable &v)
Definition: factory.h:178
#define NULL
Definition: omList.c:10
int rtyp
Definition: subexpr.h:93
#define IDDATA(a)
Definition: ipid.h:123
idhdl set(const char *s, int lev, int t, BOOLEAN init=TRUE)
Definition: ipid.cc:218
#define omAlloc0(size)
Definition: omAllocDecl.h:211
template<class Type >
static Type* LeftvHelper::recursivecpy ( Type *  data)
inlinestatic

Definition at line 252 of file countedref.h.

252  {
253  if (data == NULL) return data;
254  Type* result = cpy(data);
255  result->next = recursivecpy(data->next);
256  return result;
257  }
#define NULL
Definition: omList.c:10
static Type * cpy(Type *result, Type *data)
Definition: countedref.h:244
static Type * recursivecpy(Type *data)
Definition: countedref.h:252
return result
Definition: facAbsBiFact.cc:76
template<class Type >
static void LeftvHelper::recursivekill ( Type *  current)
inlinestatic

Definition at line 268 of file countedref.h.

268  {
269  if(current == NULL) return;
270  recursivekill(current->next);
271  omFree(current);
272  }
#define omFree(addr)
Definition: omAllocDecl.h:261
static void recursivekill(Type *current)
Definition: countedref.h:268
#define NULL
Definition: omList.c:10
template<class Type >
static Type* LeftvHelper::shallowcpy ( Type *  result,
Type *  data 
)
inlinestatic

Definition at line 259 of file countedref.h.

259  {
260  cpy(result, data)->e = recursivecpy(data->e);
261  return result;
262  }
static Type * cpy(Type *result, Type *data)
Definition: countedref.h:244
static Type * recursivecpy(Type *data)
Definition: countedref.h:252
return result
Definition: facAbsBiFact.cc:76
template<class Type >
static Type* LeftvHelper::shallowcpy ( Type *  data)
inlinestatic

Definition at line 264 of file countedref.h.

264  {
265  return shallowcpy((Type*) omAlloc0(sizeof(Type)), data);
266  }
static Type * shallowcpy(Type *result, Type *data)
Definition: countedref.h:259
#define omAlloc0(size)
Definition: omAllocDecl.h:211

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