Free Electron
BinaryReader.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __data_BinaryReader_h__
8 #define __data_BinaryReader_h__
9 namespace fe
10 {
11 namespace data
12 {
13 
14 
15 class FE_DL_EXPORT BinaryReader : public Reader
16 {
17 typedef Array<Record> t_r;
18 typedef std::map<int, sp<RecordGroup> > t_id_rg;
19 typedef std::map<int, sp<RecordArray> > t_id_ra;
20  public:
21  BinaryReader(sp<Scope> spScope);
22 virtual ~BinaryReader(void);
23 virtual sp<RecordGroup> input(std::istream &istrm);
24 
25  private:
26  struct AttributeInfo
27  {
28  String m_name;
29  std::list<String> m_typenames;
30  IWORD m_skipsize;
31  sp<Attribute> m_spAttribute;
32  FE_UWORD m_index;
33  };
34  typedef Array<AttributeInfo> t_attrinfo;
35  struct LayoutInfo
36  {
37  sp<Layout> m_spLayout;
38  Array<AttributeInfo> m_attributeInfos;
39  };
40  typedef std::map<int, LayoutInfo> t_id_layoutinfo;
41  struct RecordWiringInfo
42  {
43  Record m_record;
44  Accessor<Record> m_aRecord;
45  int m_id;
46  };
47  typedef std::list<RecordWiringInfo> t_wiring;
48 
49  struct WeakRecordWiringInfo
50  {
51  Record m_record;
52  Accessor<WeakRecord> m_aRecord;
53  int m_id;
54  };
55  typedef std::list<WeakRecordWiringInfo> t_wk_wiring;
56 
57  U8 getCode(std::istream &istrm);
58  void readLayout(std::istream &istrm);
59  void readAttribute(std::istream &istrm);
60  void readState(std::istream &istrm);
61  void readRecord(std::istream &istrm, LayoutInfo &l_i);
62  void readRecordGroup(std::istream &istrm);
63  void readInfo(std::istream &istrm);
64  void wireRecords(void);
65  void recordGroupsToArrays(void);
66  void reset(void);
67  void skip(std::istream &istrm, int skipsize);
68 
69  private:
70  t_id_layoutinfo m_layoutInfos;
71  t_id_rg m_rgs;
72  t_id_ra m_ras;
73  t_r m_rs;
74  t_attrinfo m_attrInfos;
75  t_wiring m_wiringList;
76  t_wk_wiring m_wkWiringList;
77  sp<Scope> m_spScope;
78  sp<BaseType> m_spRecordGroupType;
79  sp<BaseType> m_spRecordArrayType;
80  sp<BaseType> m_spRecordType;
81  sp<BaseType> m_spWeakRecordType;
82 };
83 
84 
85 } /* namespace */
86 } /* namespace */
87 
88 #endif /* __data_BinaryReader_h__ */
kernel
Definition: namespace.dox:3