File: bound_function_pointer_kernel_c.h

package info (click to toggle)
mldemos 0.5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 32,224 kB
  • ctags: 46,525
  • sloc: cpp: 306,887; ansic: 167,718; ml: 126; sh: 109; makefile: 2
file content (66 lines) | stat: -rw-r--r-- 2,009 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright (C) 2008  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#ifndef DLIB_BOUND_FUNCTION_POINTER_KERNEl_C_
#define DLIB_BOUND_FUNCTION_POINTER_KERNEl_C_

#include "bound_function_pointer_kernel_abstract.h"
#include "../algs.h"
#include "../assert.h"

namespace dlib
{


    template <
        typename bound_function_pointer_base // is an implementation of bound_function_pointer_kernel_abstract.h
        >
    class bound_function_pointer_kernel_c : public bound_function_pointer_base
    {
        public:

            void operator () (
            ) const;

    };

    template <
        typename bound_function_pointer_base
        >
    inline void swap (
        bound_function_pointer_kernel_c<bound_function_pointer_base>& a, 
        bound_function_pointer_kernel_c<bound_function_pointer_base>& b 
    ) { a.swap(b); }

// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------
    // member function definitions
// ----------------------------------------------------------------------------------------
// ----------------------------------------------------------------------------------------

    template <
        typename bound_function_pointer_base
        >
    void bound_function_pointer_kernel_c<bound_function_pointer_base>::
    operator() (
    ) const
    {

        // make sure requires clause is not broken
        DLIB_CASSERT(this->is_set() == true ,
                "\tvoid bound_function_pointer::operator()"
                << "\n\tYou must call set() before you can use this function"
                << "\n\tthis: " << this
        );

        // call the real function
        bound_function_pointer_base::operator()();

    }

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_BOUND_FUNCTION_POINTER_KERNEl_C_