Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
file_util.h File Reference
#include <string>
#include <vector>
#include "absl/log/check.h"
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "google/protobuf/message.h"
#include "ortools/base/file.h"
#include "ortools/base/options.h"
#include "ortools/base/recordio.h"
#include "ortools/base/status_macros.h"

Go to the source code of this file.

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 
namespace  operations_research::internal
 End of the interface. Below is the implementation.
 

Enumerations

enum class  operations_research::ProtoWriteFormat { operations_research::kProtoText , operations_research::kProtoBinary , operations_research::kJson , operations_research::kCanonicalJson }
 

Functions

absl::StatusOr< std::string > operations_research::ReadFileToString (absl::string_view filename)
 Reads a file, optionally gzipped, to a string.
 
absl::Status operations_research::ReadFileToProto (absl::string_view filename, google::protobuf::Message *proto, bool allow_partial)
 
absl::Status operations_research::StringToProto (absl::string_view data, google::protobuf::Message *proto, bool allow_partial=false)
 Exactly like ReadFileToProto(), but directly from the contents.
 
template<typename Proto >
absl::StatusOr< Proto > operations_research::ReadFileToProto (absl::string_view filename, bool allow_partial=false)
 
absl::Status operations_research::WriteProtoToFile (absl::string_view filename, const google::protobuf::Message &proto, ProtoWriteFormat proto_write_format, bool gzipped, bool append_extension_to_file_name)
 
template<typename Proto >
std::vector< Proto > operations_research::internal::ReadNumRecords (File *file, int expected_num_records)
 
template<typename Proto >
std::vector< Proto > operations_research::internal::ReadNumRecords (absl::string_view filename, int expected_num_records)
 Ditto, taking a filename as argument.
 
template<typename Proto >
std::vector< Proto > operations_research::ReadAllRecordsOrDie (absl::string_view filename)
 
template<typename Proto >
std::vector< Proto > operations_research::ReadAllRecordsOrDie (File *file)
 
template<typename Proto >
Proto operations_research::ReadOneRecordOrDie (absl::string_view filename)
 
template<typename Proto >
void operations_research::WriteRecordsOrDie (absl::string_view filename, const std::vector< Proto > &protos)