KIM API V2
kim_log_module.f90
Go to the documentation of this file.
1 !
2 ! CDDL HEADER START
3 !
4 ! The contents of this file are subject to the terms of the Common Development
5 ! and Distribution License Version 1.0 (the "License").
6 !
7 ! You can obtain a copy of the license at
8 ! http://www.opensource.org/licenses/CDDL-1.0. See the License for the
9 ! specific language governing permissions and limitations under the License.
10 !
11 ! When distributing Covered Code, include this CDDL HEADER in each file and
12 ! include the License file in a prominent location with the name LICENSE.CDDL.
13 ! If applicable, add the following below this CDDL HEADER, with the fields
14 ! enclosed by brackets "[]" replaced with your own identifying information:
15 !
16 ! Portions Copyright (c) [yyyy] [name of copyright owner]. All rights reserved.
17 !
18 ! CDDL HEADER END
19 !
20 
21 !
22 ! Copyright (c) 2016--2018, Regents of the University of Minnesota.
23 ! All rights reserved.
24 !
25 ! Contributors:
26 ! Ryan S. Elliott
27 !
28 
29 !
30 ! Release: This file is part of the kim-api-v2.0.0-alpha.0 package.
31 !
32 
33 
35  use, intrinsic :: iso_c_binding
36  implicit none
37  private
38 
39  public &
40  kim_log_handle_type, &
42  operator (.eq.), &
43  operator (.ne.), &
44  kim_log_create, &
45  kim_log_destroy, &
46  kim_log_get_id, &
47  kim_log_set_id, &
48  kim_log_push_verbosity, &
50  kim_log_log_entry
51 
52  type, bind(c) :: kim_log_handle_type
53  type(c_ptr) :: p = c_null_ptr
54  end type kim_log_handle_type
55 
56  type(kim_log_handle_type), protected, &
57  bind(c,name="KIM_LOG_null_handle") &
59 
60  interface operator (.eq.)
61  logical function kim_log_handle_equal(left, right)
62  use, intrinsic :: iso_c_binding
63  import kim_log_handle_type
64  implicit none
65  type(kim_log_handle_type), intent(in) :: left
66  type(kim_log_handle_type), intent(in) :: right
67  end function kim_log_handle_equal
68  end interface operator (.eq.)
69 
70  interface operator (.ne.)
71  logical function kim_log_handle_not_equal(left, right)
72  use, intrinsic :: iso_c_binding
73  import kim_log_handle_type
74  implicit none
75  type(kim_log_handle_type), intent(in) :: left
76  type(kim_log_handle_type), intent(in) :: right
77  end function kim_log_handle_not_equal
78  end interface operator (.ne.)
79 
80  interface
81  subroutine kim_log_create(log_handle, ierr)
82  use, intrinsic :: iso_c_binding
83  import kim_log_handle_type
84  implicit none
85  type(kim_log_handle_type), intent(out) :: log_handle
86  integer(c_int), intent(out) :: ierr
87  end subroutine kim_log_create
88 
89  subroutine kim_log_destroy(log_handle)
90  use, intrinsic :: iso_c_binding
91  import kim_log_handle_type
92  implicit none
93  type(kim_log_handle_type), intent(inout) :: log_handle
94  end subroutine kim_log_destroy
95 
96  subroutine kim_log_get_id(log_handle, id_string)
97  use, intrinsic :: iso_c_binding
98  import kim_log_handle_type
99  implicit none
100  type(kim_log_handle_type), intent(in) :: log_handle
101  character(len=*), intent(out) :: id_string
102  end subroutine kim_log_get_id
103 
104  subroutine kim_log_set_id(log_handle, id_string)
105  use, intrinsic :: iso_c_binding
106  import kim_log_handle_type
107  implicit none
108  type(kim_log_handle_type), intent(in) :: log_handle
109  character(len=*), intent(in) :: id_string
110  end subroutine kim_log_set_id
111 
112  subroutine kim_log_push_verbosity(log_handle, log_verbosity)
113  use, intrinsic :: iso_c_binding
114  use :: kim_log_verbosity_module, only : kim_log_verbosity_type
115  import kim_log_handle_type
116  implicit none
117  type(kim_log_handle_type), intent(in) :: log_handle
118  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
119  end subroutine kim_log_push_verbosity
120 
121  subroutine kim_log_pop_verbosity(log_handle)
122  use, intrinsic :: iso_c_binding
123  import kim_log_handle_type
124  implicit none
125  type(kim_log_handle_type), intent(in) :: log_handle
126  end subroutine kim_log_pop_verbosity
127 
128  subroutine kim_log_log_entry(log_handle, log_verbosity, message, &
129  line_number, file_name)
130  use, intrinsic :: iso_c_binding
131  use kim_log_verbosity_module, only : kim_log_verbosity_type
132  import kim_log_handle_type
133  implicit none
134  type(kim_log_handle_type), intent(in) :: log_handle
135  type(kim_log_verbosity_type), intent(in), value :: log_verbosity
136  character(len=*), intent(in) :: message
137  integer(c_int), intent(in), value :: line_number
138  character(len=*), intent(in) :: file_name
139  end subroutine kim_log_log_entry
140  end interface
141 end module kim_log_module
type(kim_log_handle_type), public, protected kim_log_null_handle