blob: adffde71a63f8aafdfb6ca245ec544b3d28bf4b6 [file] [log] [blame]
// camera/mojo/cros_camera_enum.mojom-shared.cc is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "camera/mojo/cros_camera_enum.mojom-shared.h"
// Used to support stream output operator for enums.
// TODO(dcheng): Consider omitting this somehow if not needed.
#include <ostream>
#include <utility>
#include "base/strings/stringprintf.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/lib/validation_util.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "camera/mojo/cros_camera_enum.mojom-params-data.h"
namespace cros {
namespace mojom {
NOINLINE static const char* CameraSensorSyncTimestampToStringHelper(CameraSensorSyncTimestamp value) {
// Defined in a helper function to ensure that Clang generates a lookup table.
switch(value) {
case CameraSensorSyncTimestamp::BACKWARD:
return "BACKWARD";
case CameraSensorSyncTimestamp::NEAREST:
return "NEAREST";
case CameraSensorSyncTimestamp::NONE:
return "NONE";
default:
return nullptr;
}
}
std::string CameraSensorSyncTimestampToString(CameraSensorSyncTimestamp value) {
const char *str = CameraSensorSyncTimestampToStringHelper(value);
if (!str) {
return base::StringPrintf("Unknown CameraSensorSyncTimestamp value: %i", static_cast<int32_t>(value));
}
return str;
}
std::ostream& operator<<(std::ostream& os, CameraSensorSyncTimestamp value) {
return os << CameraSensorSyncTimestampToString(value);
}
namespace internal {
} // namespace internal
} // namespace mojom
} // namespace cros
namespace perfetto {
// static
void TraceFormatTraits<::cros::mojom::CameraSensorSyncTimestamp>::WriteIntoTrace(
perfetto::TracedValue context, ::cros::mojom::CameraSensorSyncTimestamp value) {
return std::move(context).WriteString(::cros::mojom::CameraSensorSyncTimestampToString(value));
}
} // namespace perfetto