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


C++ Dump类代码示例

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


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

示例1: DecodeRLE

    void DecodeRLE(const uint8_t* data, std::size_t size, Dump& result)
    {
      Dump tmp;
      tmp.reserve(MAX_SECTOR_SIZE);
      ByteStream stream(data, size);
      while (!stream.Eof())
      {
        const uint_t len = 2 * stream.GetByte();
        Require(!stream.Eof());
        const uint_t count = stream.GetByte();
        Require(count != 0);

        const bool isRLE = len != 0;
        const uint_t blockSize = isRLE ? len : count;
        Require(stream.GetRestBytes() >= blockSize);
        for (uint_t idx = 0; idx != blockSize; ++idx)
        {
          tmp.push_back(stream.GetByte());
        }
        if (isRLE)
        {
          Require(CopyFromBack(len, tmp, len * (count - 1)));
        }
      }
      result.swap(tmp);
    }
开发者ID:djdron,项目名称:zxtune,代码行数:26,代码来源:teledisk.cpp

示例2: ApplyInsertions

 void ApplyInsertions(Dump& result) const
 {
   if (0 == SizeAddon)
   {
     return;
   }
   Dump tmp(result.size() + SizeAddon);
   Dump::const_iterator src = result.begin();
   const Dump::const_iterator srcEnd = result.end();
   auto dst = tmp.begin();
   std::size_t oldOffset = 0;
   for (const auto& ins : Insertions)
   {
     if (const std::size_t toCopy = ins.first - oldOffset)
     {
       const Dump::const_iterator nextEnd = src + toCopy;
       dst = std::copy(src, nextEnd, dst);
       src = nextEnd;
       oldOffset += toCopy;
     }
     dst = std::copy(ins.second.begin(), ins.second.end(), dst);
   }
   std::copy(src, srcEnd, dst);
   result.swap(tmp);
 }
开发者ID:djdron,项目名称:zxtune,代码行数:25,代码来源:metainfo.cpp

示例3: dump

void DisplayDevice::dump(Dump& d)
{
    d.append("-------------------------------------------------------------\n");
    d.append("Device Name: %s (%s)\n", mName,
            mConnection ? "connected" : "disconnected");
    d.append("Display configs (count = %d):\n", mDisplayConfigs.size());
    d.append(" CONFIG | VSYNC_PERIOD | WIDTH | HEIGHT | DPI_X | DPI_Y \n");
    d.append("--------+--------------+-------+--------+-------+-------\n");
    for (size_t i = 0; i < mDisplayConfigs.size(); i++) {
        DisplayConfig *config = mDisplayConfigs.itemAt(i);
        if (config) {
            d.append("%s %2d   |     %4d     | %5d |  %4d  |  %3d  |  %3d  \n",
                     (i == (size_t)mActiveDisplayConfig) ? "* " : "  ",
                     i,
                     config->getRefreshRate(),
                     config->getWidth(),
                     config->getHeight(),
                     config->getDpiX(),
                     config->getDpiY());
        }
    }
    // dump layer list
    if (mLayerList)
        mLayerList->dump(d);
}
开发者ID:yutokt,项目名称:android_vendor_intel,代码行数:25,代码来源:DisplayDevice.cpp

示例4: Error

void dsp::SingleThread::insert_dump_point (const std::string& transform_name)
{
  typedef HasInput<TimeSeries> Xform;

  for (unsigned iop=0; iop < operations.size(); iop++)
  {
    if (operations[iop]->get_name() == transform_name)
    {
      Xform* xform = dynamic_cast<Xform*>( operations[iop].get() );
      if (!xform)
	throw Error (InvalidParam, "dsp::SingleThread::insert_dump_point",
		     transform_name + " does not have TimeSeries input");

      string filename = "pre_" + transform_name;

      if (config->get_total_nthread() > 1)
        filename += "." + tostring (thread_id);

      filename += ".dump";

      cerr << "dspsr: dump output in " << filename << endl;

      Dump* dump = new Dump;
      dump->set_output( fopen(filename.c_str(), "w") );
      dump->set_input( xform->get_input() ) ;
      dump->set_output_binary (true);

      operations.insert (operations.begin()+iop, dump);
      iop++;
    }
  }
}
开发者ID:gitj,项目名称:dspsr,代码行数:32,代码来源:SingleThread.C

示例5: GetResult

    void GetResult(Dump& data) const override
    {
      Dump rawDump;
      Delegate->GetResult(rawDump);
      Require(0 == rawDump.size() % Registers::TOTAL);
      const uint32_t framesCount = rawDump.size() / Registers::TOTAL;
      const uint_t storedRegisters = Registers::TOTAL;

      const String& title = Params->Title();
      const String author = Params->Author();
      const uint32_t headerSize = sizeof(FYMHeader) + (title.size() + 1) + (author.size() + 1);
      const std::size_t contentSize = framesCount * storedRegisters;

      Binary::DataBuilder builder(headerSize + contentSize);
      FYMHeader& header = builder.Add<FYMHeader>();
      header.HeaderSize = fromLE(headerSize);
      header.FramesCount = fromLE(framesCount);
      header.LoopFrame = fromLE(static_cast<uint32_t>(Params->LoopFrame()));
      header.PSGFreq = fromLE(static_cast<uint32_t>(Params->ClockFreq()));
      header.IntFreq = fromLE(static_cast<uint32_t>(Time::GetFrequencyForPeriod(Params->FrameDuration())));
      builder.AddCString(title);
      builder.AddCString(author);

      for (uint_t reg = 0; reg < storedRegisters; ++reg)
      {
        uint8_t* const result = static_cast<uint8_t*>(builder.Allocate(framesCount));
        for (uint_t frm = 0, inOffset = reg; frm < framesCount; ++frm, inOffset += Registers::TOTAL)
        {
          result[frm] = rawDump[inOffset];
        }
      }
      Dump result;
      builder.CaptureResult(result);
      Binary::Compression::Zlib::Compress(result, data);
    }
开发者ID:djdron,项目名称:zxtune,代码行数:35,代码来源:fym.cpp

示例6: DecodeData

    bool DecodeData()
    {
      const uint8_t* const rawData = static_cast<const uint8_t*>(Header.ID);
      const std::size_t dataOffset = fromLE(Header.DataOffset);
      const uint_t cylinders = fromLE(Header.Cylinders);
      const uint_t sides = fromLE(Header.Sides);

      Dump result;
      result.reserve(FDI_MAX_SIZE);
      std::size_t trackInfoOffset = sizeof(Header) + fromLE(Header.InfoSize);
      std::size_t rawSize = dataOffset;
      for (uint_t cyl = 0; cyl != cylinders; ++cyl)
      {
        for (uint_t sid = 0; sid != sides; ++sid)
        {
          if (trackInfoOffset + sizeof(RawTrack) > Limit)
          {
            return false;
          }

          const RawTrack* const trackInfo = safe_ptr_cast<const RawTrack*>(rawData + trackInfoOffset);
          typedef std::vector<SectorDescr> SectorDescrs;
          //collect sectors reference
          SectorDescrs sectors;
          sectors.reserve(trackInfo->SectorsCount);
          for (std::size_t secNum = 0; secNum != trackInfo->SectorsCount; ++secNum)
          {
            const RawTrack::Sector* const sector = trackInfo->Sectors + secNum;
            const std::size_t secSize = 128 << sector->Size;
            //since there's no information about head number (always 0), do not check it
            //assert(sector->Head == sid);
            if (sector->Cylinder != cyl)
            {
              return false;
            }
            const std::size_t offset = dataOffset + fromLE(sector->Offset) + fromLE(trackInfo->Offset);
            if (offset + secSize > Limit)
            {
              return false;
            }
            sectors.push_back(SectorDescr(sector->Number, rawData + offset, rawData + offset + secSize));
            rawSize = std::max(rawSize, offset + secSize);
          }

          //sort by number
          std::sort(sectors.begin(), sectors.end());
          //and gather data
          for (SectorDescrs::const_iterator it = sectors.begin(), lim = sectors.end(); it != lim; ++it)
          {
            result.insert(result.end(), it->Begin, it->End);
          }
          //calculate next track by offset
          trackInfoOffset += sizeof(*trackInfo) + (trackInfo->SectorsCount - 1) * sizeof(trackInfo->Sectors);
        }
      }
      UsedSize = rawSize;
      Decoded.swap(result);
      return true;
    }
开发者ID:fgroen,项目名称:zxtune,代码行数:59,代码来源:fulldiskimage.cpp

示例7: IsInfoEmpty

 bool IsInfoEmpty(const Dump& info)
 {
   assert(info.size() == 53);
   //28 is fixed
   //25 is title
   const Dump::const_iterator titleStart = info.begin() + 28;
   return info.end() == std::find_if(titleStart, info.end(), std::bind2nd(std::greater<Char>(), Char(' ')));
 }
开发者ID:djdron,项目名称:zxtune,代码行数:8,代码来源:compiledstp.cpp

示例8: DumpStyle

void WriteDump::command(int narg, char **arg)
{

    if (narg < 3) error->all(FLERR,"Illegal write_dump command");

    // modindex = index in args of "modify" keyword
    // will be narg if "modify" is not present

    int modindex;
    for (modindex = 0; modindex < narg; modindex++)
        if (strcmp(arg[modindex],"modify") == 0) break;

    // create the Dump instance
    // create dump command line with extra required args

    Dump *dump;

    char **dumpargs = new char*[modindex+2];
    dumpargs[0] = (char *) "WRITE_DUMP"; // dump id
    dumpargs[1] = arg[0];                // group
    dumpargs[2] = arg[1];                // dump style
    dumpargs[3] = (char *) "0";          // dump frequency

    for (int i = 2; i < modindex; ++i)
        dumpargs[i+2] = arg[i];

    if (0) return;         // dummy line to enable else-if macro expansion

#define DUMP_CLASS
#define DumpStyle(key,Class) \
  else if (strcmp(arg[1],#key) == 0) dump = new Class(lmp,modindex+2,dumpargs);
#include "style_dump.h"
#undef DUMP_CLASS

    else error->all(FLERR,"Unknown dump style");

    if (modindex < narg) dump->modify_params(narg-modindex-1,&arg[modindex+1]);

    // write out one frame and then delete the dump again
    // set multifile_override for DumpImage so that filename needs no "*"

    if (strcmp(arg[1],"image") == 0)
        ((DumpImage *) dump)->multifile_override = 1;

    if (strcmp(arg[1],"cfg") == 0)
        ((DumpCFG *) dump)->multifile_override = 1;

    dump->init();
    dump->write();

    // delete the Dump instance and local storage

    delete dump;
    delete [] dumpargs;
}
开发者ID:vkumar19,项目名称:lammps,代码行数:55,代码来源:write_dump.cpp

示例9: DecodeR2P

 void DecodeR2P(const uint8_t* data, std::size_t size, Dump& result)
 {
   Require(size % sizeof(R2PEntry) == 0);
   Dump tmp;
   tmp.reserve(MAX_SECTOR_SIZE);
   for (const R2PEntry* it = safe_ptr_cast<const R2PEntry*>(data), *lim = it + size / sizeof(*it); it != lim; ++it)
   {
     const uint_t count = fromLE(it->Count);
     Require(count != 0);
     tmp.push_back(it->Data[0]);
     tmp.push_back(it->Data[1]);
     Require(CopyFromBack(sizeof(it->Data), tmp, sizeof(it->Data) * (count - 1)));
   }
   result.swap(tmp);
 }
开发者ID:djdron,项目名称:zxtune,代码行数:15,代码来源:teledisk.cpp

示例10: dump

void BufferManager::dump(Dump& d)
{
    d.append("Buffer Manager status: pool size %d\n", mBufferPool->getCacheSize());
    d.append("-------------------------------------------------------------\n");
    for (size_t i = 0; i < mBufferPool->getCacheSize(); i++) {
        BufferMapper *mapper = mBufferPool->getMapper(i);
        d.append("Buffer %d: handle %#x, (%dx%d), format %d, refCount %d\n",
                 i,
                 mapper->getHandle(),
                 mapper->getWidth(),
                 mapper->getHeight(),
                 mapper->getFormat(),
                 mapper->getRef());
    }
    return;
}
开发者ID:MIPS,项目名称:hardware-intel-img-hwcomposer,代码行数:16,代码来源:BufferManager.cpp

示例11: ApplyOverwrites

 void ApplyOverwrites(Dump& result) const
 {
   for (const auto& over : Overwrites)
   {
     std::copy(over.second.begin(), over.second.end(), result.begin() + over.first);
   }
 }
开发者ID:djdron,项目名称:zxtune,代码行数:7,代码来源:metainfo.cpp

示例12: DecodeBlock

 void DecodeBlock(Binary::InputStream& stream, std::size_t srcSize, Dump& dst)
 {
   const std::size_t LOOKUP = 1;
   const uint8_t* const src = stream.ReadData(LOOKUP);
   const std::size_t used = DecodeBlock(src, srcSize, &dst[0], dst.size());
   stream.ReadData(used - LOOKUP);
 }
开发者ID:fgroen,项目名称:zxtune,代码行数:7,代码来源:z80.cpp

示例13: OnSector

 void OnSector(const Formats::CHS& loc, const uint8_t* rawData, std::size_t rawSize, SectorDataType type, std::size_t targetSize) override
 {
   Dump result;
   switch (type)
   {
   case RAW_SECTOR:
     result.assign(rawData, rawData + rawSize);
     break;
   case R2P_SECTOR:
     DecodeR2P(rawData, rawSize, result);
     break;
   case RLE_SECTOR:
     DecodeRLE(rawData, rawSize, result);
     break;
   }
   Require(result.size() == targetSize);
   Builder->SetSector(loc, result);
 }
开发者ID:djdron,项目名称:zxtune,代码行数:18,代码来源:teledisk.cpp

示例14: Decode

 Container::Ptr Decode(const Binary::Container& rawData) const override
 {
   using namespace CompiledSTP;
   if (!Player->Match(rawData))
   {
     return Container::Ptr();
   }
   const Binary::TypedContainer typedData(rawData);
   const std::size_t availSize = rawData.Size();
   const typename Version::RawPlayer& rawPlayer = *typedData.GetField<typename Version::RawPlayer>(0);
   const std::size_t playerSize = rawPlayer.GetSize();
   if (playerSize >= std::min(availSize, CompiledSTP::MAX_PLAYER_SIZE))
   {
     Dbg("Invalid player");
     return Container::Ptr();
   }
   Dbg("Detected player in first %1% bytes", playerSize);
   const std::size_t modDataSize = std::min(CompiledSTP::MAX_MODULE_SIZE, availSize - playerSize);
   const Binary::Container::Ptr modData = rawData.GetSubcontainer(playerSize, modDataSize);
   const Dump metainfo = rawPlayer.GetInfo();
   if (CompiledSTP::IsInfoEmpty(metainfo))
   {
     Dbg("Player has empty metainfo");
     if (const Binary::Container::Ptr originalModule = Formats::Chiptune::SoundTrackerPro::ParseCompiled(*modData, Formats::Chiptune::SoundTrackerPro::GetStubBuilder()))
     {
       const std::size_t originalSize = originalModule->Size();
       return CreateContainer(originalModule, playerSize + originalSize);
     }
   }
   else if (const Binary::Container::Ptr fixedModule = Formats::Chiptune::SoundTrackerPro::InsertMetaInformation(*modData, metainfo))
   {
     if (Formats::Chiptune::SoundTrackerPro::ParseCompiled(*fixedModule, Formats::Chiptune::SoundTrackerPro::GetStubBuilder()))
     {
       const std::size_t originalSize = fixedModule->Size() - metainfo.size();
       return CreateContainer(fixedModule, playerSize + originalSize);
     }
     Dbg("Failed to parse fixed module");
   }
   Dbg("Failed to find module after player");
   return Container::Ptr();
 }
开发者ID:djdron,项目名称:zxtune,代码行数:41,代码来源:compiledstp.cpp

示例15: AddData

 void AddData(const Dump& registers) override
 {
   Devices::AYM::Registers& data = Data->Allocate();
   const uint_t availRegs = std::min<uint_t>(registers.size(), Devices::AYM::Registers::ENV + 1);
   for (uint_t reg = 0, mask = 1; reg != availRegs; ++reg, mask <<= 1)
   {
     const uint8_t val = registers[reg];
     if (reg != Devices::AYM::Registers::ENV || val != 0xff)
     {
       data[static_cast<Devices::AYM::Registers::Index>(reg)] = val;
     }
   }
 }
开发者ID:djdron,项目名称:zxtune,代码行数:13,代码来源:ymvtx.cpp


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