amino  1.0-beta2
Lightweight Robot Utility Library
debug.h
Go to the documentation of this file.
1 /* -*- mode: C; c-basic-offset: 4 -*- */
2 /* ex: set shiftwidth=4 tabstop=4 expandtab: */
3 /*
4  * Copyright (c) 2010-2011, Georgia Tech Research Corporation
5  * All rights reserved.
6  *
7  * Author(s): Neil T. Dantam <ntd@gatech.edu>
8  * Georgia Tech Humanoid Robotics Lab
9  * Under Direction of Prof. Mike Stilman <mstilman@cc.gatech.edu>
10  *
11  *
12  * This file is provided under the following "BSD-style" License:
13  *
14  *
15  * Redistribution and use in source and binary forms, with or
16  * without modification, are permitted provided that the following
17  * conditions are met:
18  *
19  * * Redistributions of source code must retain the above copyright
20  * notice, this list of conditions and the following disclaimer.
21  *
22  * * Redistributions in binary form must reproduce the above
23  * copyright notice, this list of conditions and the following
24  * disclaimer in the documentation and/or other materials provided
25  * with the distribution.
26  *
27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
28  * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
29  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
31  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
32  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
33  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
35  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
36  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
38  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39  * POSSIBILITY OF SUCH DAMAGE.
40  *
41  */
42 
43 #ifndef AMINO_DEBUG_H
44 #define AMINO_DEBUG_H
45 
51 AA_API void
52 aa_hard_assert(int test, const char fmt[], ...);
53 
55 AA_API void
56 aa_verbf( int min_level, const char fmt[], ...) AA_DEPRECATED;
57 
59 AA_API void
60 aa_dump_vec( FILE *file, const double *v, size_t n );
61 
63 AA_API void
64 aa_dump_mat( FILE *file, const double *A, size_t m, size_t n );
65 
69 AA_API void
70 aa_dump_matf( FILE *file, const float *A, size_t m, size_t n );
71 
80 #define AA_DUMP_MAT( file, fmt, A, m, n) \
81  { \
82  for( size_t aa_debug_$_i = 0; aa_debug_$_i < m; \
83  aa_debug_$_i ++ ) { \
84  for( size_t aa_debug_$_j = 0; aa_debug_$_j < n-1; \
85  aa_debug_$_j ++ ) { \
86  fprintf(file, fmt"\t", \
87  AA_MATREF(A, m, aa_debug_$_i,aa_debug_$_j)); \
88  } \
89  fprintf(file, fmt"\n", \
90  AA_MATREF(A, m, aa_debug_$_i, n-1) ); \
91  } \
92  } \
93 
95 AA_API void
96 aa_tick(const char fmt[], ...);
97 
99 AA_API struct timespec
100 aa_tock(void);
101 
102 
104 AA_EXTERN const char *aa_verbf_prefix AA_DEPRECATED;
106 AA_EXTERN int aa_opt_verbosity AA_DEPRECATED;
107 
108 #endif //AA_MATH_H
#define AA_API
calling and name mangling convention for functions
Definition: amino.h:95
#define AA_EXTERN
name mangling convention external symbols
Definition: amino.h:97
AA_API void aa_dump_matf(FILE *file, const float *A, size_t m, size_t n)
Print matrix to file.
AA_API void aa_verbf(int min_level, const char fmt[],...) AA_DEPRECATED
don't use
AA_API void aa_dump_mat(FILE *file, const double *A, size_t m, size_t n)
print a matrix to file
AA_API struct timespec aa_tock(void)
print and return elapsed time since aa_tick()
AA_EXTERN const char *aa_verbf_prefix AA_DEPRECATED
don't use
Definition: debug.h:104
AA_API void aa_tick(const char fmt[],...)
save time, printf fmt
AA_API void aa_hard_assert(int test, const char fmt[],...)
bail out if test is false
AA_API void aa_dump_vec(FILE *file, const double *v, size_t n)
print a vec to file