OdbDesignLib
OdbDesign ODB++ Parsing Library
StepHdrFile.h
1 #pragma once
2 
3 #include "../../odbdesign_export.h"
4 #include <string>
5 #include <vector>
6 #include <map>
7 #include <memory>
8 #include "../../IProtoBuffable.h"
9 #include "../../ProtoBuf/stephdrfile.pb.h"
10 #include "../OdbFile.h"
11 #include "../IStreamSaveable.h"
12 
13 namespace Odb::Lib::FileModel::Design
14 {
15  class ODBDESIGN_EXPORT StepHdrFile : public OdbFile, public IProtoBuffable<Odb::Lib::Protobuf::StepHdrFile>, public IStreamSaveable
16  {
17  public:
18  virtual ~StepHdrFile();
19 
20  struct StepRepeatRecord : public IProtoBuffable<Odb::Lib::Protobuf::StepHdrFile::StepRepeatRecord>
21  {
22  std::string name;
23  double x;
24  double y;
25  double dx;
26  double dy;
27  int nx;
28  int ny;
29  double angle;
30  bool flip;
31  bool mirror;
32 
33  typedef std::vector<std::shared_ptr<StepRepeatRecord>> Vector;
34 
35  constexpr static const char* ARRAY_HEADER_TOKEN = "STEP-REPEAT";
36 
37  // Inherited via IProtoBuffable
38  std::unique_ptr<Odb::Lib::Protobuf::StepHdrFile::StepRepeatRecord> to_protobuf() const override;
39  void from_protobuf(const Odb::Lib::Protobuf::StepHdrFile::StepRepeatRecord& message) override;
40  };
41 
42  bool Parse(std::filesystem::path path) override;
43  // Inherited via IStreamSaveable
44  bool Save(std::ostream& os) override;
45 
46  // Inherited via IProtoBuffable
47  std::unique_ptr<Odb::Lib::Protobuf::StepHdrFile> to_protobuf() const override;
48  void from_protobuf(const Odb::Lib::Protobuf::StepHdrFile& message) override;
49 
50  private:
51  std::string m_units;
52  double xDatum;
53  double yDatum;
54  unsigned id;
55  double xOrigin;
56  double yOrigin;
57  double topActive;
58  double bottomActive;
59  double rightActive;
60  double leftActive;
61  std::string affectingBom;
62  bool affectingBomChanged;
63  std::map<std::string, std::string> m_onlineValues;
64 
65  StepRepeatRecord::Vector m_stepRepeatRecords;
66 
67  };
68 }