blob: 38d59e7a5f1e11a6b4f7bbbe27686318028207b0 [file] [log] [blame]
#ifndef PRODUCTION_SUSHID_SAFEPOWER_AGENT_STATE_MERGE_H_
#define PRODUCTION_SUSHID_SAFEPOWER_AGENT_STATE_MERGE_H_
#include "safepower_agent.pb.h"
namespace safepower_agent {
template <typename Proto>
void ApplyStateUpdate(Proto& current_state,
const Proto& update) {
current_state.MergeFrom(update);
}
template <typename Proto>
Proto MergeState(const Proto& current_state, const Proto& update) {
Proto merged = current_state;
ApplyStateUpdate(merged, update);
return merged;
}
// Specialize for SystemState because it has a map field.
template <>
void ApplyStateUpdate(safepower_agent_proto::SystemState& current_state,
const safepower_agent_proto::SystemState& update);
} // namespace safepower_agent
#endif // PRODUCTION_SUSHID_SAFEPOWER_AGENT_STATE_MERGE_H_