本文整理汇总了C++中serializer类的典型用法代码示例。如果您正苦于以下问题:C++ serializer类的具体用法?C++ serializer怎么用?C++ serializer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了serializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void MSU1::serialize(serializer &s) {
Processor::serialize(s);
s.integer(mmio.data_offset);
s.integer(mmio.audio_offset);
s.integer(mmio.audio_loop_offset);
s.integer(mmio.audio_track);
s.integer(mmio.audio_volume);
s.integer(mmio.data_busy);
s.integer(mmio.audio_busy);
s.integer(mmio.audio_repeat);
s.integer(mmio.audio_play);
s.integer(mmio.audio_error);
if(datafile.open()) datafile.close();
if(datafile.open(string(cartridge.basename(), ".msu"), file::mode::read)) {
datafile.seek(mmio.data_offset);
}
if(audiofile.open()) audiofile.close();
if(audiofile.open(string(cartridge.basename(), "-", mmio.audio_track, ".pcm"), file::mode::read)) {
audiofile.seek(mmio.audio_offset);
}
}
开发者ID:Arnethegreat,项目名称:bsnes-plus,代码行数:26,代码来源:serialization.cpp
示例2: serialize
void sBus::serialize(serializer &s) {
s.array(memory::wram.data(), memory::wram.size());
s.array(memory::apuram.data(), memory::apuram.size());
s.array(memory::vram.data(), memory::vram.size());
s.array(memory::oam.data(), memory::oam.size());
s.array(memory::cgram.data(), memory::cgram.size());
}
开发者ID:BadyRaty,项目名称:Mednafen-Core,代码行数:7,代码来源:serialization.cpp
示例3: serialize
void SuperScope::serialize(serializer& s) {
Processor::serialize(s);
//Save block.
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
block[2] = trigger ? 1 : 0;
block[3] = cursor ? 1 : 0;
block[4] = turbo ? 1 : 0;
block[5] = pause ? 1 : 0;
block[6] = offscreen ? 1 : 0;
block[7] = (unsigned short)x >> 8;
block[8] = (unsigned short)x;
block[9] = (unsigned short)y >> 8;
block[10] = (unsigned short)y;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
trigger = (block[2] != 0);
cursor = (block[3] != 0);
turbo = (block[4] != 0);
pause = (block[5] != 0);
offscreen = (block[6] != 0);
x = (short)(((unsigned short)block[7] << 8) | (unsigned short)block[8]);
y = (short)(((unsigned short)block[9] << 8) | (unsigned short)block[10]);
}
}
开发者ID:RetroAchievements,项目名称:RASuite,代码行数:29,代码来源:superscope.cpp
示例4: serialize
void serialize(serializer &s) {
s.integer(basecounter);
s.integer(heapsize);
for(unsigned n = 0; n < heapcapacity; n++) {
s.integer(heap[n].counter);
s.integer(heap[n].event);
}
}
开发者ID:CatalystG,项目名称:mednafen-libretro,代码行数:8,代码来源:priorityqueue.hpp
示例5: serialize
void PPUcounter::serialize(serializer &s) {
s.integer(status.hcounter);
s.integer(status.vcounter);
s.integer(status.lineclocks);
s.integer(status.prev_lineclocks);
s.array(status.fieldlines);
s.integer(status.field);
}
开发者ID:Hedrig,项目名称:bsnes-classic,代码行数:8,代码来源:serialization.cpp
示例6:
void MSU1::serialize(serializer &s) {
Thread::serialize(s);
s.integer(mmio.data_offset);
s.integer(mmio.audio_offset);
s.integer(mmio.audio_loop_offset);
s.integer(mmio.audio_track);
s.integer(mmio.audio_volume);
s.integer(mmio.data_busy);
s.integer(mmio.audio_busy);
s.integer(mmio.audio_repeat);
s.integer(mmio.audio_play);
if(datafile.open()) datafile.close();
if(datafile.open({interface->path(0), "msu1.rom"}, file::mode::read)) {
datafile.seek(mmio.data_offset);
}
if(audiofile.open()) audiofile.close();
if(audiofile.open({interface->path(0), "track-", mmio.audio_track, ".pcm"}, file::mode::read)) {
audiofile.seek(mmio.audio_offset);
}
}
开发者ID:IcooN,项目名称:OpenEmu,代码行数:25,代码来源:serialization.cpp
示例7: serialize
void serialize(serializer &s) {
Board::serialize(s);
s.integer(prg_bank);
s.integer(chr_bank[0][0]);
s.integer(chr_bank[0][1]);
s.integer(chr_bank[1][0]);
s.integer(chr_bank[1][1]);
s.integer(mirror);
s.array(latch);
}
开发者ID:zeromus,项目名称:dasShiny,代码行数:11,代码来源:nes-fxrom.cpp
示例8: serialize
void serialize(serializer &s, const std::string &key, const mean_result<T> &self)
{
internal::check_valid(self);
internal::serializer_sentry group(s, key);
// serialize to uint64_t to make sure we are consistent across 32/64 bit
serialize(s, "@size", static_cast<uint64_t>(self.store_->data_.size()));
serialize(s, "count", self.store_->count_);
s.enter("mean");
serialize(s, "value", self.store_->data_);
s.exit();
}
开发者ID:ALPSCore,项目名称:ALPSCore,代码行数:12,代码来源:mean.cpp
示例9: serialize
void PPU::serialize(serializer &s) {
PPUcounter::serialize(s);
s.integer(status.render_output);
s.integer(status.frame_executed);
s.integer(status.frames_updated);
s.integer(status.frames_rendered);
s.integer(status.frames_executed);
s.integer(ppu1_version);
s.integer(ppu2_version);
}
开发者ID:CatalystG,项目名称:mednafen-libretro,代码行数:12,代码来源:serialization.cpp
示例10: serialize
void Gamepad::serialize(serializer& s) {
Processor::serialize(s);
//Save block.
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
}
}
开发者ID:CadeLaRen,项目名称:BizHawk,代码行数:12,代码来源:gamepad.cpp
示例11: serialize
void System::serialize(serializer &s) {
s.integer((unsigned&)region);
s.integer((unsigned&)expansion);
s.integer(scheduler.clock.cpu_freq);
s.integer(scheduler.clock.smp_freq);
s.integer(scheduler.clock.cpucop);
s.integer(scheduler.clock.cpuppu);
s.integer(scheduler.clock.cpusmp);
s.integer(scheduler.clock.smpdsp);
}
开发者ID:BigEd,项目名称:snes-sdk,代码行数:12,代码来源:serialization.cpp
示例12: save
bool StateManager::save(const char *filename, uint8 slot, serializer &s, const char *description) {
//if no state archive exists ...
if(file::exists(filename) == false) {
//try and create one
if(create(filename) == false) return false;
}
//if we cannot load the existing state archive ...
if(load(filename) == false) {
//it's probably an older version, try and create a new one
if(create(filename) == false) return false;
//it still needs to be loaded before we can write to it
if(load(filename) == false) return false;
}
uint8 index = findslot(slot);
if(index == SlotInvalid) {
//create new slot instead of over-writing existing slot
if(info.slotcount >= 255) return false;
index = info.slotcount;
slot = info.slotcount;
}
file fp;
if(fp.open(filename, file::mode_readwrite) == false) return false;
fp.seek(SlotIndex + index);
fp.write(slot);
time_t current = time(0);
tm *ts = localtime(¤t);
char timestamp[32];
sprintf(timestamp, "%.4u-%.2u-%.2u %.2u:%.2u:%.2u",
1900 + ts->tm_year, ts->tm_mon + 1, ts->tm_mday,
ts->tm_hour, ts->tm_min, ts->tm_sec,
(ts->tm_hour < 12 ? "AM" : "PM")
);
fp.seek(DateTimeIndex + index * DateTimeSize);
fp.write((uint8*)×tamp[0], DateTimeSize);
char desc[DescriptionSize];
memset(&desc, 0, DescriptionSize);
strlcpy(desc, description, DescriptionSize);
fp.seek(DescIndex + index * DescriptionSize);
fp.write((uint8*)&desc[0], DescriptionSize);
fp.seek(HeaderSize + index * system.serialize_size);
fp.write(s.data(), s.size());
for(unsigned n = 0; n < system.serialize_size - s.size(); n++) fp.write(0x00);
fp.close();
return true;
}
开发者ID:ben401,项目名称:OpenEmu,代码行数:52,代码来源:statemanager.cpp
示例13: serialize
void Cartridge::serialize(serializer &s) {
if(memory::cartram.size() != 0 && memory::cartram.size() != ~0) {
s.array(memory::cartram.data(), memory::cartram.size());
}
if(memory::cartrtc.size() != 0 && memory::cartrtc.size() != ~0) {
s.array(memory::cartrtc.data(), memory::cartrtc.size());
}
if(memory::bsxram.size() != 0 && memory::bsxram.size() != ~0) {
s.array(memory::bsxram.data(), memory::bsxram.size());
}
if(memory::bsxpram.size() != 0 && memory::bsxpram.size() != ~0) {
s.array(memory::bsxpram.data(), memory::bsxpram.size());
}
if(memory::stAram.size() != 0 && memory::stAram.size() != ~0) {
s.array(memory::stAram.data(), memory::stAram.size());
}
if(memory::stBram.size() != 0 && memory::stBram.size() != ~0) {
s.array(memory::stBram.data(), memory::stBram.size());
}
if(memory::gbram.size() != 0 && memory::gbram.size() != ~0) {
s.array(memory::gbram.data(), memory::gbram.size());
}
if(memory::gbrtc.size() != 0 && memory::gbrtc.size() != ~0) {
s.array(memory::gbrtc.data(), memory::gbrtc.size());
}
}
开发者ID:BadyRaty,项目名称:Mednafen-Core,代码行数:33,代码来源:serialization.cpp
示例14: unserialize
bool System::unserialize(serializer& s) {
unsigned signature, version;
char hash[64], description[512];
s.integer(signature);
s.integer(version);
s.array(hash);
s.array(description);
if(signature != 0x31545342) return false;
if(version != Info::SerializerVersion) return false;
power();
serialize_all(s);
return true;
}
开发者ID:quequotion,项目名称:higan-qq,代码行数:16,代码来源:serialization.cpp
示例15: unserialize
bool System::unserialize(serializer &s) {
unsigned signature, version, crc32;
char description[512];
s.integer(signature);
s.integer(version);
s.integer(crc32);
s.array(description);
if(signature != 0x31545342) return false;
if(version != bsnesSerializerVersion) return false;
//if(crc32 != cartridge.crc32()) return false;
scheduler.init();
serialize_all(s);
return true;
}
开发者ID:BigEd,项目名称:snes-sdk,代码行数:17,代码来源:serialization.cpp
示例16: serialize
void serialize(serializer &s) {
s.array(prg_bank);
s.array(chr_bank);
s.integer(mirror);
s.integer(irq_latch);
s.integer(irq_mode);
s.integer(irq_enable);
s.integer(irq_acknowledge);
s.integer(irq_counter);
s.integer(irq_scalar);
s.integer(irq_line);
}
开发者ID:IcooN,项目名称:OpenEmu,代码行数:14,代码来源:vrc7.cpp
示例17: serialize
void message::serialize(serializer& sink) const {
// ttn can be nullptr even if tuple is not empty (in case of object_array)
std::string tname = empty() ? "@<>" : tuple_type_names();
auto uti_map = detail::singletons::get_uniform_type_info_map();
auto uti = uti_map->by_uniform_name(tname);
if (uti == nullptr) {
std::string err = "could not get uniform type info for \"";
err += tname;
err += "\"";
CAF_LOGF_ERROR(err);
throw std::runtime_error(err);
}
sink.begin_object(uti);
for (size_t i = 0; i < size(); ++i) {
uniform_type_info::from(uniform_name_at(i))->serialize(at(i), &sink);
}
sink.end_object();
}
开发者ID:guigra,项目名称:actor-framework,代码行数:18,代码来源:message.cpp
示例18: serialize
void Mouse::serialize(serializer& s) {
Processor::serialize(s);
//Save block.
unsigned char block[Controller::SaveSize] = {0};
block[0] = latched ? 1 : 0;
block[1] = counter;
block[2] = (unsigned short)position_x >> 8;
block[3] = (unsigned short)position_x;
block[4] = (unsigned short)position_y >> 8;
block[5] = (unsigned short)position_y;
s.array(block, Controller::SaveSize);
if(s.mode() == nall::serializer::Load) {
latched = (block[0] != 0);
counter = block[1];
position_x = (short)(((unsigned short)block[2] << 8) | (unsigned short)block[3]);
position_y = (short)(((unsigned short)block[4] << 8) | (unsigned short)block[5]);
}
}
开发者ID:RetroAchievements,项目名称:RASuite,代码行数:18,代码来源:mouse.cpp
示例19: serialize
void serialize(serializer &s, const std::string &key, const autocorr_result<T> &self)
{
internal::check_valid(self);
internal::serializer_sentry group(s, key);
// Write size and nlevel as 64-bit integers for consistency
serialize(s, "@size", static_cast<uint64_t>(self.size()));
serialize(s, "@nlevel", static_cast<uint64_t>(self.nlevel()));
s.enter("level");
for (size_t i = 0; i != self.nlevel(); ++i)
serialize(s, std::to_string(i), self.level_[i]);
s.exit();
s.enter("mean");
serialize(s, "value", self.mean());
serialize(s, "error", self.stderror());
s.exit();
}
开发者ID:ALPSCore,项目名称:ALPSCore,代码行数:19,代码来源:autocorr.cpp
示例20: serialize
void ArmDSP::serialize(serializer &s) {
ARM::serialize(s);
Thread::serialize(s);
s.array(programRAM, 16 * 1024);
s.integer(bridge.cputoarm.ready);
s.integer(bridge.cputoarm.data);
s.integer(bridge.armtocpu.ready);
s.integer(bridge.armtocpu.data);
s.integer(bridge.timer);
s.integer(bridge.timerlatch);
s.integer(bridge.reset);
s.integer(bridge.ready);
s.integer(bridge.signal);
}
开发者ID:IcooN,项目名称:OpenEmu,代码行数:16,代码来源:serialization.cpp
注:本文中的serializer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论