blob: 30e4476d72791bafed42547fd5af078cfec4945d [file] [log] [blame] [edit]
#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.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_BORG_MGMT_NODE_PROXY_SAFEPOWER_SAFEPOWER_AGENT_STATE_MERGE_H_