blob: 62ab9a1f5d4f7f386fb822770e0e14ab973639e7 [file] [log] [blame]
#ifndef PRODUCTION_BORG_MGMT_NODE_PROXY_SAFEPOWER_SAFEPOWER_AGENT_STATE_MERGE_H_
#define PRODUCTION_BORG_MGMT_NODE_PROXY_SAFEPOWER_SAFEPOWER_AGENT_STATE_MERGE_H_
#include "safepower_agent.proto.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_BORG_MGMT_NODE_PROXY_SAFEPOWER_SAFEPOWER_AGENT_STATE_MERGE_H_