[skill][msgpack] 初试msgpack库以及基本使用
It's like JSON.
but fast and small.
http://msgpack.org/index.html
源码:
https://github.com/msgpack/msgpack-c
扩展阅读:
用到了Cmake ,大概是一个用来生成makefile的系统 :https://cmake.org/overview/
https://zh.wikibooks.org/zh/CMake_%E5%85%A5%E9%96%80/%E8%BC%B8%E5%87%BA%E4%BD%8D%E7%BD%AE%E8%88%87%E5%AE%89%E8%A3%9D
release:
cpp-2.1.2
呃! 搞了半天也不知道如何用git 把一个tag down下来。有点糗。。。。
直接download zip文件: file:///home/tong/Downloads/msgpack-c-cpp-2.1.2.zip
对应的文档:
https://github.com/msgpack/msgpack-c/wiki/v2_0_cpp_overview
编译:
[root@okk msgpack-c-cpp-2.1.]# cmake .
[root@okk msgpack-c-cpp-2.1.]# make
哇塞,竟然有进度百分比,我也要这样的makefile。0.0 -.- ~O.O~
[root@okk msgpack-c-cpp-2.1.]# cmake .
-- The C compiler identification is GNU 4.4.
-- The CXX compiler identification is GNU 4.4.
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY)
-- Found ZLIB: /usr/lib64/libz.so (found version "1.2.3")
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC
-- Performing Test MSGPACK_ENABLE_GCC_CXX_ATOMIC - Failed
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Configuring done
-- Generating done
-- Build files have been written to: /root/src/thirdparty/github/msgpack-c-cpp-2.1.
[root@okk msgpack-c-cpp-2.1.]# make
Scanning dependencies of target msgpackc
[ %] Building C object CMakeFiles/msgpackc.dir/src/objectc.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/unpack.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/version.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/vrefbuffer.c.o
[ %] Building C object CMakeFiles/msgpackc.dir/src/zone.c.o
Linking C shared library libmsgpackc.so
[ %] Built target msgpackc
Scanning dependencies of target msgpackc-static
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/objectc.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/unpack.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/version.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/vrefbuffer.c.o
[ %] Building C object CMakeFiles/msgpackc-static.dir/src/zone.c.o
Linking C static library libmsgpackc.a
[ %] Built target msgpackc-static
Scanning dependencies of target lib_buffer_unpack
[ %] Building C object example/c/CMakeFiles/lib_buffer_unpack.dir/lib_buffer_unpack.c.o
Linking C executable lib_buffer_unpack
[ %] Built target lib_buffer_unpack
Scanning dependencies of target simple_c
[ %] Building C object example/c/CMakeFiles/simple_c.dir/simple_c.c.o
Linking C executable simple_c
[ %] Built target simple_c
Scanning dependencies of target speed_test_uint32_array
[ %] Building C object example/c/CMakeFiles/speed_test_uint32_array.dir/speed_test_uint32_array.c.o
Linking C executable speed_test_uint32_array
[ %] Built target speed_test_uint32_array
Scanning dependencies of target speed_test_uint64_array
[ %] Building C object example/c/CMakeFiles/speed_test_uint64_array.dir/speed_test_uint64_array.c.o
Linking C executable speed_test_uint64_array
[ %] Built target speed_test_uint64_array
Scanning dependencies of target user_buffer_unpack
[ %] Building C object example/c/CMakeFiles/user_buffer_unpack.dir/user_buffer_unpack.c.o
Linking C executable user_buffer_unpack
[ %] Built target user_buffer_unpack
Scanning dependencies of target class_intrusive
[ %] Building CXX object example/cpp03/CMakeFiles/class_intrusive.dir/class_intrusive.cpp.o
Linking CXX executable class_intrusive
[ %] Built target class_intrusive
Scanning dependencies of target class_intrusive_map
[ %] Building CXX object example/cpp03/CMakeFiles/class_intrusive_map.dir/class_intrusive_map.cpp.o
Linking CXX executable class_intrusive_map
[ %] Built target class_intrusive_map
Scanning dependencies of target class_non_intrusive
[ %] Building CXX object example/cpp03/CMakeFiles/class_non_intrusive.dir/class_non_intrusive.cpp.o
Linking CXX executable class_non_intrusive
[ %] Built target class_non_intrusive
Scanning dependencies of target custom
[ %] Building CXX object example/cpp03/CMakeFiles/custom.dir/custom.cpp.o
Linking CXX executable custom
[ %] Built target custom
Scanning dependencies of target enum
[ %] Building CXX object example/cpp03/CMakeFiles/enum.dir/enum.cpp.o
Linking CXX executable enum
[ %] Built target enum
Scanning dependencies of target map_based_versionup
[ %] Building CXX object example/cpp03/CMakeFiles/map_based_versionup.dir/map_based_versionup.cpp.o
Linking CXX executable map_based_versionup
[ %] Built target map_based_versionup
Scanning dependencies of target protocol_new
[ %] Building CXX object example/cpp03/CMakeFiles/protocol_new.dir/protocol_new.cpp.o
Linking CXX executable protocol_new
[ %] Built target protocol_new
Scanning dependencies of target reuse_zone
[ %] Building CXX object example/cpp03/CMakeFiles/reuse_zone.dir/reuse_zone.cpp.o
Linking CXX executable reuse_zone
[ %] Built target reuse_zone
Scanning dependencies of target simple
[ %] Building CXX object example/cpp03/CMakeFiles/simple.dir/simple.cpp.o
Linking CXX executable simple
[ %] Built target simple
Scanning dependencies of target stream
[%] Building CXX object example/cpp03/CMakeFiles/stream.dir/stream.cpp.o
Linking CXX executable stream
[%] Built target stream
[root@okk msgpack-c-cpp-2.1.]#
ditails
Cmake 指定按照目录
[root@okk msgpack-c-cpp-2.1.]# cmake CMakeLists.txt -DCMAKE_INSTALL_PREFIX=/root/output/
API: http://c.msgpack.org/c/index.html
api的 packing 用法:
https://github.com/msgpack/msgpack-c/wiki/v2_0_c_overview#packing
api的 unpack 用法:
https://github.com/msgpack/msgpack-c/wiki/v2_0_c_overview#unpack
举个栗子:
cmake -DCMAKE_INSTALL_PREFIX=$INS_PATH
make
make install
[skill][msgpack] 初试msgpack库以及基本使用的更多相关文章
- 【SimpleMsgPack.NET】发布一个msgpack协议C#版本的解析开源库
这两年一直都关注这IOCP在网络通信这方面的应用,当然数据的传递是经常需要的.今年接触了MsgPack格式,发现他用来做传输时数据打包真是太爽了.因为他可以直接打包二进制数据,不需要任何的转换.有人会 ...
- 二进制协议gob及msgpack介绍
本文主要介绍二进制协议gob及msgpack的基本使用. 最近在写一个gin框架的session服务时遇到了一个问题,Go语言中的json包在序列化空接口存放的数字类型(整型.浮点型等)都序列化成fl ...
- 重点关注之自定义序列化方式(Protobuf和Msgpack)
除了默认的JSON和XML序列化器外,如果想使用其它格式的(比如二进制)序列化器,也是可以的.比如著名的Protobuf和Msgpack,它们都是二进制的序列化器,特点是速度快,体积小.使用方法如下. ...
- 序列化库MessagePack应用(C++)
介绍 MessagePack(简称msgpack)是一个小巧而高效的序列化/反序列化库,支持多种开发语言.官方网站:http://msgpack.org/ . 下面是官方的一个简介: It's lik ...
- python之celery的使用(一)
前段时间需要使用rabbitmq做写缓存,一直使用pika+rabbitmq的组合,pika这个模块虽然可以很直观地操作rabbitmq,但是官方给的例子太简单,对其底层原理了解又不是很深,遇到很多坑 ...
- Pyhon进阶9---类的继承
类的继承 基本概念 定义 格式如下 继承中的访问控制 class Animal: __CNOUT = 0 HEIGHT = 0 def __init__(self,age,weight,height) ...
- ZMQ和MessagePack的简单使用(转)
近段日子在做一个比较复杂的项目,其中用到了开源软件ZMQ和MessagePack.ZMQ对底层网络通信进行了封装,是一个消息处理队列库, 使用起来非常方便.MessagePack是一个基于二进制的对象 ...
- python之celery使用详解一
前段时间需要使用rabbitmq做写缓存,一直使用pika+rabbitmq的组合,pika这个模块虽然可以很直观地操作rabbitmq,但是官方给的例子太简单,对其底层原理了解又不是很深,遇到很多坑 ...
- django-redis 中文文档
Andrey Antukh, niwi@niwi.be 4.7.0 翻译: RaPoSpectre 1. 介绍 django-redis 基于 BSD 许可, 是一个使 Django 支持 Redis ...
随机推荐
- layui:根据行内某个值,设定该行得背景色
done:function () { $("table tr").each(function () { var s = $(this).children().eq(1).text( ...
- Test Design Techniques - STATE BASED TESTING
Test Design Techniques - STATE BASED TESTING -Test note of “Essential Software Test Design” 2015-08- ...
- H3C ER6300 + 两台 H3C S5120 组网举例
组网需求: 1.H3C ER6300 作出口路由.防火墙及Qos限速等功能(ER6300 配置LAN口 192.168.30.254默认网关) 2.H3C S5120 两台配置相同VLAN10 VLA ...
- [AWS] Deploy react project on EC2
如何在aws部署项目 申请到亚马逊AWS免费账户后,我们可以拥有很多的免费云服务产品项目,其中包括: EC2云服务器. Amazon S3存储. Amazon RDS数据库. Amazon Cloud ...
- oracle 学习笔记(2)创建表空间及用户授权
原文:http://www.cnblogs.com/smartvessel/archive/2009/07/06/1517690.html Oracle安装完后,其中有一个缺省的数据库,除了这个缺省的 ...
- linux log
adb shell logcat GOODIX:v *:s cat /proc/kmsg | grep "<<" ./cbootimg.sh adb shell get ...
- 使用Python管理压缩包
一. 使用tarfile库读取与创建tar包 1. 创建tar包 In [1]: import tarfile In [2]: with tarfile.open('demo.tar',mode='w ...
- 查询Array中确定数值的对象&JS linq使用 = linq.js
var x=new Array(); x.push({"a":3,"b":3},{"a":2,"b":2},{" ...
- 【转载】技巧:Vim 的纵向编辑模式
如果要我选一个Vim中让我觉得Life Changing功能的话,我一定会选Vim的块编辑功能,也就是Ctrl+V,虽然还有些别的编辑器也有这功能,但目前为止,我从中受益颇大 原文地址:技巧:Vim ...
- 关于linux Centos 7一个网卡配置多个IP的方法
有时我们在工作中,会遇到一个网卡配置多个ip的情况,尤其是在linux服务器方面的应用教多 于是笔者将其配置过程整理如下,希望能帮到遇到同样问题的朋友,这里以vmware虚拟机下的Centos 7为例 ...