You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
2.1 KiB
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/*********************************************************************
*文件说明: 为了内部提高效率可以直接获取变量模块的内存地址并使用API调用
主要为了方便目标模块需要频繁用到变量功能
*作者: logos
*日期: 2018/11/09
*修改日志: 2018/11/09 logos create
***********************************************************************/
#pragma once
#ifndef DLL_INCLUDE_IPVAR_H
#define DLL_INCLUDE_IPVAR_H
#ifndef EXPORT_C
#define EXPORT_C extern "C"
#endif
#ifndef WINAPI
#define WINAPI __stdcall
#endif
class ipvar
{//变量操作类接口
public:
virtual int type() = 0;
virtual void lock() = 0;
virtual void unlock() = 0;
virtual bool islock() = 0;
virtual int seti(int val) = 0;
virtual int setd(double dval) = 0;
virtual int sets(const char* szval) = 0;
virtual int wait(int val) = 0;
virtual int geti() = 0;
virtual double getd() = 0;
virtual const char* getcs() = 0;
virtual int gets(char* szval) = 0;
};
//导出接口
EXPORT_C int WINAPI ipvar_type(ipvar* p);
EXPORT_C void WINAPI ipvar_lock(ipvar* p);
EXPORT_C void WINAPI ipvar_unlock(ipvar* p);
EXPORT_C int WINAPI ipvar_islock(ipvar* p);
EXPORT_C int WINAPI ipvar_wait(ipvar* p, int val);
EXPORT_C int WINAPI ipvar_geti(ipvar* p);
EXPORT_C double WINAPI ipvar_getd(ipvar* p);
EXPORT_C int WINAPI ipvar_gets(ipvar* p, char* val);
EXPORT_C int WINAPI ipvar_seti(ipvar* p, int val);
EXPORT_C int WINAPI ipvar_setd(ipvar* p, double val);
EXPORT_C int WINAPI ipvar_sets(ipvar* p, const char* val);
/****************************************************
*Function: 通过变量ID获取变量操作类
*Intput: key 变量ID
*Output: NULL
*Return: 成功返回类对象,失败返回NULL
******************************************************/
EXPORT_C ipvar* WINAPI get_ipvar(int key);
/****************************************************
*Function: 通过变量名称获取变量操作类
*Intput: key 变量ID
*Output: NULL
*Return: 成功返回类对象,失败返回NULL
******************************************************/
EXPORT_C ipvar* WINAPI get_ipvars(const char* key);
#endif