ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
sqlite3_utils.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <cstdio>
11 #include <cstdlib>
12 #include <string>
13 
14 #include "SQLite/sqlite3.h"
15 
16 namespace colmap {
17 
18 inline int SQLite3CallHelper(const int result_code,
19  const std::string& filename,
20  const int line_number) {
21  switch (result_code) {
22  case SQLITE_OK:
23  case SQLITE_ROW:
24  case SQLITE_DONE:
25  return result_code;
26  default:
27  fprintf(stderr, "SQLite error [%s, line %i]: %s\n",
28  filename.c_str(), line_number, sqlite3_errstr(result_code));
29  exit(EXIT_FAILURE);
30  }
31 }
32 
33 #define SQLITE3_CALL(func) SQLite3CallHelper(func, __FILE__, __LINE__)
34 
35 #define SQLITE3_EXEC(database, sql, callback) \
36  { \
37  char* err_msg = nullptr; \
38  const int result_code = \
39  sqlite3_exec(database, sql, callback, nullptr, &err_msg); \
40  if (result_code != SQLITE_OK) { \
41  fprintf(stderr, "SQLite error [%s, line %i]: %s\n", __FILE__, \
42  __LINE__, err_msg); \
43  sqlite3_free(err_msg); \
44  } \
45  }
46 
47 } // namespace colmap
filename
std::string filename
Definition: PointCloudIO.cpp:47
colmap::SetPRNGSeed
void SetPRNGSeed(unsigned seed)
Definition: random.cc:40
colmap::RandomInteger
T RandomInteger(const T min, const T max)
Definition: random.h:64
testing.h
colmap::RandomReal
T RandomReal(const T min, const T max)
Definition: random.h:75
math.h
random.h
BOOST_AUTO_TEST_CASE
BOOST_AUTO_TEST_CASE(TestPRNGSeed)
Definition: random_test.cc:42
colmap::SQLite3CallHelper
int SQLite3CallHelper(const int result_code, const std::string &filename, const int line_number)
Definition: sqlite3_utils.h:18
e
const double * e
Definition: essential_matrix_poly.h:10
colmap::Mean
double Mean(const std::vector< T > &elems)
Definition: math.h:227
colmap::PRNG
thread_local std::unique_ptr< std::mt19937 > PRNG
Definition: random.cc:38
colmap::StdDev
double StdDev(const std::vector< T > &elems)
Definition: math.h:248
colmap::Shuffle
void Shuffle(const uint32_t num_to_shuffle, std::vector< T > *elems)
Definition: random.h:96
colmap
Definition: AutomaticReconstructionController.h:17
colmap::RandomGaussian
T RandomGaussian(const T mean, const T stddev)
Definition: random.h:86