hunting/utils/SharedData/src/ISharedData.h
2024-04-18 22:35:31 +08:00

41 lines
1.5 KiB
C++

/*
* Copyright (c) 2023 Fancy Code.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef I_SHARED_DATA_H
#define I_SHARED_DATA_H
#include "SharedData.h"
#include "StatusCode.h"
#include <memory>
class ISharedData
{
public:
ISharedData() = default;
virtual ~ISharedData() = default;
virtual void MakeSharedMemory(const unsigned int readableSize, const unsigned int writableSize);
virtual const StatusCode GetReadableMemory(void *buf, const unsigned int &bufLength);
virtual void SetWritableMemory(void *buf, const unsigned int &bufLength);
virtual StatusCode FreeSharedMemory(void);
};
typedef struct i_shared_data_header
{
const char *mCheckName;
} ISharedDataHeader;
typedef struct config_base
{
ISharedDataHeader mHeader;
std::shared_ptr<ISharedData> mISharedData;
} SharedData;
const char *GetSharedDataModuleName(void);
std::shared_ptr<ISharedData> *NewSharedData(const enum SHARER_NAME &name, const char *path, const int &projectId);
#endif