1 # ifndef CPPAD_UTILITY_TRACK_NEW_DEL_HPP 
    2 # define CPPAD_UTILITY_TRACK_NEW_DEL_HPP 
  244 # ifndef CPPAD_TRACK_DEBUG 
  245 # define CPPAD_TRACK_DEBUG 0 
  249 # define CPPAD_TRACK_NEW_VEC(newlen, oldptr) \ 
  250      CppAD::TrackNewVec(__FILE__, __LINE__, newlen, oldptr) 
  252 # define CPPAD_TRACK_DEL_VEC(oldptr) \ 
  253      CppAD::TrackDelVec(__FILE__, __LINE__, oldptr) 
  255 # define CPPAD_TRACK_EXTEND(newlen, ncopy, oldptr) \ 
  256      CppAD::TrackExtend(__FILE__, __LINE__, newlen, ncopy, oldptr) 
  258 # define CPPAD_TRACK_COUNT() \ 
  259      CppAD::TrackCount(__FILE__, __LINE__) 
  261 # define CppADTrackNewVec CPPAD_TRACK_NEW_VEC 
  262 # define CppADTrackDelVec CPPAD_TRACK_DEL_VEC 
  263 # define CppADTrackExtend CPPAD_TRACK_EXTEND 
  264 # define CppADTrackCount  CPPAD_TRACK_COUNT 
  300           cout << 
", E->next = " << E->
next;
 
  301           cout << 
", E->ptr  = " << E->
ptr;
 
  302           cout << 
", E->line = " << E->line;
 
  303           cout << 
", E->file = " << E->file;
 
  315           cout << 
"Begin Track List" << endl;
 
  316           while( E->
next != CPPAD_NULL )
 
  320           cout << 
"End Track List:" << endl;
 
  334      std::ostringstream buf;
 
  342      std::string str = buf.str();
 
  343      size_t      n   = str.size();
 
  345      char *message = 
new char[n + 1];
 
  346      for(i = 0; i < n; i++)
 
  354 template <
class Type>
 
  356      const char *file, 
int line, 
size_t len, Type *  )
 
  358 # if CPPAD_TRACK_DEBUG 
  359      static bool first = 
true;
 
  361      {    std::cout << 
"NDEBUG is defined for TrackNewVec" << std::endl;
 
  365      return (
new Type[len]);
 
  370 template <
class Type>
 
  379           "attempt to use TrackNewVec in parallel execution mode." 
  382      Type *newptr = CPPAD_NULL;
 
  384      {    newptr = 
new Type[len];
 
  388                "Cannot allocate sufficient memory" 
  392      void *vptr = 
static_cast<void *
>(newptr);
 
  402 # if CPPAD_TRACK_DEBUG 
  403      std::cout << 
"TrackNewVec: ";
 
  414 template <
class Type>
 
  415 inline void TrackDelVec(
const char *file, 
int line, Type *oldptr)
 
  417 # if CPPAD_TRACK_DEBUG 
  418      static bool first = 
true;
 
  420      {    std::cout << 
"NDEBUG is defined in TrackDelVec" << std::endl;
 
  429 template <
class Type>
 
  437           "attempt to use TrackDelVec in parallel execution mode." 
  445      void *vptr = 
static_cast<void *
>(oldptr);
 
  446      while(E != CPPAD_NULL && E->
ptr != vptr)
 
  453           "TrackDelVec", file, line,
 
  454           "Invalid value for the argument oldptr.\n" 
  455           "Possible linking of debug and NDEBUG compilations of CppAD." 
  458 # if CPPAD_TRACK_DEBUG 
  459      std::cout << 
"TrackDelVec: ";
 
  478 template <
class Type>
 
  488           "attempt to use TrackExtend in parallel execution mode." 
  491 # if CPPAD_TRACK_DEBUG 
  493      cout << 
"TrackExtend: file = " << file;
 
  494      cout << 
", line = " << line;
 
  495      cout << 
", newlen = " << newlen;
 
  496      cout << 
", ncopy = " << ncopy;
 
  497      cout << 
", oldptr = " << oldptr;
 
  502           "TrackExtend: ncopy is greater than newlen." 
  506      Type *newptr = 
TrackNewVec(file, line, newlen, oldptr);
 
  510      for(i = 0; i < ncopy; i++)
 
  511           newptr[i] = oldptr[i];
 
  525           "attempt to use TrackCount in parallel execution mode." 
  529      while( E->
next != CPPAD_NULL )
 
  540 # undef CPPAD_TRACK_DEBUG 
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution. 
Define processor symbols and macros that are used by CppAD. 
size_t TrackCount(const char *file, int line)
static bool in_parallel(void)
Are we in a parallel execution state; i.e., is it possible that other threads are currently executing...
Define the CppAD error checking macros (all of which begin with CPPAD_ASSERT_) 
Type * TrackNewVec(const char *file, int line, size_t len, Type *)
void TrackError(const char *routine, const char *file, int line, const char *msg)
TrackElement(const char *f, int l, void *p)
Type * TrackExtend(const char *file, int line, size_t newlen, size_t ncopy, Type *oldptr)
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution. 
void TrackDelVec(const char *file, int line, Type *oldptr)
File used to define the CppAD multi-threading allocator class. 
static void Print(TrackElement *E)
static TrackElement * Root(void)