ADMB Documentation  11.1.2397
 All Classes Files Functions Variables Typedefs Friends Defines
df1b2ptr.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id: df1b2ptr.cpp 1919 2014-04-22 22:02:01Z johnoel $
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <df1b2fun.h>
00012     typedef df1b2_header * ad_df1b2_header_ptr;
00013     typedef double * ad_double_ptr;
00014 
00019   df1b2_header_ptr_vector::df1b2_header_ptr_vector(int mmin,int mmax)
00020   {
00021     index_min=mmin;
00022     index_max=mmax;
00023     v = new ad_df1b2_header_ptr[mmax-mmin+1];
00024     if (v ==0)
00025     {
00026       cerr << "error allocating memory for"
00027         " df1b2_header_ptr_vector" << endl;
00028       ad_exit(1);
00029     }
00030     v-=indexmin();
00031   }
00032 
00037   df1b2_header_ptr_vector::~df1b2_header_ptr_vector()
00038   {
00039     if (v !=0)
00040     {
00041       v+=indexmin();
00042       delete [] v;
00043       v=0;
00044       index_min=0;
00045       index_max=-1;
00046     }
00047   }
00048 
00053   double_ptr_vector::double_ptr_vector(int mmin,int mmax)
00054   {
00055     index_min=mmin;
00056     index_max=mmax;
00057     v = new ad_double_ptr[mmax-mmin+1];
00058     if (v ==0)
00059     {
00060       cerr << "error allocating memory for"
00061         " double_ptr_vector" << endl;
00062       ad_exit(1);
00063     }
00064     v-=indexmin();
00065   }
00066 
00071   double_ptr_vector::~double_ptr_vector()
00072   {
00073     if (v !=0)
00074     {
00075       v+=indexmin();
00076       delete [] v;
00077       v=0;
00078       index_min=0;
00079       index_max=-1;
00080     }
00081   }