Revision 1560 trunk/src/tools99/string5.cpp

string5.cpp (revision 1560)
9 9
#include "admb_messages.h"
10 10

  
11 11
adstring_array::adstring_array(const adstring_array& sa):clist(sa)
12
  {
13
    shape=sa.shape;
14
    ptr=sa.ptr;
15
  }
12
{
13
  shape=sa.shape;
14
  ptr=sa.ptr;
15
}
16 16

  
17
  adstring_array::~adstring_array()
17
/**
18
Destructor
19
*/
20
adstring_array::~adstring_array()
21
{
22
  if (ptr)
18 23
  {
19
    if (ptr)
24
    if (next==this)
20 25
    {
21
      if (next==this)
26
      int min=indexmin();
27
      int max=indexmax();
28
      for(int i=min;i<=max;i++)
22 29
      {
23
        int min=indexmin();
24
        int max=indexmax();
25
        for(int i=min;i<=max;i++)
30
        if (ptr[i])
26 31
        {
27
          if (ptr[i])
28
          {
29
            delete ptr[i];
30
          }
32
          delete ptr[i];
33
          ptr[i] = 0;
31 34
        }
32
        ptr+=indexmin();
33
        delete [] ptr;
34
        delete shape;
35
        shape=NULL;
36
        ptr=NULL;
37 35
      }
36
      ptr+=indexmin();
37

  
38
      delete [] ptr;
39
      ptr = 0;
40

  
41
      delete shape;
42
      shape = 0;
38 43
    }
39 44
  }
45
}
40 46

  
41
  adstring_array::adstring_array(void)
42
  {
43
    shape=NULL;
44
    ptr=NULL;
45
  }
47
/**
48
Default constructor
49
*/
50
adstring_array::adstring_array(void)
51
{
52
  shape=NULL;
53
  ptr=NULL;
54
}
46 55

  
47 56
int adstring_array::size() const { return shape->indexmax()-shape->indexmin() + 1; }
48 57
int adstring_array::indexmin(void) const { return shape->indexmin();}

Also available in: Unified diff