Listing 2
class Mgt : public Composite { public: Mgt() : Composite("Mgt") { Add(new Bitset("tableId", 8)); Add(new Bitset("sectionSyntaxIndicator", 1)); Add(new Bitset("privateIndicator", 1)); Add(new Bitset("reserved2a", 2)); Add(new Bitset("sectionLength", 12)); Add(new Bitset("tableIdExtention", 16)); Add(new Bitset("reserved2b", 2)); Add(new Bitset("versionNumber", 5)); Add(new Bitset("currentNextIndicator", 1)); Add(new Bitset("sectionNumber", 8)); Add(new Bitset("lastSectionNumber", 8)); Add(new Bitset("protocolVersion", 8)); Add(new Bitset("tablesDefined", 16)); Add(new List ("tables", LIST_INFO(MgtDefinedTable, Mgt, KeepReadingTables))); Add(new Bitset("reserved4", 4)); Add(new Bitset("descriptorsLength", 12)); Add(new List ("descriptors", LIST_INFO(SIDescriptor, Mgt, KeepReadingDescriptors))); Add(new Bitset("crc", 32)); } private: bool KeepReadingTables() { return Value("tables") < Value("tablesDefined"); } bool KeepReadingDescriptors() { return SizeInBytes("descriptors") < Value("descriptorsLength"); } };