00001 //Dear emacs, this is -*- c++ -*- 00002 00013 #include "eformat/old/Header.h" 00014 #include "eformat/HeaderMarker.h" 00015 #include "eformat/Version.h" 00016 #include "eformat/SizeCheckIssue.h" 00017 #include "eformat/BadVersionIssue.h" 00018 #include "eformat/WrongMarkerIssue.h" 00019 #include "eformat/NoSuchChildIssue.h" 00020 00021 eformat::old::Header::Header (const uint32_t* it, uint32_t match) 00022 : m_start(it) 00023 { 00024 //get endiannesso 00025 uint32_t m = marker(); 00026 if (m != match) throw EFORMAT_WRONG_MARKER(m, match); 00027 } 00028 00029 bool eformat::old::Header::check () const 00030 { 00031 if ( version() >> 16 != eformat::MAJOR_OLD_VERSION ) 00032 throw EFORMAT_BAD_VERSION(version() >> 16, eformat::MAJOR_OLD_VERSION); 00033 if ( header_size_word() != (9 + nstatus() + noffset() + nspecific()) ) 00034 throw EFORMAT_SIZE_CHECK(header_size_word(), 00035 (9 + nstatus() + noffset() + nspecific())); 00036 return true; 00037 } 00038 00039 const uint32_t* eformat::old::Header::child (size_t n) const 00040 { 00041 if (n >= noffset()) throw EFORMAT_NO_SUCH_CHILD(n, noffset()); 00042 return &m_start[0xffffff & offset()[n]]; 00043 } 00044 00045 00046 00047