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 <vector>
30 #include <string>
31 
32 #include <Eigen/Core>
33 #define DEFAULT_IO_BUFFER_SIZE 1024
34 
35 namespace open3d {
36 namespace utility {
37 
38 enum class VerbosityLevel {
39  VerboseError = 0,
40  VerboseWarning = 1,
41  VerboseInfo = 2,
42  VerboseDebug = 3,
43  VerboseAlways = 4
44 };
45 
46 void SetVerbosityLevel(VerbosityLevel verbosity_level);
47 
49 
50 void PrintError(const char *format, ...);
51 
52 void PrintWarning(const char *format, ...);
53 
54 void PrintInfo(const char *format, ...);
55 
56 void PrintDebug(const char *format, ...);
57 
58 void PrintAlways(const char *format, ...);
59 
60 void ResetConsoleProgress(const int64_t expected_count,
61  const std::string &progress_info = "");
62 
64 
65 std::string GetCurrentTimeStamp();
66 
67 std::string GetProgramOptionAsString(int argc,
68  char **argv,
69  const std::string &option,
70  const std::string &default_value = "");
71 
72 int GetProgramOptionAsInt(int argc,
73  char **argv,
74  const std::string &option,
75  const int default_value = 0);
76 
77 double GetProgramOptionAsDouble(int argc,
78  char **argv,
79  const std::string &option,
80  const double default_value = 0.0);
81 
82 Eigen::VectorXd GetProgramOptionAsEigenVectorXd(
83  int argc,
84  char **argv,
85  const std::string &option,
86  const Eigen::VectorXd default_value = Eigen::VectorXd::Zero(0));
87 
88 bool ProgramOptionExists(int argc, char **argv, const std::string &option);
89 
90 bool ProgramOptionExistsAny(int argc,
91  char **argv,
92  const std::vector<std::string> &options);
93 } // namespace utility
94 } // 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:38
void PrintError(const char *format,...)
Definition: Console.cpp:141
Definition: PinholeCameraIntrinsic.cpp:33
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