本文整理汇总了C++中serialize函数的典型用法代码示例。如果您正苦于以下问题:C++ serialize函数的具体用法?C++ serialize怎么用?C++ serialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了serialize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
FoodData& SingleFoodImpl::serialize(FoodData& fdata) const
{
*(fdata.add_singlefoods()) = serialize();
return fdata;
}
示例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
示例3: serialize
void serialize(const char *id, varchar<S> &x)
{
serialize(id, serializer::to_varchar_base(x));
}
示例4: serialize
void Property::serializeValue(XmlSerializer& s) {
serializeValue_ = true;
serialize(s);
serializeValue_ = false;
}
示例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);
}
示例6: serialize
// shortcut
long HashTableX::serialize ( SafeBuf *sb ) {
long nb = serialize ( sb->getBuf() , sb->getAvail() );
// update sb
sb->incrementLength ( nb );
return nb;
}
示例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());
}
示例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;
}
示例9: serialize
std::string ConnectionDescription::toString() const
{
std::ostringstream description;
serialize( description );
return description.str();
}
示例10: serialize
void QZebraScopeSerializer::serialize(const AdcBoardReport& data)
{
serialize(data.powerStatus);
serialize(data.fdReport);
serialize(data.tdReport);
}
示例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);
}
示例12: ofs
void ModelManager::serialize(const std::string& filename)
{
std::ofstream ofs(filename.c_str());
serialize::TextOutArchive textOutArchive(ofs);
serialize(textOutArchive);
}
示例13: operator
ArchiveType & operator()(T && arg)
{
serialize(std::forward<T> (arg));
return *pointArchive;
}
示例14: serialize
template<class X> void serialize(std::iostream &fs, serialization_context &context, X *&x)
{
fs << "pointer ";
serialize(fs, context, *x);
}
示例15: serialize
size_t CNetworkChat::Serialize(unsigned char *buf) const
{
unsigned char *p = buf;
p += serialize(p, this->Text);
return p - buf;
}