Example #1
0
 Format(const Binary::TypedContainer& data)
   : Delegate(data)
   , Ranges(data.GetSize())
   , Source(*Delegate.GetField<RawHeader>(0))
 {
   Ranges.AddService(0, sizeof(Source));
   ReadSampleDecodeTable();
 }
 bool FastCheck(const Binary::TypedContainer& data)
 {
   const std::size_t hdrSize = GetHeaderSize(data);
   if (!Math::InRange<std::size_t>(hdrSize, sizeof(RawHeader) + 1, sizeof(RawHeader) + MAX_POSITIONS_COUNT))
   {
     return false;
   }
   const RawHeader& hdr = *data.GetField<RawHeader>(0);
   const Areas areas(hdr, data.GetSize());
   if (!areas.CheckHeader(hdrSize))
   {
     return false;
   }
   if (!areas.CheckPatterns(hdrSize))
   {
     return false;
   }
   return true;
 }