1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 1999-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20%%
21%%-----------------------------------------------------------------
22%% File: tracer.erl
23%%
24%% Description:
25%%    This file contains an example of pre and post conditions for
26%%    the corba backend.
27%%
28%%-----------------------------------------------------------------
29-module(tracer).
30-include("m.hrl").
31
32%%-----------------------------------------------------------------
33%% External exports
34%%-----------------------------------------------------------------
35-export([pre/3, post/4]).
36
37%%-----------------------------------------------------------------
38%% Internal exports
39%%-----------------------------------------------------------------
40-export([]).
41
42%%-----------------------------------------------------------------
43%% External functions
44%%-----------------------------------------------------------------
45pre(M, F, [State, I]) when is_integer(I) ->
46    io:format("Precond called in process ~p: ~s:~s() ~p\n", [self(), M, F,  [State, I]]),
47    ok;
48pre(_M, _F, _A) -> %% Just an silly example to get an exception case
49    corba:raise(#'m_NotAnInteger'{}).
50
51post(M, F, A, R) ->
52    io:format("Postcond called in process ~p: ~s:~s() ~p ~p\n", [self(), M, F, A, R]),
53    ok.
54
55%%-----------------------------------------------------------------
56%% Internal functions
57%%-----------------------------------------------------------------
58