OR-Tools  9.2
name_validator.h
Go to the documentation of this file.
1// Copyright 2010-2021 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef OR_TOOLS_MATH_OPT_VALIDATORS_NAME_VALIDATOR_H_
15#define OR_TOOLS_MATH_OPT_VALIDATORS_NAME_VALIDATOR_H_
16
17#include <string>
18
19#include "absl/status/status.h"
22
23namespace operations_research {
24namespace math_opt {
25
26// Checks basic validity of name_vector view: i.e. ids_size() = values_size().
27// In addition, if check_unique is set to true, the function checks that every
28// name that is not "" is distinct.
29absl::Status CheckNameVector(
30 const SparseVectorView<const std::string*>& name_vector, bool check_unique);
31
32// Checks new_names are compatible with old_names: i.e. new_names does not
33// duplicate names in old_names. Assumes basic validity of new_names view and
34// does not check for duplicates within old_names or new_names.
35absl::Status CheckNewNames(
36 const IdNameBiMap& old_names,
37 const SparseVectorView<const std::string*>& new_names);
38
39} // namespace math_opt
40} // namespace operations_research
41
42#endif // OR_TOOLS_MATH_OPT_VALIDATORS_NAME_VALIDATOR_H_
absl::Status CheckNewNames(const IdNameBiMap &old_names, const SparseVectorView< const std::string * > &new_names)
absl::Status CheckNameVector(const SparseVectorView< const std::string * > &name_vector, const bool check_unique)
Collection of objects used to extend the Constraint Solver library.