/* * Copyright (c) 2018-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the LICENSE * file in the root directory of this source tree. * */ #pragma once #include #include #include class SonarStep; class SonarStateUpdateListener; class SonarState { friend SonarStep; public: SonarState(); void setUpdateListener(std::shared_ptr); std::string getState(); /* To record a state update, call start() with the name of the step to get a SonarStep object. Call complete on this to register it successful, the absense of the completion call when it is destructed will register as a step failure. */ std::shared_ptr start(std::string step); private: void success(std::string); void failed(std::string, std::string); void started(std::string); std::shared_ptr mListener = nullptr; std::string stateUpdates; };