当前位置: 首页>>代码示例>>C++>>正文


C++ Packer类代码示例

本文整理汇总了C++中Packer的典型用法代码示例。如果您正苦于以下问题:C++ Packer类的具体用法?C++ Packer怎么用?C++ Packer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Packer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: send_multicast

void Process::send_multicast(
	const std::vector<int> &targets,
	Net *net,
	int edge_id,
	int tokens_count,
	const Packer &packer,
	Thread *thread)
{
	thread->get_requests()->check();
	char *buffer = packer.get_buffer();
	size_t size = packer.get_size();
	std::vector<int>::const_iterator i;
	Tokens *data = (Tokens*) packer.get_buffer();
	data->edge_id = edge_id;
	data->tokens_count = tokens_count;
	char *d = buffer;
	for (i = targets.begin(); i != targets.end(); i++) {
		int target = *i;
		if(target < 0 || target >= process_count) {
			fprintf(stderr, "Net sends %i token(s) to invalid process id %i (valid ids: [0 .. %i])\n",
				tokens_count, target, process_count - 1);
			exit(1);
		}
		CA_DLOG("SEND index=%i target=%i process=%i\n", place_index, target, get_process_id());

		MPI_Request *request = thread->get_requests()->new_request(d);
		d = NULL;
		MPI_Isend(buffer, size, MPI_BYTE, target, CA_TAG_TOKENS, MPI_COMM_WORLD, request);
	}
}
开发者ID:elieux,项目名称:kaira,代码行数:30,代码来源:process_mpi.cpp

示例2: msgpack_pack

	void msgpack_pack(Packer& _Pk) const {
		_Pk.pack_array(4);
		_Pk.pack(key);
		_Pk.pack(ovalue);
		_Pk.pack(nvalue);
		_Pk.pack(xt);
	}
开发者ID:crnt,项目名称:kt-msgpack,代码行数:7,代码来源:KyotoTyrantService.hpp

示例3: msgpack_pack

 void msgpack_pack(Packer& pk) const
 {
   if (is_double)
     pk.pack(msgpack::type::tuple<bool, double>(true, value.f));
   else
     pk.pack(msgpack::type::tuple<bool, int>(false, value.i));
 }
开发者ID:AnggaSuherman,项目名称:griddb_nosql,代码行数:7,代码来源:msgpack_container.cpp

示例4: visitAllPackers

Packer *PackMaster::getPacker(InputFile *f)
{
    Packer *pp = visitAllPackers(try_pack, f, opt, f);
    if (!pp)
        throwUnknownExecutableFormat();
    pp->assertPacker();
    return pp;
}
开发者ID:BpLife,项目名称:upx,代码行数:8,代码来源:packmast.cpp

示例5: Packer

		/**
		 * @brief Copy Constructor
		 *
		 * @details 
		 * <p> Copy constructor of Packer does not copy children items. </p> 
		 * <p> Only copies member variables(productArray, wrapperArray) of Packer's. </p>
		 */
		Packer(const Packer &packer)
			: Packer(packer.productArray)
		{
			this->reserve(packer.size());

			for (size_t i = 0; i < packer.size(); i++)
				this->emplace_back(new WrapperArray(*packer[i]));
		};
开发者ID:betterwaysystems,项目名称:packer,代码行数:15,代码来源:Packer.hpp

示例6: sqlapi_bndstmtfread

bool sqlapi_bndstmtfread( FILE *bndfile, SqlApiBindStmt &bndstmt) {
  Packer p;
  if(!p.read(ByteInputFile(bndfile))) {
    return false;
  }
  p >> bndstmt;
  return true;
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:8,代码来源:SqlBndWR.cpp

示例7: sqlapi_bndprogramidfread

bool sqlapi_bndprogramidfread(FILE *bndfile, SqlApiBindProgramId &programid) {
  Packer p;
  if(!p.read(ByteInputFile(bndfile))) {
    return false;
  }
  p >> programid;
  return true;
}
开发者ID:JesperMikkelsen,项目名称:Big-Numbers,代码行数:8,代码来源:SqlBndWR.cpp

示例8: packString

 void packString(Packer& pk, int index) const {
   size_t len;
   const char* str = lua_tolstring(L, index, &len);
   if (str == NULL) {
     int t = lua_type(L, index);
     luaL_error(L, "lua_tolstring failed for index %d: type = %s",
                index, lua_typename(L, t));
     return;
   }
   pk.pack_raw(len);
   pk.pack_raw_body(str, len);
 }
开发者ID:AnonyHa,项目名称:lua-msgpack-native,代码行数:12,代码来源:lua_objects.hpp

示例9: main

int main(int argc, char* argv[])
#endif
{
#ifdef WIN32
	wstring exePath(argv[0]);
#else
	string arg = string(argv[0]);
	wstring exePath(arg.begin(), arg.end());
#endif

	if(argc != 3) {
		cout << "Usage: pack <directory> <outputPath>" << endl;
		return -1;
	}

#ifdef WIN32
	wstring dirName(argv[1]);
#else
	arg = string(argv[1]);
	wstring dirName(arg.begin(), arg.end());
#endif

	dirName = DirUtils::GetDirectoryName(dirName);
	Packer* packer = new Packer();	
	packer->AddDirectory(dirName);

#ifdef WIN32
	wstring outPath(argv[2]);
#else
	arg = string(argv[2]);
	wstring outPath(arg.begin(), arg.end());
#endif
	cout << "Writing package... " << string(outPath.begin(), outPath.end())  << endl;
	packer->WritePack(outPath);
	delete packer;

	//packer = Packer::ReadPack(L"C:\\TEST.PAK");
	//PackEntry *entry = packer->GetEntry(L"Debug/PruebaTexto.txt");
	//wchar_t* data = (wchar_t*) packer->GetUncompressedData(entry);

	//wcout.imbue(locale(""));

	//wstring test(data, 1, (entry->GetUncompressedSize() / sizeof(wchar_t)) - 1);
	//wcout << test << endl;

	//delete data;
	//delete packer;

	return 0;
}
开发者ID:AugustoRuiz,项目名称:UWOL,代码行数:50,代码来源:main.cpp

示例10: msgpack_pack

  void msgpack_pack(Packer& pk) const {
    int n = lua_gettop(L);
    if (arg_base_ > n) {
      if (pack_as_array_) pk.pack_array(0);
      return;
    }

    // If pack_as_array is true, all elements in the stack
    // will be serialized into an array. Otherwise,
    // each element will be serialized independently.
    if (pack_as_array_) pk.pack_array(n - arg_base_ + 1);
    for (int i = arg_base_; i <= n; i++) {
      pack(pk, i);
    }
  }
开发者ID:AnonyHa,项目名称:lua-msgpack-native,代码行数:15,代码来源:lua_objects.hpp

示例11: msgpack_pack

    void msgpack_pack(Packer& pk) const
    {
        static_assert(sizeof...(Args) % 2 == 0, "");
        pk.pack_map(sizeof...(Args) / 2);

        define_map_imp<std::tuple<Args&...>, sizeof...(Args)>::pack(pk, a);
    }
开发者ID:Strongc,项目名称:mqtt_server,代码行数:7,代码来源:cpp11_define_map.hpp

示例12: Message

Message * Filter::packMsg()
{
    Packer packer;
    packer.packInt(info.filter_id);
    packer.packStr(info.so_file);

    char *bufs[1];
    int sizes[1];
    
    bufs[0] = packer.getPackedMsg();
    sizes[0] = packer.getPackedMsgLen();

    Message *msg = new Message();
    msg->build(info.filter_id, SCI_GROUP_ALL, 1, bufs, sizes, Message::FILTER_LOAD);
    delete [] bufs[0];
    return msg;
}
开发者ID:jiangwu1911,项目名称:cloudlandsci,代码行数:17,代码来源:filter.cpp

示例13: SCI_Group_operate

int SCI_Group_operate(sci_group_t group1, sci_group_t group2,
        sci_op_t op, sci_group_t *newgroup)
{
    if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
        return SCI_ERR_UNINTIALIZED;
    
    if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
        return SCI_ERR_INVALID_CALLER;

    if (!gCtrlBlock->getRoutingList()->isGroupExist(group1))
        return SCI_ERR_GROUP_NOTFOUND;

    if (!gCtrlBlock->getRoutingList()->isGroupExist(group2))
        return SCI_ERR_GROUP_NOTFOUND;

    if ((op!=SCI_UNION) && (op!=SCI_INTERSECTION) && (op!=SCI_DIFFERENCE))
        return SCI_ERR_INVALID_OPERATOR;

    int msgID;
    try {
        Packer packer;
        packer.packInt((int) op);
        packer.packInt((int) group1);
        packer.packInt((int) group2);

        char *bufs[1];
        int sizes[1];

        bufs[0] = packer.getPackedMsg();
        sizes[0] = packer.getPackedMsgLen();
        msgID = gNotifier->allocate();

        Message *msg = new Message();
        gAllocator->allocateGroup(newgroup);
        msg->build(SCI_FILTER_NULL, *newgroup, 1, bufs, sizes, Message::GROUP_OPERATE, msgID);
        delete [] bufs[0];
        gCtrlBlock->getRouterInQueue()->produce(msg);
    } catch (std::bad_alloc) {
        return SCI_ERR_NO_MEM;
    }
    
    int rc;
    gNotifier->freeze(msgID, &rc);
    return rc;
}
开发者ID:jiangwu1911,项目名称:cloudlandsci,代码行数:45,代码来源:api.cpp

示例14: main

int main(int argc, char ** argv)
{
	std::cout << "--------------------------------------------" << std::endl
		      << "Pakunpaker v1.0 by Xesc & Technology 2008-09" << std::endl 
		      << "--------------------------------------------" << std::endl << std::endl;
	
	if (argc > 2)
	{
		// create a new package
		if (strcmp(argv[1], "-i") == 0)
		{
			Packer *packer = new Packer;
			
			for (int param = 3; param < argc; param++)
			{
				packer->addFile(std::string(argv[param]));
				std::cout << "added: " << argv[param] << std::endl;
			}
			
			packer->buildPackage(argv[2]);
			std::cout << "Package build: " << argv[2] << std::endl;
			
			delete packer;
		}
		// extract files from package
		else if ((strcmp(argv[1], "-o") == 0 || strcmp(argv[1], "-oo") == 0) && argc == 4)
		{
			Unpacker *unpacker = new Unpacker;
			
			unpacker->extractPackage(std::string(argv[2]), std::string(argv[3]), strcmp(argv[1], "-o") == 0);
			
			for (int n = 0; n < unpacker->getExtractedFilesCount(); n++)
				std::cout << "Unpacked file " << n + 1 << " to: " << unpacker->getExtractedFileName(n) << std::endl;
			
			delete unpacker;
		}
		else // unknonw parameters
			displayHelp();
	}
	else // invalid parameters
		displayHelp();

	return 0;
}
开发者ID:JoeyPinilla,项目名称:xVideoServiceThief,代码行数:44,代码来源:main.cpp

示例15: SCI_Group_create

int SCI_Group_create(int num_bes, int * be_list, sci_group_t * group)
{
    if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
        return SCI_ERR_UNINTIALIZED;
    
    if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
        return SCI_ERR_INVALID_CALLER;

    assert(be_list);
    for (int i=0; i<num_bes; i++) {
        if (!gCtrlBlock->getTopology()->hasBE(be_list[i]))
            return SCI_ERR_BACKEND_NOTFOUND;
    }

    int msgID;
    try {
        Packer packer;
        packer.packInt(num_bes);
        for (int i=0; i<num_bes; i++) {
            packer.packInt(be_list[i]);
        }

        char *bufs[1];
        int sizes[1];

        bufs[0] = packer.getPackedMsg();
        sizes[0] = packer.getPackedMsgLen();
        msgID = gNotifier->allocate();

        Message *msg = new Message();
        gAllocator->allocateGroup(group);
        msg->build(SCI_FILTER_NULL, *group, 1, bufs, sizes, Message::GROUP_CREATE, msgID);
        delete [] bufs[0];
        gCtrlBlock->getRouterInQueue()->produce(msg);
    } catch (std::bad_alloc) {
        return SCI_ERR_NO_MEM;
    }
    
    int rc;
    gNotifier->freeze(msgID, &rc);
    return rc;
}
开发者ID:jiangwu1911,项目名称:cloudlandsci,代码行数:42,代码来源:api.cpp


注:本文中的Packer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。