* This file is part of the MindStudio project.
* Copyright (c) 2025 Huawei Technologies Co.,Ltd.
*
* MindStudio is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* ------------------------------------------------------------------------- */
#ifndef __CORE_LOCAL_PROCESS_H__
#define __CORE_LOCAL_PROCESS_H__
#include <cstdint>
#include <string>
#include <csignal>
#include "Communication.h"
enum class LogLevel : uint8_t {
DEBUG = 0U,
INFO,
WARN,
ERROR,
};
class LocalProcess {
public:
explicit LocalProcess(CommType type);
static LocalProcess &GetInstance(CommType type = CommType::SOCKET);
~LocalProcess();
void Log(LogLevel level, std::string msg) const;
ssize_t Notify(std::string const &msg) const;
ssize_t Wait(std::string& msg, uint32_t timeOut = 10) const;
int TerminateWithSignal(int signo = SIGINT) const;
private:
Client* client_ = nullptr;
};
ssize_t Notify(std::string message);
ssize_t Wait(std::string& msg);
void DebugLog(std::string message);
void InfoLog(std::string message);
void WarnLog(std::string message);
void ErrorLog(std::string message);
#endif