lines 8-101 of file: include/cppad/core/atomic/three/ctor.hpp
{xrst_begin atomic_three_ctor}
Atomic Function Constructor
###########################
Syntax
******
| ``class`` *atomic_user* : ``public CppAD::atomic_three<`` *Base* > {
| ``public:``
| |tab| *atomic_user* ( *ctor_arg_list* ) : ``CppAD::atomic_three<`` *Base* >( *name* )
| |tab| ...
| };
| *atomic_user afun* ( *ctor_arg_list* )
Prototype
*********
{xrst_literal
// BEGIN_PROTOTYPE
// END_PROTOTYPE
}
atomic_user
***********
ctor_arg_list
=============
Is a list of arguments for the *atomic_user* constructor.
afun
====
The object *afun* must stay in scope for as long
as the corresponding atomic function is used.
This includes use by any :ref:`ADFun\` that
has this *atomic_user* operation in its
:ref:`operation sequence` .
Implementation
==============
The user defined *atomic_user* class is a publicly derived class of
``atomic_three`` < *Base* > .
It should be declared as follows:
| |tab| ``class`` *atomic_user* : ``public CppAD::atomic_three<`` *Base* > {
| |tab| ``public:``
| |tab| |tab| *atomic_user* ( *ctor_arg_list* ) : ``atomic_three`` < *Base* >( *name* )
| |tab| ...
| |tab| };
where ...
denotes the rest of the implementation of the derived class.
This includes completing the constructor and
all the virtual functions that have their
``atomic_three`` implementations replaced by
*atomic_user* implementations.
atomic_three
************
Restrictions
============
The ``atomic_three`` constructor and destructor cannot be called in
:ref:`parallel` mode.
Base
====
The template parameter determines the
:ref:`atomic_three_afun@Base`
type for this ``AD`` < *Base* > atomic operation.
name
====
This ``atomic_three`` constructor argument has the following prototype
``const std::string&`` *name*
It is the name for this atomic function and is used for error reporting.
The suggested value for *name* is *afun* or *atomic_user* ,
i.e., the name of the corresponding atomic object or class.
Example
*******
Define Constructor
==================
The following is an example of a atomic function constructor definition:
:ref:`get_started.cpp` .
Use Constructor
===============
The following is an example using a atomic function constructor:
:ref:`get_started.cpp` .
{xrst_end atomic_three_ctor}