资源简介
算是一个消息处理框架吧,用于说函数对象function与bind的基本用法;
比较适合入门boost的function与bind的基本用法
代码片段和文件信息
#include
#include
#include “process_data.h“
using namespace std;
int printHelpInfo(string cmd const void *pData int dataLen)
{
cout <<“-----------------------------------“< cout <<“help info:“< cout <<“help: print this info.“< cout <<“ver : print this demo ver.“< cout <<“test: process test class func cmd.“< cout <<“q : exit.“< cout <<“-----------------------------------“<
return 0;
}
int printVer(string cmd const void *pData int dataLen)
{
cout <<“in printVer ver 1.0.0“< return 0;
}
class testDataProc
{
public:
int TestDataProcFunc(string cmd const void *pData int dataLen)
{
cout << “in testDataProc::TestDataProcFunc process cmd “< return 0;
}
};
int main(int argc char **argv)
{
//静态函数注册
CDataProcess::getInstance()->registProcHandle(“help“ printHelpInfo);
CDataProcess::getInstance()->registProcHandle(“ver“ printVer);
//测试类成员函数注册
testDataProc testProcObj;
CDataProcess::getInstance()->registProcHandle(“test“boost::bind(&testDataProc::TestDataProcFunc testProcObj _1 _2 _3));
char cInPutBuf[256] = {0};
while ( true )
{
printf(“inPut cmd>: “);
bzero(cInPutBuf sizeof(cInPutBuf));
cin.getline(cInPutBufsizeof(cInPutBuf));
if (cInPutBuf[0] == ‘q‘)
{
cout <<“Bye!“< break;
}
CDataProcess::getInstance()->processDataFunction(cInPutBuf NULL 0);
}
return 0;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2018-01-09 17:47 dataProc\
文件 1535 2018-01-09 17:41 dataProc\main.cpp
文件 594 2018-01-09 17:43 dataProc\Makefile
文件 3363 2018-01-09 17:46 dataProc\process_data.cpp
文件 1440 2018-01-09 17:46 dataProc\process_data.h
文件 283 2018-01-09 17:47 dataProc\public.h
文件 25288 2018-01-09 17:45 dataProc\示例截图.png
- 上一篇:cpp实现的消息处理框架
- 下一篇:Solaris8-11 iso镜像
相关资源
- cpp实现的消息处理框架
- Boost+LLC闭环调节器设计.xmcd
- 数学函数手册Handbook of Mathematical Fun
- R实现汇率展示-小function
- Benchmark functions 优化算法测试函数
- 类型理论与函数式编程Type Theory and
- ELMfunction.rar
- The_Gamma_function
- AURIX_Training_FunctionSafety
- 函数库用于计算 HMAC 值
- Variable Exponent Functionals in Image Restora
-
Multifractal analysis of Chinese stocks ba
s - Single machine scheduling with processing time
- A method for the harmonic analysis of tides ba
- Entire Functions of Exponential-Type with Give
- Exponential Stability of Impulsive Stochastic
- Functional redundancy instead of species redun
- The anti-plane dynamic fracture analysis of fu
- Origin evolution and functional diversity of b
- Impaired function of MSCs from ITP patients in
- Hands-On Functional Programming in Rust 1st Ed
- PCI-82548 AMP-2048C Function Library V1.1.pdf
- 半自动(arcusfunctions.smartlib)
评论
共有 条评论