My Project
Public Member Functions | Data Fields
sattr Class Reference

#include <attrib.h>

Public Member Functions

void Init ()
 
void Print ()
 
attr Copy ()
 
void * CopyA ()
 
attr set (char *s, void *data, int t)
 
attr get (const char *s)
 
void kill (const ring r)
 
void killAll (const ring r)
 
- Public Member Functions inherited from omallocClass
void * operator new (size_t size) throw (std::bad_alloc)
 
void operator delete (void *block) throw ()
 
void * operator new[] (size_t size) throw (std::bad_alloc)
 
void operator delete[] (void *block) throw ()
 
void * operator new (size_t size, const std::nothrow_t &) throw ()
 
void * operator new[] (size_t size, const std::nothrow_t &) throw ()
 

Data Fields

char * name
 
void * data
 
attr next
 
int atyp
 

Detailed Description

Definition at line 17 of file attrib.h.

Member Function Documentation

◆ Copy()

attr sattr::Copy ( )

Definition at line 33 of file attrib.cc.

34 {
35  assume (this!=NULL);
36 
37  omCheckAddrSize(this,sizeof(sattr));
39  n->atyp=atyp;
40  if (name!=NULL) n->name=omStrDup(name);
41  n->data=CopyA();
42  if (next!=NULL)
43  {
44  n->next=next->Copy();
45  }
46  return n;
47 }
STATIC_VAR omBin sattr_bin
Definition: attrib.cc:24
sattr * attr
Definition: attrib.h:15
Definition: attrib.h:21
void * data
Definition: attrib.h:25
attr Copy()
Definition: attrib.cc:33
void * CopyA()
Definition: subexpr.cc:2100
int atyp
Definition: attrib.h:27
char * name
Definition: attrib.h:24
attr next
Definition: attrib.h:26
#define assume(x)
Definition: mod2.h:389
#define omStrDup(s)
Definition: omAllocDecl.h:263
#define omCheckAddrSize(addr, size)
Definition: omAllocDecl.h:327
#define omAlloc0Bin(bin)
Definition: omAllocDecl.h:206
#define NULL
Definition: omList.c:12

◆ CopyA()

void * sattr::CopyA ( )

Definition at line 2100 of file subexpr.cc.

2101 {
2102  omCheckAddrSize(this,sizeof(sattr));
2103  return s_internalCopy(atyp,data);
2104 }
static void * s_internalCopy(const int t, void *d)
Definition: subexpr.cc:430

◆ get()

attr sattr::get ( const char *  s)

Definition at line 93 of file attrib.cc.

94 {
95  attr h = this;
96  while (h!=NULL)
97  {
98  if (0 == strcmp(s,h->name))
99  {
100 #ifdef TEST
101  //::Print("get attr >>%s<< of type %s\n",h->name, Tok2Cmdname(h->atyp));
102 #endif
103  return h;
104  }
105  h = h->next;
106  }
107  return NULL;
108 }
const CanonicalForm int s
Definition: facAbsFact.cc:51
STATIC_VAR Poly * h
Definition: janet.cc:971

◆ Init()

void sattr::Init ( )
inline

Definition at line 23 of file attrib.h.

23 { memset(this,0,sizeof(*this)); }

◆ kill()

void sattr::kill ( const ring  r)

Definition at line 183 of file attrib.cc.

184 {
185  attr_free(this,r);
186  omFreeBin((ADDRESS)this, sattr_bin);
187 }
static void attr_free(attr h, const ring r=currRing)
Definition: attrib.cc:56
void * ADDRESS
Definition: auxiliary.h:119
#define omFreeBin(addr, bin)
Definition: omAllocDecl.h:259

◆ killAll()

void sattr::killAll ( const ring  r)

Definition at line 189 of file attrib.cc.

190 {
191  attr temp = this,temp1;
192 
193  while (temp!=NULL)
194  {
195  temp1 = temp->next;
196  omCheckAddr(temp);
197  temp->kill(r);
198  temp = temp1;
199  }
200 }
void kill(const ring r)
Definition: attrib.cc:183
#define omCheckAddr(addr)
Definition: omAllocDecl.h:328

◆ Print()

void sattr::Print ( )

Definition at line 26 of file attrib.cc.

27 {
28  omCheckAddrSize(this,sizeof(sattr));
29  ::Print("attr:%s, type %s \n",name,Tok2Cmdname(atyp));
30  if (next!=NULL) next->Print();
31 }
void Print()
Definition: attrib.cc:26
const char * Tok2Cmdname(int tok)
Definition: gentable.cc:140

◆ set()

attr sattr::set ( char *  s,
void *  data,
int  t 
)

Definition at line 70 of file attrib.cc.

71 {
72  attr h = get(s);
73  attr result=this;
74  if (h!=NULL)
75  {
76  attr_free(h);
77  }
78  else
79  {
81  h->next = this;
82  result=h;
83  }
84  h->name = s;
85  h->data = d;
86  h->atyp = t;
87 #ifdef TEST
88  //::Print("set attr >>%s<< of type %s\n",h->name, Tok2Cmdname(t));
89 #endif
90  return result;
91 }
attr get(const char *s)
Definition: attrib.cc:93
return result
Definition: facAbsBiFact.cc:75

Field Documentation

◆ atyp

int sattr::atyp

Definition at line 27 of file attrib.h.

◆ data

void* sattr::data

Definition at line 25 of file attrib.h.

◆ name

char* sattr::name

Definition at line 24 of file attrib.h.

◆ next

attr sattr::next

Definition at line 26 of file attrib.h.


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