Skip to content

Commit

Permalink
mostly cleaning: remove integral_types.h and basictypes.h
Browse files Browse the repository at this point in the history
  • Loading branch information
lperron committed Aug 24, 2023
1 parent d08a7ff commit fa6883d
Show file tree
Hide file tree
Showing 137 changed files with 530 additions and 636 deletions.
4 changes: 2 additions & 2 deletions cmake/python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/util/__init__.py CONTENT "")
file(GENERATE OUTPUT ${PYTHON_PROJECT_DIR}/util/python/__init__.py CONTENT "")

file(COPY
ortools/linear_solver/linear_solver_natural_api.py
DESTINATION ${PYTHON_PROJECT_DIR}/linear_solver)
ortools/linear_solver/python/linear_solver_natural_api.py
DESTINATION ${PYTHON_PROJECT_DIR}/linear_solver/python)
file(COPY
ortools/linear_solver/python/model_builder.py
ortools/linear_solver/python/model_builder_numbers.py
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/costas_array_sat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/sat/cp_model.h"
#include "ortools/sat/model.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cvrp_disjoint_tw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "google/protobuf/text_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_index_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cvrptw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "google/protobuf/text_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_index_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cvrptw_with_breaks.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "google/protobuf/text_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_enums.pb.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cvrptw_with_refueling.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "google/protobuf/text_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_index_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cvrptw_with_resources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "google/protobuf/text_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_index_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/cvrptw_with_stop_times_and_resources.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "google/protobuf/text_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/constraint_solver/routing.h"
#include "ortools/constraint_solver/routing_index_manager.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/dobble_ls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include "absl/strings/str_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/map_util.h"
#include "ortools/constraint_solver/constraint_solveri.h"
#include "ortools/util/bitset.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/golomb_sat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "absl/strings/str_format.h"
#include "google/protobuf/text_format.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/sat/cp_model.h"
#include "ortools/sat/model.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/magic_sequence_sat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "absl/flags/flag.h"
#include "absl/strings/str_format.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/sat/cp_model.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/magic_square_sat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/sat/cp_model.h"
#include "ortools/sat/model.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/cpp/nqueens.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "absl/strings/str_format.h"
#include "ortools/base/commandlineflags.h"
#include "ortools/base/init_google.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/base/map_util.h"
#include "ortools/constraint_solver/constraint_solveri.h"
Expand Down
2 changes: 1 addition & 1 deletion examples/tests/remote/tsp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#include "base/callback.h"
#include "base/commandlineflags.h"
#include "base/integral_types.h"
#include "base/types.h"
#include "base/join.h"
#include "base/random.h"
#include "base/unique_ptr.h"
Expand Down
11 changes: 7 additions & 4 deletions ortools/algorithms/set_cover_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,16 @@ void SetCoverModel::AddEmptySubset(Cost cost) {
row_view_is_valid_ = false;
}

void SetCoverModel::AddElementToLastSubset(int element) {
ElementIndex new_element(element);
columns_.back().push_back(new_element);
num_elements_ = std::max(num_elements_, new_element + 1);
void SetCoverModel::AddElementToLastSubset(ElementIndex element) {
columns_.back().push_back(element);
num_elements_ = std::max(num_elements_, element + 1);
row_view_is_valid_ = false;
}

void SetCoverModel::AddElementToLastSubset(int element) {
AddElementToLastSubset(ElementIndex(element));
}

void SetCoverModel::SetSubsetCost(int subset, Cost cost) {
const SubsetIndex subset_index(subset);
const SubsetIndex size = std::max(columns_.size(), subset_index + 1);
Expand Down
1 change: 1 addition & 0 deletions ortools/algorithms/set_cover_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class SetCoverModel {
// Adds an element to the last subset created. In matrix terms, this adds a
// 1 on row 'element' of the current last column of the matrix.
void AddElementToLastSubset(int element);
void AddElementToLastSubset(ElementIndex element);

// Sets 'cost' to an already existing 'subset'.
void SetSubsetCost(int subset, Cost cost);
Expand Down
44 changes: 13 additions & 31 deletions ortools/base/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,8 @@ cc_library(
hdrs = [
"commandlineflags.h",
"init_google.h",
"integral_types.h",
"logging.h",
"stl_logging.h",
"types.h",
"version.h",
],
copts = [
Expand All @@ -63,10 +61,9 @@ cc_library(
}),
deps = [
":commandlineflags",
":integral_types",
":types",
":logging",
":macros",
":types",
"@com_google_absl//absl/base",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/container:flat_hash_set",
Expand Down Expand Up @@ -95,24 +92,20 @@ cc_library(
],
deps = [
":base",
":basictypes",
":types",
],
)

cc_library(
name = "basictypes",
hdrs = ["basictypes.h"],
deps = [
":integral_types",
":logging",
],
name = "types",
hdrs = ["types.h"],
)

cc_library(
name = "bitmap",
srcs = ["bitmap.cc"],
hdrs = ["bitmap.h"],
deps = [":integral_types"],
deps = [":types"],
)

cc_library(
Expand Down Expand Up @@ -242,7 +235,7 @@ cc_library(
hdrs = ["gzipfile.h"],
deps = [
":base",
":basictypes",
":types",
":file",
":path",
"@com_google_absl//absl/strings",
Expand All @@ -268,7 +261,7 @@ cc_library(
"hash.h",
],
deps = [
":integral_types",
":types",
"@com_google_absl//absl/strings",
],
)
Expand All @@ -279,12 +272,6 @@ cc_library(
deps = [":base"],
)

cc_library(
name = "integral_types",
hdrs = ["integral_types.h"],
deps = [":types"],
)

cc_library(
name = "intops",
hdrs = ["strong_int.h"],
Expand Down Expand Up @@ -330,11 +317,6 @@ cc_library(
],
)

cc_library(
name = "types",
hdrs = ["types.h"],
)

cc_library(
name = "vlog",
srcs = ["vlog_is_on.cc"],
Expand All @@ -343,7 +325,7 @@ cc_library(
"vlog_is_on.h",
],
deps = [
":integral_types",
":types",
"@com_google_absl//absl/flags:flag",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:check",
Expand All @@ -366,7 +348,7 @@ cc_library(
hdrs = ["mathutil.h"],
deps = [
":base",
":basictypes",
":types",
],
)

Expand Down Expand Up @@ -501,7 +483,7 @@ cc_library(
srcs = ["strtoint.cc"],
hdrs = ["strtoint.h"],
deps = [
":integral_types",
":types",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/strings",
],
Expand All @@ -512,7 +494,7 @@ cc_library(
srcs = ["sysinfo.cc"],
hdrs = ["sysinfo.h"],
deps = [
":integral_types",
":types",
"@com_google_absl//absl/strings",
],
)
Expand All @@ -532,7 +514,7 @@ cc_library(
srcs = ["timer.cc"],
hdrs = ["timer.h"],
deps = [
":integral_types",
":types",
":macros",
"@com_google_absl//absl/log:check",
"@com_google_absl//absl/time",
Expand All @@ -549,7 +531,7 @@ cc_library(
srcs = ["zipfile.cc"],
hdrs = ["zipfile.h"],
deps = [
":basictypes",
":types",
":file",
":path",
":stl_util",
Expand Down
2 changes: 1 addition & 1 deletion ortools/base/adjustable_priority_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include <list>
#include <vector>

#include "ortools/base/basictypes.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/base/macros.h"

Expand Down
2 changes: 1 addition & 1 deletion ortools/base/base.i
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <string>
#include <vector>

#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
%}

%include "typemaps.i"
Expand Down
21 changes: 0 additions & 21 deletions ortools/base/basictypes.h

This file was deleted.

2 changes: 1 addition & 1 deletion ortools/base/bitmap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#include <algorithm>

#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"

namespace operations_research {

Expand Down
2 changes: 1 addition & 1 deletion ortools/base/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <cassert>
#include <cstring>

#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"

namespace operations_research {
namespace internal {
Expand Down
2 changes: 1 addition & 1 deletion ortools/base/container_logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include <type_traits>

#include "absl/base/port.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"

namespace gtl {

Expand Down
2 changes: 1 addition & 1 deletion ortools/base/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "google/protobuf/io/tokenizer.h"
#include "google/protobuf/message.h"
#include "google/protobuf/text_format.h"
#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"
#include "ortools/base/logging.h"
#include "ortools/base/status_macros.h"

Expand Down
2 changes: 1 addition & 1 deletion ortools/base/gzipfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define OR_TOOLS_BASE_GZIPFILE_H_

#include "absl/strings/string_view.h"
#include "ortools/base/basictypes.h" // for Ownership enum
#include "ortools/base/types.h" // for Ownership enum
#include "zlib.h" // for Z_DEFAULT_COMPRESSION

class File;
Expand Down
2 changes: 1 addition & 1 deletion ortools/base/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <string>
#include <utility>

#include "ortools/base/integral_types.h"
#include "ortools/base/types.h"

// In SWIG mode, we don't want anything besides these top-level includes.
#if !defined(SWIG)
Expand Down
Loading

0 comments on commit fa6883d

Please sign in to comment.