CppAD: A C++ Algorithmic Differentiation Package  20171217
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
core/hash_code.hpp
Go to the documentation of this file.
1 // $Id$
2 # ifndef CPPAD_CORE_HASH_CODE_HPP
3 # define CPPAD_CORE_HASH_CODE_HPP
4 
5 /* --------------------------------------------------------------------------
6 CppAD: C++ Algorithmic Differentiation: Copyright (C) 2003-16 Bradley M. Bell
7 
8 CppAD is distributed under multiple licenses. This distribution is under
9 the terms of the
10  Eclipse Public License Version 1.0.
11 
12 A copy of this license is included in the COPYING file of this distribution.
13 Please visit http://www.coin-or.org/CppAD/ for information on other licenses.
14 -------------------------------------------------------------------------- */
15 /*!
16 \file core/hash_code.hpp
17 CppAD hashing utility.
18 */
19 # include <cppad/local/hash_code.hpp>
20 
21 namespace CppAD { // BEGIN_CPPAD_NAMESPACE
22 /*!
23 General purpose hash code for an arbitrary value.
24 
25 \tparam Value
26 is the type of the argument being hash coded.
27 It should be a plain old data class; i.e.,
28 the values included in the equality operator in the object and
29 not pointed to by the object.
30 
31 \param value
32 the value that we are generating a hash code for.
33 All of the fields in value should have been set before the hash code
34 is computed (otherwise undefined values are used).
35 
36 \return
37 is a hash code that is between zero and CPPAD_HASH_TABLE_SIZE - 1.
38 
39 \par Checked Assertions
40 \li \c std::numeric_limits<unsigned short>::max() >= CPPAD_HASH_TABLE_SIZE
41 \li \c sizeof(value) is even
42 \li \c sizeof(unsigned short) == 2
43 */
44 template <class Value>
45 unsigned short hash_code(const Value& value)
46 { return local::local_hash_code(value); }
47 
48 } // END_CPPAD_NAMESPACE
49 
50 
51 # endif
CPPAD_INLINE_FRIEND_TEMPLATE_FUNCTION Base Value(const AD< Base > &x)
Definition: value.hpp:82
unsigned short local_hash_code(const Value &value)
General purpose hash code for an arbitrary value.
CppAD hashing utility.
unsigned short hash_code(const Value &value)
General purpose hash code for an arbitrary value.