2014-03-29 星期六10:31:48c/c++函数指针demo1、funcptr.hh12345678910111213141516171819202122232425262728293031323334//funcptr democlass CFuncPtr //:public CThread{public:static CFuncPtr* createNew(int chn=0, int type=0);public:static void *(*funcentry[8])(void *para); //demo,没继承CThread,就这样了static void *Thread Read More
posted @ 2014-03-29 10:37 自由度 Views(448) Comments(0) Diggs(0)
2014-03-16星期日15:26:39Builder,继续GOF。1、Intent​Separatetheconstructionofacomplexobjectfromitsrepresentationsothatthesameconstructionprocesscancreatedifferentrepresentations.将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创... Read More
posted @ 2014-03-25 21:22 自由度 Views(313) Comments(0) Diggs(0)
2014-03-23星期日21:19:26Strategy,继续GOF。1、IntentDefineafamilyofalgorithms,encapsulateeachone,andmaketheminterchangeable.Strategyletsthealgorithmvaryindependentlyfromclientsthatuseit.定义一系列的算法,把它们一个个封装起来,并且... Read More
posted @ 2014-03-25 21:17 自由度 Views(262) Comments(0) Diggs(0)
2014-01-18星期六11:12:42Singleton,继续GOF。1、IntentEnsureaclassonlyhasoneinstance,andprovideaglobalpointofaccesstoit.保证一个类仅有一个实例,并提供一个访问它的全局访问点。2、AlsoKnownAs3、MotivationIt'simportantforsomeclassestohaveexac... Read More
posted @ 2014-03-25 21:16 自由度 Views(693) Comments(0) Diggs(0)
22:01:24星期一22:01:37Bridge,继续GOF。和Stratege模式相比,Bridge可以说是“包含Stratege”。Stratege : 1个物件对应N个实现。仅 实现端(类) 有细分。Bridge : M个物件对应N个实现。抽象端(类)和实现端(类) 都有细分。1、IntentDecoupleanabstractionfromitsimplementationsothat... Read More
posted @ 2014-03-23 11:33 自由度 Views(437) Comments(0) Diggs(0)
结构体互相指向,一般有以下应用场景。最主要的是不要误认为结构体互相指向是"箱中箱"(网上真有这样认知的)。1、相互回溯,一一对应关系struct A 和 struct B逻辑关系式一一对应。典型的如page和button,main menu和sub menu。● page 和 button123456789101112131415161718192021222324#define MAX_BUTT... Read More
posted @ 2014-03-09 17:24 自由度 Views(389) Comments(0) Diggs(0)
GCC中允许使用零长数组(__GNUC__>=3)。零长数组在有固定头部的可变对象上非常适用,我们可以根据对象的大小动态地去分配结构体的大小。gui ftk里经常用的。在分配内存时,零长数组指向变长的PrivInfo。FTK_ZALLOC(sizeof(FtkSource)+sizeof(PrivInfo))1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950#if __GNUC__ >= 3#define ZERO_LEN_ARRAY 0#else#d Read More
posted @ 2014-03-09 15:57 自由度 Views(249) Comments(0) Diggs(0)
void * 指针算术运算【-Wpointer-arith】1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556#ifdef __cplusplusextern "C"{#endif#include #include int main(int argc,char* argv[]){printf("argc(%d)\n",argc);int n = 0;for(n=0;n<argc;++n){pri Read More
posted @ 2014-03-09 09:53 自由度 Views(1689) Comments(0) Diggs(0)
自己调试OK的客户端discovery功能,discovery code先从remotediscovery.wsdl解析入手吧。可以参考此网页WSDL实例解析和一个完整的WSDL文档及各标签详解。1、命名空间这个非常重要,直接导致是否可以调用到web server的功能函数。1targetNamespace="http://www.onvif.org/ver10/network/wsdl",采用的命空间。2、结构体定义1234567891011121314schemaLocation="http://schemas.xmlsoap.org/ws/2005/04/d Read More
posted @ 2014-02-22 21:54 自由度 Views(2012) Comments(0) Diggs(0)
2014-02-2221:45:46最近要增加onvif的客户端,通过一段时间的摸索和网上借鉴,几经周转,终于有了点眉目。现在把期间的过程记录下来。1、网上资源ONVIF开发总结快活林高老大onvif规范的实现2、gsoap安装本人刚开始使用的是最新的2.8.17,最终使用的是2.8.10最好看有没有以下几个软件啊sudoapt-getinstallbisonsudoapt-getinstallflexsudoapt-cachesearchlibssl|grepSSLsudoapt-getinstalllibssl-devsudoapt-getinstallopensslsudoapt-get Read More
posted @ 2014-02-22 21:52 自由度 Views(1558) Comments(0) Diggs(0)