Revision 1587 trunk/src/linad99/ddlist.cpp

ddlist.cpp (revision 1587)
22 22

  
23 23
#include <stdlib.h>
24 24
//#define MAX_DLINKS 1000
25
dlink * dlink::previous(){return prev;}
25
/**
26
\return previous node pointer.
27
*/
28
dlink* dlink::previous()
29
{
30
  return prev;
31
}
26 32

  
27 33
//////////////////////////////
28 34
// global list names
......
67 73

  
68 74
  ddlist_spacea=ddlist_space+adjust;
69 75

  
76
  //Initialize addresses to zero
70 77
  memset(dlink_addresses, 0, sizeof(dlink*) * gradient_structure::MAX_DLINKS);
71 78
}
72

  
73 79
/**
74
 * Description not yet available.
75
 * \param
76
 */
77
dlink * dlist::create()
80
Create unlinked new node.
81
*/
82
dlink* dlist::create()
78 83
{
79

  
80
  dlink * tmp= (dlink*)(ddlist_spacea+2*sizeof(double)*nlinks);
81
  /*
82
  if ( (tmp = new dlink) ==0)
84
  dlink* tmp= (dlink*)(ddlist_spacea+2*sizeof(double)*nlinks);
85
  if (tmp == 0)
83 86
  {
84 87
    cerr << "Error allocating dlink in dlist::create()\n";
85 88
    ad_exit(21);
86 89
  }
87
 */
90
  // cout << "Made a dlink with address " << _farptr_tolong(tmp) <<"\n";
88 91

  
89
  dlink_addresses[nlinks]=tmp;   // keep track of the links so you can
90
                                 // zero them out
92
  // keep track of the links so you can zero them out
93
  dlink_addresses[nlinks]=tmp;
91 94
  nlinks+=1;
92 95

  
93
  if (nlinks > (unsigned int)gradient_structure::MAX_DLINKS)
96
  if (nlinks > gradient_structure::MAX_DLINKS)
94 97
  {
95 98
    cerr << "Need to increase the maximum number of dlinks" << endl;
96 99
    ad_exit(1);
97 100
  }
98 101

  
102
  //do not add to list.
99 103
  tmp->prev=0;
100
  // cout << "Made a dlink with address " << _farptr_tolong(tmp) <<"\n";
101
  return(tmp);
104

  
105
  return tmp;
102 106
}
107
/**
108
If list is not empty, pop and return last node.
103 109

  
104
/**
105
If last node in list exist, remove it and return it.
110
\return 0 empty list.
106 111
*/
107 112
dlink* dlist::last_remove()
108 113
{
......
168 173
  return total;
169 174
}
170 175
/**
171
 * Description not yet available.
172
 * \param
173
 */
176
Check link list integrity.
177
*/
174 178
void dlist::check_list(void)
175 179
{
176 180
  dlink* tmp_last=last;

Also available in: Unified diff