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


C++ serialize函数代码示例

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


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

示例1:

FoodData& SingleFoodImpl::serialize(FoodData& fdata) const
{
  *(fdata.add_singlefoods()) = serialize();
  return fdata;
}
开发者ID:tylermchenry,项目名称:nutrition_tracker,代码行数:5,代码来源:single_food_impl.cpp

示例2: shutdown

// -----------------------------------------------------------------------------
bool DeviceManager::initialize()
{
    GamepadConfig *gamepadConfig = NULL;
    GamePadDevice *gamepadDevice = NULL;
    m_map_fire_to_select         = false;
    bool created                 = false;


    // Shutdown in case the device manager is being re-initialized
    shutdown();

    if(UserConfigParams::logMisc())
    {
        Log::info("Device manager","Initializing Device Manager");
        Log::info("-","---------------------------");
    }

    deserialize();

    // Assign a configuration to the keyboard, or create one if we haven't yet
    if(UserConfigParams::logMisc()) Log::info("Device manager","Initializing keyboard support.");
    if (m_keyboard_configs.size() == 0)
    {
        if(UserConfigParams::logMisc())
            Log::info("Device manager","No keyboard configuration exists, creating one.");
        m_keyboard_configs.push_back(new KeyboardConfig());
        created = true;
    }

    const int keyboard_amount = m_keyboard_configs.size();
    for (int n=0; n<keyboard_amount; n++)
    {
        m_keyboards.push_back(new KeyboardDevice(m_keyboard_configs.get(n)));
    }

    if(UserConfigParams::logMisc())
            Log::info("Device manager","Initializing gamepad support.");

    irr_driver->getDevice()->activateJoysticks(m_irrlicht_gamepads);
    int num_gamepads = m_irrlicht_gamepads.size();
    if(UserConfigParams::logMisc())
    {
        Log::info("Device manager","Irrlicht reports %d gamepads are attached to the system.",
               num_gamepads);
    }



    // Create GamePadDevice for each physical gamepad and find a GamepadConfig to match
    for (int id = 0; id < num_gamepads; id++)
    {
        core::stringc name = m_irrlicht_gamepads[id].Name;

        // Some linux systems report a disk accelerometer as a gamepad, skip that
        if (name.find("LIS3LV02DL") != -1) continue;

#ifdef WIN32
        // On Windows, unless we use DirectInput, all gamepads are given the
        // same name ('microsoft pc-joystick driver'). This makes configuration
        // totally useless, so append an ID to the name. We can't test for the
        // name, since the name is even translated.
        name = name + " " + StringUtils::toString(id).c_str();
#endif

        if (UserConfigParams::logMisc())
        {
            Log::info("Device manager","#%d: %s detected...", id, name.c_str());
        }
        // Returns true if new configuration was created
        if (getConfigForGamepad(id, name, &gamepadConfig) == true)
        {
            if(UserConfigParams::logMisc())
               Log::info("Device manager","creating new configuration.");
            created = true;
        }
        else
        {
            if(UserConfigParams::logMisc())
                Log::info("Device manager","using existing configuration.");
        }

        gamepadConfig->setPlugged();
        gamepadDevice = new GamePadDevice(id,
                                          name.c_str(),
                                          m_irrlicht_gamepads[id].Axes,
                                          m_irrlicht_gamepads[id].Buttons,
                                          gamepadConfig );
        addGamepad(gamepadDevice);
    } // end for

    if (created) serialize();
    return created;
}   // initialize
开发者ID:Berulacks,项目名称:stk-code,代码行数:94,代码来源:device_manager.cpp

示例3: serialize

 void serialize(const char *id, varchar<S> &x)
 {
   serialize(id, serializer::to_varchar_base(x));
 }
开发者ID:zussel,项目名称:oos,代码行数:4,代码来源:serializer.hpp

示例4: serialize

void Property::serializeValue(XmlSerializer& s) {
    serializeValue_ = true;
    serialize(s);
    serializeValue_ = false;
}
开发者ID:molsimmsu,项目名称:3mview,代码行数:5,代码来源:property.cpp

示例5: serialize

void org::mpisws::p2p::transport::simpleidentity::InetSocketAddressSerializer::serialize(::java::lang::Object* i, ::rice::p2p::commonapi::rawserialization::OutputBuffer* b)
{ 
    serialize(dynamic_cast< ::java::net::InetSocketAddress* >(i), b);
}
开发者ID:subhash1-0,项目名称:thirstyCrow,代码行数:4,代码来源:InetSocketAddressSerializer.cpp

示例6: serialize

// shortcut
long HashTableX::serialize ( SafeBuf *sb ) {
	long nb = serialize ( sb->getBuf() , sb->getAvail() );
	// update sb
	sb->incrementLength ( nb );
	return nb;
}
开发者ID:RevBooyah,项目名称:open-source-search-engine,代码行数:7,代码来源:HashTableX.cpp

示例7: msg

 void SystemComponent::sendRoutes(std::string const &routes) {
     Buffer<> buf;
     messages::RoutesFromServer::MessageSerialization msg(routes);
     serialize(buf, msg);
     m_getParent().packMessage(buf, routesOut.getMessageType());
 }
开发者ID:6DB,项目名称:OSVR-Core,代码行数:6,代码来源:SystemComponent.cpp

示例8: _tmain


//.........这里部分代码省略.........
	std::wstring wOutputPath(argv[2]);
	CreateDirectory(wOutputPath.c_str(), nullptr);
	bool skipEmptyNodes = false;
	std::wstring animStackName;
	for (int i = 3; i < argc; ++i){
		std::wstring warg = argv[i];
		if (warg == L"/skipemptynodes") {
			skipEmptyNodes = true;
		}
		else if (warg.find(L"/fps:") == 0){
			if (warg == L"/fps:60"){
				GlobalSettings::Current().AnimationsTimeMode = FbxTime::EMode::eFrames60;
			}
			else if (warg == L"/fps:30"){
				GlobalSettings::Current().AnimationsTimeMode = FbxTime::EMode::eFrames30;
			}
			else if (warg == L"/fps:24"){
				GlobalSettings::Current().AnimationsTimeMode = FbxTime::EMode::eFrames24;
			}
			else{
				std::wcerr << L"Unrecognized fps parameter" << std::endl;
				return -2;
			}
		}
		else if (warg.find(L"/animstack:") == 0) {
			animStackName = warg.substr(11);
			
			if (animStackName.size()>0 && animStackName[0] == L'\"') {
				animStackName.erase(0, 1);
			}
			if (animStackName.size() > 0 && animStackName[animStackName.size() - 1] == L'\"') {
				animStackName.erase(animStackName.size() - 1, 1);
			}
		}
		
	}
	

	FbxSceneLoader sceneLoader(wstringToUtf8(wInputPath));
	auto animStackCount = sceneLoader.getScene()->GetSrcObjectCount<FbxAnimStack>();
	if (animStackName.size() == 0) {
		GlobalSettings::Current().AnimStackIndex = 0;
	}
	else {
		for (auto ix = 0; ix < animStackCount; ++ix) {
			auto animStack = sceneLoader.getScene()->GetSrcObject<FbxAnimStack>(ix);
			if (utf8ToWstring(animStack->GetName()) == animStackName) {
				GlobalSettings::Current().AnimStackIndex = ix;
			}
		}
	}
	std::wcout << L"Animation stacks : " << std::endl;
	for (auto ix = 0; ix < animStackCount; ++ix) {
		auto animStack = sceneLoader.getScene()->GetSrcObject<FbxAnimStack>(ix);
		if (ix == GlobalSettings::Current().AnimStackIndex) {
			std::wcout << L"[X] ";
			sceneLoader.getScene()->SetCurrentAnimationStack(animStack);
		}
		else {
			std::wcout << L"[ ] ";
		}
		
		std::wcout << utf8ToWstring(animStack->GetName());
		auto ts=animStack->GetLocalTimeSpan();
		auto start = ts.GetStart();
		auto stop = ts.GetStop();
		std::wcout << L"(" << start.GetMilliSeconds() << L" - " << stop.GetMilliSeconds() << L")" << std::endl;
	}

	auto root = sceneLoader.rootNode();

	BabylonScene babScene(*root, skipEmptyNodes);

	for (auto& mat : babScene.materials()){
		exportTexture(mat.ambientTexture, wOutputPath);
		exportTexture(mat.diffuseTexture, wOutputPath);
		exportTexture(mat.specularTexture, wOutputPath);
		exportTexture(mat.emissiveTexture, wOutputPath);
		exportTexture(mat.reflectionTexture, wOutputPath);
		exportTexture(mat.bumpTexture, wOutputPath);
		
	}
	
	

	auto json = babScene.toJson();
	if (L'\\' != *wOutputPath.crbegin()) {
		wOutputPath.append(L"\\");
	}
	wOutputPath.append(wInputFileName);

	auto lastDot = wOutputPath.find_last_of(L'.');
	wOutputPath.erase(lastDot);
	wOutputPath.append(L".babylon");
	DeleteFile(wOutputPath.c_str());
	std::ofstream stream(wOutputPath);
	json.serialize(stream);
	stream.flush();
	return 0;
}
开发者ID:injir,项目名称:nodeApp,代码行数:101,代码来源:FbxExporter.cpp

示例9: serialize

std::string ConnectionDescription::toString() const
{
    std::ostringstream description;
    serialize( description );
    return description.str();
}
开发者ID:4Second2None,项目名称:Collage,代码行数:6,代码来源:connectionDescription.cpp

示例10: serialize

void QZebraScopeSerializer::serialize(const AdcBoardReport& data)
{
	serialize(data.powerStatus);
	serialize(data.fdReport);
	serialize(data.tdReport);
}
开发者ID:Quenii,项目名称:adcevm,代码行数:6,代码来源:qzebrascopeserializer.cpp

示例11: serialize

void btRigidBody::serializeSingleObject(class btSerializer* serializer) const
{
	btChunk* chunk = serializer->allocate(calculateSerializeBufferSize(),1);
	const char* structType = serialize(chunk->m_oldPtr, serializer);
	serializer->finalizeChunk(chunk,structType,BT_RIGIDBODY_CODE,(void*)this);
}
开发者ID:g-pechorin,项目名称:bullet2stripped,代码行数:6,代码来源:btRigidBody.cpp

示例12: ofs

void ModelManager::serialize(const std::string& filename)
{
	std::ofstream ofs(filename.c_str());
	serialize::TextOutArchive textOutArchive(ofs);
	serialize(textOutArchive);
}
开发者ID:TrentSterling,项目名称:glr,代码行数:6,代码来源:ModelManager.cpp

示例13: operator

		ArchiveType & operator()(T && arg)
		{
			serialize(std::forward<T> (arg));
			return *pointArchive;
		}
开发者ID:Panda06,项目名称:yasli,代码行数:5,代码来源:yasli.hpp

示例14: serialize

template<class X> void serialize(std::iostream &fs, serialization_context &context, X *&x)
{
  fs << "pointer ";
  serialize(fs, context, *x);
}
开发者ID:Bvangoor,项目名称:Be-Tree,代码行数:5,代码来源:swap_space.hpp

示例15: serialize

size_t CNetworkChat::Serialize(unsigned char *buf) const
{
	unsigned char *p = buf;
	p += serialize(p, this->Text);
	return p - buf;
}
开发者ID:Clemenshemmerling,项目名称:Stratagus,代码行数:6,代码来源:net_message.cpp


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