My Project
Public Member Functions | Data Fields
NoroCacheNode Class Reference

#include <tgb_internal.h>

Public Member Functions

 NoroCacheNode ()
 
NoroCacheNodesetNode (int branch, NoroCacheNode *node)
 
NoroCacheNodegetBranch (int branch)
 
virtual ~NoroCacheNode ()
 
NoroCacheNodegetOrInsertBranch (int branch)
 

Data Fields

NoroCacheNode ** branches
 
int branches_len
 

Detailed Description

Definition at line 414 of file tgb_internal.h.

Constructor & Destructor Documentation

◆ NoroCacheNode()

NoroCacheNode::NoroCacheNode ( )
inline

Definition at line 421 of file tgb_internal.h.

422  {
423  branches=NULL;
424  branches_len=0;
425 
426  }
NoroCacheNode ** branches
Definition: tgb_internal.h:417
#define NULL
Definition: omList.c:12

◆ ~NoroCacheNode()

virtual NoroCacheNode::~NoroCacheNode ( )
inlinevirtual

Definition at line 463 of file tgb_internal.h.

464  {
465  int i;
466  for(i=0;i<branches_len;i++)
467  {
468  delete branches[i];
469  }
470  omfree(branches);
471  }
int i
Definition: cfEzgcd.cc:132
#define omfree(addr)
Definition: omAllocDecl.h:237

Member Function Documentation

◆ getBranch()

NoroCacheNode* NoroCacheNode::getBranch ( int  branch)
inline

Definition at line 458 of file tgb_internal.h.

459  {
460  if (branch<branches_len) return branches[branch];
461  return NULL;
462  }

◆ getOrInsertBranch()

NoroCacheNode* NoroCacheNode::getOrInsertBranch ( int  branch)
inline

Definition at line 472 of file tgb_internal.h.

473  {
474  if ((branch<branches_len)&&(branches[branch]))
475  return branches[branch];
476  else
477  {
478  return setNode(branch,new NoroCacheNode());
479  }
480  }
NoroCacheNode * setNode(int branch, NoroCacheNode *node)
Definition: tgb_internal.h:427

◆ setNode()

NoroCacheNode* NoroCacheNode::setNode ( int  branch,
NoroCacheNode node 
)
inline

Definition at line 427 of file tgb_internal.h.

428  {
429  if (branch>=branches_len)
430  {
431  if (branches==NULL)
432  {
433  branches_len=branch+1;
436  int i;
437  for(i=0;i<branches_len;i++)
438  {
439  branches[i]=NULL;
440  }
441  }
442  else
443  {
444  int branches_len_old=branches_len;
445  branches_len=branch+1;
447  int i;
448  for(i=branches_len_old;i<branches_len;i++)
449  {
450  branches[i]=NULL;
451  }
452  }
453  }
454  assume(branches[branch]==NULL);
455  branches[branch]=node;
456  return node;
457  }
static int si_max(const int a, const int b)
Definition: auxiliary.h:124
#define assume(x)
Definition: mod2.h:389
#define omrealloc(addr, size)
Definition: omAllocDecl.h:233
#define omAlloc(size)
Definition: omAllocDecl.h:210

Field Documentation

◆ branches

NoroCacheNode** NoroCacheNode::branches

Definition at line 417 of file tgb_internal.h.

◆ branches_len

int NoroCacheNode::branches_len

Definition at line 418 of file tgb_internal.h.


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