OdbDesignLib
OdbDesign ODB++ Parsing Library
StepDirectory.h
1 #pragma once
2 
3 #include <string>
4 #include <map>
5 #include <memory>
6 #include <filesystem>
7 
8 #include "../../odbdesign_export.h"
9 #include "LayerDirectory.h"
10 #include "EdaDataFile.h"
11 #include "NetlistFile.h"
12 #include "../../IProtoBuffable.h"
13 #include "../../ProtoBuf/stepdirectory.pb.h"
14 #include "ComponentsFile.h"
15 #include "AttrListFile.h"
16 #include "StepHdrFile.h"
17 
18 
19 namespace Odb::Lib::FileModel::Design
20 {
21  class ODBDESIGN_EXPORT StepDirectory : public IProtoBuffable<Odb::Lib::Protobuf::StepDirectory>
22  {
23  public:
24  StepDirectory(std::filesystem::path path);
25  ~StepDirectory();
26 
27  std::string GetName();
28  std::filesystem::path GetPath();
29 
30  const EdaDataFile& GetEdaDataFile() const;
31  const LayerDirectory::StringMap& GetLayersByName() const;
32  const NetlistFile::StringMap& GetNetlistsByName() const;
33  const AttrListFile& GetAttrListFile() const;
34  const FeaturesFile& GetProfileFile() const;
35  const StepHdrFile& GetStepHdrFile() const;
36 
37  const ComponentsFile* GetTopComponentsFile() const;
38  const ComponentsFile* GetBottomComponentsFile() const;
39 
40  bool Parse();
41 
42  typedef std::map<std::string, std::shared_ptr<StepDirectory>> StringMap;
43 
44  // Inherited via IProtoBuffable
45  std::unique_ptr<Odb::Lib::Protobuf::StepDirectory> to_protobuf() const override;
46  void from_protobuf(const Odb::Lib::Protobuf::StepDirectory& message) override;
47 
48  private:
49  std::string m_name;
50  std::filesystem::path m_path;
51 
52  LayerDirectory::StringMap m_layersByName;
53  NetlistFile::StringMap m_netlistsByName;
54  EdaDataFile m_edaData;
55  AttrListFile m_attrListFile;
56  FeaturesFile m_profileFile;
57  StepHdrFile m_stepHdrFile;
58 
59  bool ParseLayerFiles(std::filesystem::path layersPath);
60  bool ParseNetlistFiles(std::filesystem::path netlistsPath);
61  bool ParseEdaDataFiles(std::filesystem::path edaPath);
62  bool ParseAttrListFile(std::filesystem::path attrListFileDirectory);
63  bool ParseProfileFile(std::filesystem::path profileFileDirectory);
64  bool ParseStepHdrFile(std::filesystem::path stepHdrFileDirectory);
65 
66  constexpr inline static const char* PROFILE_FILENAME = "profile";
67 
68  };
69 }
70