chromium/components/performance_manager/public/voting/optional_voting_channel.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_VOTING_OPTIONAL_VOTING_CHANNEL_H_
#define COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_VOTING_OPTIONAL_VOTING_CHANNEL_H_

#include <map>
#include <optional>
#include <utility>

#include "base/check.h"
#include "components/performance_manager/public/voting/voting.h"

namespace performance_manager::voting {

// A voting channel that accepts std::nullopt votes. Those votes are not
// upstreamed. This voting channel is always valid unless moved from.
template <class VoteImpl>
class OptionalVotingChannel {};

template <class VoteImpl>
OptionalVotingChannel<VoteImpl>::OptionalVotingChannel(
    VotingChannel upstream_voting_channel)
    :{}

template <class VoteImpl>
OptionalVotingChannel<VoteImpl>::~OptionalVotingChannel() {}

template <class VoteImpl>
OptionalVotingChannel<VoteImpl>::OptionalVotingChannel(
    OptionalVotingChannel&& other) = default;

template <class VoteImpl>
OptionalVotingChannel<VoteImpl>& OptionalVotingChannel<VoteImpl>::operator=(
    OptionalVotingChannel&& other) = default;

template <class VoteImpl>
void OptionalVotingChannel<VoteImpl>::SubmitVote(
    const ContextType* context,
    const std::optional<VoteImpl>& vote) {}

template <class VoteImpl>
void OptionalVotingChannel<VoteImpl>::ChangeVote(
    const ContextType* context,
    const std::optional<VoteImpl>& vote) {}

template <class VoteImpl>
void OptionalVotingChannel<VoteImpl>::InvalidateVote(
    const ContextType* context) {}

}  // namespace performance_manager::voting

#endif  // COMPONENTS_PERFORMANCE_MANAGER_PUBLIC_VOTING_OPTIONAL_VOTING_CHANNEL_H_