libigl v2.5.0
Loading...
Searching...
No Matches
verbose.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2013 Alec Jacobson <alecjacobson@gmail.com>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef IGL_VERBOSE_H
9#define IGL_VERBOSE_H
10
11// This function is only useful as a header-only inlined function
12
13namespace igl
14{
22 inline int verbose(const char * msg,...);
23}
24
25
26
27#include <cstdio>
28#ifdef VERBOSE
29# include <cstdarg>
30#endif
31
32#include <string>
33// http://channel9.msdn.com/forums/techoff/254707-wrapping-printf-in-c/
34#ifdef VERBOSE
35inline int igl::verbose(const char * msg,...)
36{
37 va_list argList;
38 va_start(argList, msg);
39 int count = vprintf(msg, argList);
40 va_end(argList);
41 return count;
42}
43#else
44inline int igl::verbose(const char * /*msg*/,...)
45{
46 return 0;
47}
48#endif
49
50#endif
Definition AABB.h:17
int verbose(const char *msg,...)
Provide a wrapper for printf, called verbose that functions exactly like printf if VERBOSE is defined...
Definition verbose.h:44
void count(const Eigen::SparseMatrix< XType > &X, const int dim, Eigen::SparseVector< SType > &S)
Count the number of non-zeros in the columns or rows of a sparse matrix.