类定义:CMemberFuncPointer

=======================================================================

 // MemberFuncPointer.h: interface for the CMemberFuncPointer class.
//
////////////////////////////////////////////////////////////////////// #if !defined(AFX_MEMBERFUNCPOINTER_H__4D78718D_778E_4427_BBC1_C5F2D52C64E5__INCLUDED_)
#define AFX_MEMBERFUNCPOINTER_H__4D78718D_778E_4427_BBC1_C5F2D52C64E5__INCLUDED_ #if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000 // 成员函数指针最大长度
#define MEMBER_FUNC_POINTER_MAX_SIZE 32
class CMemberFuncPointer
{
public:
void Reset();
void Set(const void*pFunc,int p_size);
void Get(void*pFunc);
CMemberFuncPointer();
CMemberFuncPointer(const char pointerdata[],int p_size);
CMemberFuncPointer(void* pointerdata,int p_size);
virtual ~CMemberFuncPointer(); bool operator==(const CMemberFuncPointer &mfp) const;
bool operator!=(const CMemberFuncPointer &mfp) const; CMemberFuncPointer& operator=(const CMemberFuncPointer &mfp); private:
int m_size;
char m_pointer_data[MEMBER_FUNC_POINTER_MAX_SIZE];
}; #endif // !defined(AFX_MEMBERFUNCPOINTER_H__4D78718D_778E_4427_BBC1_C5F2D52C64E5__INCLUDED_)

MemberFuncPointer.h

 // MemberFuncPointer.cpp: implementation of the CMemberFuncPointer class.
//
////////////////////////////////////////////////////////////////////// #include "stdafx.h"
#include "OverlapRoutine.h"
#include "MemberFuncPointer.h" #ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif //////////////////////////////////////////////////////////////////////
// Construction/Destruction
////////////////////////////////////////////////////////////////////// CMemberFuncPointer::CMemberFuncPointer()
{
this->m_size = ;
} CMemberFuncPointer::CMemberFuncPointer(const char pointerdata[],int p_size)
{
if(p_size<=MEMBER_FUNC_POINTER_MAX_SIZE)
{
this->m_size = p_size;
memcpy(this->m_pointer_data,pointerdata,p_size);
}
else
{
this->m_size = ;
}
} CMemberFuncPointer::CMemberFuncPointer(void* pointerdata,int p_size)
{
if(p_size<=MEMBER_FUNC_POINTER_MAX_SIZE)
{
this->m_size = p_size;
memcpy(this->m_pointer_data,pointerdata,p_size);
}
else
{
this->m_size = ;
}
} CMemberFuncPointer::~CMemberFuncPointer()
{ } bool CMemberFuncPointer::operator==(const CMemberFuncPointer &mfp) const
{
if(this->m_size==mfp.m_size) //mfp.m_size 可以访问私有成员
{
if(==memcmp(this->m_pointer_data,mfp.m_pointer_data,this->m_size))
{
return true;
}
} return false;
} bool CMemberFuncPointer::operator!=(const CMemberFuncPointer &mfp) const
{
if(this->m_size==mfp.m_size) //mfp.m_size 可以访问私有成员
{
if(==memcmp(this->m_pointer_data,mfp.m_pointer_data,this->m_size))
{
return false;
}
} return true;
} void CMemberFuncPointer::Get(void *pFunc)
{
memcpy(pFunc,this->m_pointer_data,this->m_size);
} void CMemberFuncPointer::Set(const void *pFunc,int p_size)
{
memcpy(this->m_pointer_data,pFunc,p_size);
this->m_size = p_size;
} void CMemberFuncPointer::Reset()
{
this->m_size = ;
} CMemberFuncPointer& CMemberFuncPointer::operator =(const CMemberFuncPointer &mfp)
{
if(this != &mfp)
{
memcpy(this->m_pointer_data,mfp.m_pointer_data,mfp.m_size); //mfp.m_pointer_data 可以访问私有成员
this->m_size = mfp.m_size; //mfp.m_size 可以访问私有成员
} return *this;
}

CMemberFuncPointer.cpp

C++ 对象间通信框架 V2.0 ××××××× 之(四)的更多相关文章

  1. C++ 对象间通信框架 V2.0 ××××××× 之一

    V2.0 主要是信号槽连接的索引性能做了改进,新设计了程序构架实现了多级分层索引,索引时间性能基本不受连接表的大小影响. 类定义:CSignalSlot C_MemberFuncPointer C_s ...

  2. C++ 对象间通信框架 V2.0 ××××××× 之(三)

    类定义:CSignalSlot ======================================================================= // SignalSlo ...

  3. C++ 对象间通信框架 V2.0 ××××××× 之(五)

    类定义: ======================================================================= // MemberFuncPointer.h: ...

  4. C++ 对象间通信框架 V2.0 ××××××× 之(二)

    公共头文件:ss_type_def.h ================================================================================ ...

  5. 文件断点续传原理与实现—— ESFramework 通信框架4.0 进阶(12)

    在ESFramework通信框架 4.0 快速上手(13) -- 文件传送,如此简单一文的详细介绍和ESFramework通信框架 4.0 快速上手(14) -- 聊天系统Demo,增加文件传送功能( ...

  6. C++对象间通信组件,让C++对象“无障碍交流”

    介绍 这是很久之前的一个项目了,最近刚好有些时间,就来总结一下吧! 推荐初步熟悉项目后阅读本文: https://gitee.com/smalldyy/easy-msg-cpp 从何而来 这要从我从事 ...

  7. 可靠通信的保障 —— 使用ACK机制发送自定义信息——ESFramework 通信框架4.0 快速上手(12)

    使用ESPlus.Application.CustomizeInfo.Passive.ICustomizeInfoOutter接口的Send方法,我们已经可以给服务端或其它在线客户端发送自定义信息了, ...

  8. 接口自动化 基于python+Testlink+Jenkins实现的接口自动化测试框架[V2.0改进版]

    基于python+Testlink+Jenkins实现的接口自动化测试框架[V2.0改进版]   by:授客 QQ:1033553122 由于篇幅问题,,暂且采用网盘分享的形式: 下载地址: [授客] ...

  9. ESPlatform 支持的三种群集模型 —— ESFramework通信框架 4.0 进阶(09)

    对于最多几千人同时在线的通信应用,通常使用单台服务器就可以支撑.但是,当同时在线的用户数达到几万.几十万.甚至百万的时候,我们就需要很多的服务器来分担负载.但是,依据什么规则和结构来组织这些服务器,并 ...

随机推荐

  1. Docker Toolbox虚拟机文件地址修改 以及镜像加速

    Docker Toolbox虚拟机文件地址修改  默认情况下,docker-machine创建的虚拟机文件,是保存在C盘的C:\Users\用户名\.docker\machine\machines\d ...

  2. Vim文本编辑工具

    4文本编辑工具Vim Vim是vi的升级版,编辑文本时vi不会显示颜色而vim会显示颜色. 安装vim工具 #yum  install  –y  vim-enhanced Vim有三种模式:一般模式. ...

  3. Monkey常用命令详解

    使用monkey help 命令查看命令参数,如下: C:\Users\chenfenping>adb shell monkey -help usage: monkey [-p ALLOWED_ ...

  4. PY个树状数组

    树状数组看起来比较简单,于是就挑它下手了... 于是生活终于也对咱下手了... 要讲的就两个东西,一个是开数组,全局变量写最前面,数组是这么开的: f=[0 for i in range(500005 ...

  5. TMS320F28335——下载程序到flash中

    一.让CCS软件支持Flash烧写 添加F28335.cmd文件 如图屏蔽掉25335_RAM_lnk.cmd 2.支持从Flash中拷贝文件到RAM中 添加DSP2832x_MemCopy.c 在主 ...

  6. svn版本服务器的搭建和简单使用

    ⼀ 服务器搭建篇 1 在”应⽤用程序”⽂文件夹下,找到”实⽤用⼯工具”,打开”终端”APP 2 运⾏行svnadmin create repository,运⾏行完毕之后,可以在当前⺫⽬目录下找 到⼀ ...

  7. Hibernate:基于HQL实现数据查询

    HQL:  hibernate query language(hibernate特有的查询语言) hql是基于对象的查询语言,其语法与sql类似,但是他和sql的区别在于sql是面向表和字段的查询,而 ...

  8. Linux vim程序编辑器

    Tips: 在 vi 里面, [tab] 这个按钮所得到的结果与空格符所得到的结果是不一样的,特别强调一下! 一般模式 移动光标 30↓ 向下移动30行 40→ 向右移动40个字符 gg 移动到档案第 ...

  9. js 动态时间

    <script type="text/javascript"> function show_cur_times(){ //获取当前日期 var date_time = ...

  10. bzoj4238 & loj2881 电压 二分图判定+dfs树

    题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=4238 https://loj.ac/problem/2881 题解 如果想要让每一条边都有电流 ...