Open3D (C++ API)
Console.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
29 #include <Eigen/Core>
30 #include <string>
31 #include <vector>
32 #define DEFAULT_IO_BUFFER_SIZE 1024
33 
34 namespace open3d {
35 namespace utility {
36 
37 enum class VerbosityLevel {
38  VerboseError = 0,
39  VerboseWarning = 1,
40  VerboseInfo = 2,
41  VerboseDebug = 3,
42  VerboseAlways = 4
43 };
44 
45 void SetVerbosityLevel(VerbosityLevel verbosity_level);
46 
48 
49 void PrintError(const char *format, ...);
50 
51 void PrintWarning(const char *format, ...);
52 
53 void PrintInfo(const char *format, ...);
54 
55 void PrintDebug(const char *format, ...);
56 
57 void PrintAlways(const char *format, ...);
58 
59 void ResetConsoleProgress(const int64_t expected_count,
60  const std::string &progress_info = "");
61 
63 
64 std::string GetCurrentTimeStamp();
65 
66 std::string GetProgramOptionAsString(int argc,
67  char **argv,
68  const std::string &option,
69  const std::string &default_value = "");
70 
71 int GetProgramOptionAsInt(int argc,
72  char **argv,
73  const std::string &option,
74  const int default_value = 0);
75 
76 double GetProgramOptionAsDouble(int argc,
77  char **argv,
78  const std::string &option,
79  const double default_value = 0.0);
80 
81 Eigen::VectorXd GetProgramOptionAsEigenVectorXd(
82  int argc,
83  char **argv,
84  const std::string &option,
85  const Eigen::VectorXd default_value = Eigen::VectorXd::Zero(0));
86 
87 bool ProgramOptionExists(int argc, char **argv, const std::string &option);
88 
89 bool ProgramOptionExistsAny(int argc,
90  char **argv,
91  const std::vector<std::string> &options);
92 } // namespace utility
93 } // namespace open3d
std::string GetProgramOptionAsString(int argc, char **argv, const std::string &option, const std::string &default_value)
Definition: Console.cpp:223
void PrintDebug(const char *format,...)
Definition: Console.cpp:172
void PrintAlways(const char *format,...)
Definition: Console.cpp:183
double GetProgramOptionAsDouble(int argc, char **argv, const std::string &option, const double default_value)
Definition: Console.cpp:256
bool ProgramOptionExistsAny(int argc, char **argv, const std::vector< std::string > &options)
Definition: Console.cpp:308
void ResetConsoleProgress(const int64_t expected_count, const std::string &progress_info)
Definition: Console.cpp:194
void PrintInfo(const char *format,...)
Definition: Console.cpp:163
std::string GetCurrentTimeStamp()
Definition: Console.cpp:213
VerbosityLevel GetVerbosityLevel()
Definition: Console.cpp:139
void SetVerbosityLevel(VerbosityLevel verbosity_level)
Definition: Console.cpp:135
void PrintWarning(const char *format,...)
Definition: Console.cpp:152
int GetProgramOptionAsInt(int argc, char **argv, const std::string &option, const int default_value)
Definition: Console.cpp:235
VerbosityLevel
Definition: Console.h:37
void PrintError(const char *format,...)
Definition: Console.cpp:141
Definition: PinholeCameraIntrinsic.cpp:34
Eigen::VectorXd GetProgramOptionAsEigenVectorXd(int argc, char **argv, const std::string &option, const Eigen::VectorXd default_value)
Definition: Console.cpp:275
bool ProgramOptionExists(int argc, char **argv, const std::string &option)
Definition: Console.cpp:304
void AdvanceConsoleProgress()
Definition: Console.cpp:208