1 # ifndef CPPAD_LOCAL_RECORDER_HPP 
    2 # define CPPAD_LOCAL_RECORDER_HPP 
   16 namespace CppAD { 
namespace local { 
 
  184 template <
class Base>
 
  186 {    
size_t i    = op_vec_.extend(1);
 
  188           (abort_op_index_ == 0) || (abort_op_index_ != i),
 
  189           "Operator index equals abort_op_index in Independent" 
  196      num_var_rec_ += 
NumRes(op);
 
  202           (
size_t) std::numeric_limits<addr_t>::max() >= num_var_rec_ - 1,
 
  203           "cppad_tape_addr_type maximum value has been exceeded" 
  206      return static_cast<addr_t>( num_var_rec_ - 1 );
 
  242 template <
class Base>
 
  244 {    
size_t i    = op_vec_.extend(1);
 
  246           (abort_op_index_ == 0) || (abort_op_index_ != i),
 
  247           "This is the abort operator index specified by " 
  248           "Independent(x, abort_op_index)." 
  255      num_var_rec_ += 
NumRes(op);
 
  264           (
size_t) std::numeric_limits<addr_t>::max() >= num_var_rec_ - 1,
 
  265           "cppad_tape_addr_type maximum value has been exceeded" 
  267      return static_cast<addr_t>( num_var_rec_ - 1 );
 
  288 template <
class Base>
 
  290 {    
size_t i          = vecad_ind_vec_.extend(1);
 
  292      vecad_ind_vec_[i] = 
addr_t( vec_ind );
 
  296           std::numeric_limits<addr_t>::max() >= i,
 
  297           "cppad_tape_addr_type maximum value has been exceeded" 
  299      return static_cast<addr_t>( i );
 
  313 template <
class Base>
 
  326      code = 
static_cast<size_t>( 
hash_code(par) );
 
  330      i = hash_table[code + thread_offset_];
 
  333                static_cast<size_t>( std::numeric_limits<addr_t>::max() ) >= i,
 
  334                "cppad_tape_addr_type maximum value has been exceeded" 
  336           return static_cast<addr_t>( i );
 
  340      i           = par_vec_.extend(1);
 
  345      hash_table[code + thread_offset_] = i;
 
  349           static_cast<size_t>( std::numeric_limits<addr_t>::max() ) >= i,
 
  350           "cppad_tape_addr_type maximum value has been exceeded" 
  352      return static_cast<addr_t>( i );
 
  391 template <
class Base>
 
  394      size_t i       = arg_vec_.extend(1);
 
  395      arg_vec_[i]    =  
static_cast<addr_t>( arg0 );
 
  409 template <
class Base>
 
  412      size_t i         = arg_vec_.extend(2);
 
  413      arg_vec_[i++] =  
static_cast<addr_t>( arg0 );
 
  414      arg_vec_[i]      =  
static_cast<addr_t>( arg1 );
 
  431 template <
class Base>
 
  434      size_t i         = arg_vec_.extend(3);
 
  435      arg_vec_[i++] =  
static_cast<addr_t>( arg0 );
 
  436      arg_vec_[i++] =  
static_cast<addr_t>( arg1 );
 
  437      arg_vec_[i]      =  
static_cast<addr_t>( arg2 );
 
  457 template <
class Base>
 
  461      size_t i         = arg_vec_.extend(4);
 
  462      arg_vec_[i++] =  
static_cast<addr_t>( arg0 );
 
  463      arg_vec_[i++] =  
static_cast<addr_t>( arg1 );
 
  464      arg_vec_[i++] =  
static_cast<addr_t>( arg2 );
 
  465      arg_vec_[i]      =  
static_cast<addr_t>( arg3 );
 
  489 template <
class Base>
 
  493      size_t i         = arg_vec_.extend(5);
 
  494      arg_vec_[i++] =  
static_cast<addr_t>( arg0 );
 
  495      arg_vec_[i++] =  
static_cast<addr_t>( arg1 );
 
  496      arg_vec_[i++] =  
static_cast<addr_t>( arg2 );
 
  497      arg_vec_[i++] =  
static_cast<addr_t>( arg3 );
 
  498      arg_vec_[i]      =  
static_cast<addr_t>( arg4 );
 
  525 template <
class Base>
 
  529      size_t i         = arg_vec_.extend(6);
 
  530      arg_vec_[i++] =  
static_cast<addr_t>( arg0 );
 
  531      arg_vec_[i++] =  
static_cast<addr_t>( arg1 );
 
  532      arg_vec_[i++] =  
static_cast<addr_t>( arg2 );
 
  533      arg_vec_[i++] =  
static_cast<addr_t>( arg3 );
 
  534      arg_vec_[i++] =  
static_cast<addr_t>( arg4 );
 
  535      arg_vec_[i]      =  
static_cast<addr_t>( arg5 );
 
  549 template <
class Base>
 
  552      size_t i = arg_vec_.extend(n_arg);
 
  568 template <
class Base>
 
  570 {    arg_vec_[i_arg] =  
static_cast<addr_t>( value ); }
 
  584 template <
class Base>
 
  589      while( text[n] != 
'\0' )
 
  596      size_t i = text_vec_.extend(n);
 
  598      for(j = 0; j < n; j++)
 
  599           text_vec_[i + j] = text[j];
 
  603           std::numeric_limits<addr_t>::max() >= i,
 
  604           "cppad_tape_addr_type maximum value has been exceeded" 
  607      return static_cast<addr_t>( i );
 
~recorder(void)
Destructor. 
#define CPPAD_ASSERT_KNOWN(exp, msg)
Check that exp is true, if not print msg and terminate execution. 
addr_t PutOp(OpCode op)
Put next operator in the operation sequence. 
void clear(void)
Remove all the elements from this vector and free its memory. 
recorder(void)
Default constructor. 
size_t abort_op_index_
operator index at which to abort recording with an error (do not abort when zero) ...
CPPAD_TAPE_ADDR_TYPE addr_t
pod_vector< OpCode > op_vec_
The operators in the recording. 
pod_vector< Base > par_vec_
The parameters in the recording. Note that Base may not be plain old data, so use false in consructor...
addr_t PutTxt(const char *text)
Put a character string in the text for this recording. 
size_t ReserveArg(size_t n_arg)
Reserve space for arguments, but delay placing values there. 
Class used to store and play back an operation sequence recording. 
pod_vector< addr_t > vecad_ind_vec_
The VecAD indices in the recording. 
size_t num_load_op_rec(void) const 
Number of LdpOp and LdvOp operations currently in the recording. 
Capacity vector for memory allocation block sizes. 
static size_t thread_num(void)
Get current thread number. 
size_t num_var_rec(void) const 
Number of variables currently stored in the recording. 
void PutArg(addr_t arg0)
Put one operation argument index in the recording. 
size_t NumRes(OpCode op)
Number of variables resulting from the specified operation. 
File used to define pod_vector class. 
addr_t PutPar(const Base &par)
Find or add a parameter to the current vector of parameters. 
addr_t PutLoadOp(OpCode op)
Put a vecad load operator in the operation sequence (special case) 
OpCode
Type used to distinguish different AD< Base > atomic operations. 
size_t num_var_rec_
Number of variables in the recording. 
void free(void)
Frees all information in recording. 
size_t size(void) const 
current number of elements in this vector. 
pod_vector< char > text_vec_
Character strings ('\0' terminated) in the recording. 
#define CPPAD_ASSERT_UNKNOWN(exp)
Check that exp is true, if not terminate execution. 
bool IdenticalEqualPar(const std::complex< double > &x, const std::complex< double > &y)
const size_t thread_offset_
offset for this thread in the static hash table 
size_t num_load_op_rec_
Number vecad load operations (LdpOp or LdvOp) currently in recording. 
size_t num_op_rec(void) const 
Number of operators currently stored in the recording. 
unsigned short hash_code(const Value &value)
General purpose hash code for an arbitrary value. 
void set_abort_op_index(size_t abort_op_index)
Set the abort index. 
size_t get_abort_op_index(void)
Get the abort index. 
size_t capacity(void) const 
current capacity (amount of allocated storage) for this vector. 
addr_t PutVecInd(size_t vec_ind)
Add a value to the end of the current vector of VecAD indices. 
size_t Memory(void) const 
Approximate amount of memory used by the recording. 
void prototype_put_arg(void)
Prototype for putting operation argument indices in the recording. 
#define CPPAD_HASH_TABLE_SIZE
the codes retruned by hash_code are between zero and CPPAD_HASH_TABLE_SIZE minus one. 
void ReplaceArg(size_t i_arg, size_t value)
Replace an argument value in the recording (intended to fill in reserved values). ...
pod_vector< addr_t > arg_vec_
The argument indices in the recording.