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 #include "../ISaveable.h"
18 #include "FeaturesFile.h"
19 
20 
21 namespace Odb::Lib::FileModel::Design
22 {
23  class ODBDESIGN_EXPORT StepDirectory : public IProtoBuffable<Odb::Lib::Protobuf::StepDirectory>, public ISaveable
24  {
25  public:
26  StepDirectory(std::filesystem::path path);
27  ~StepDirectory();
28 
29  std::string GetName();
30  std::filesystem::path GetPath();
31 
32  const EdaDataFile& GetEdaDataFile() const;
33  const LayerDirectory::StringMap& GetLayersByName() const;
34  const NetlistFile::StringMap& GetNetlistsByName() const;
35  const AttrListFile& GetAttrListFile() const;
36  const FeaturesFile& GetProfileFile() const;
37  const StepHdrFile& GetStepHdrFile() const;
38 
39  const ComponentsFile* GetTopComponentsFile() const;
40  const ComponentsFile* GetBottomComponentsFile() const;
41 
42  bool Parse();
43  // Inherited via ISaveable
44  bool Save(const std::filesystem::path& directory) override;
45 
46  typedef std::map<std::string, std::shared_ptr<StepDirectory>> StringMap;
47 
48  // Inherited via IProtoBuffable
49  std::unique_ptr<Odb::Lib::Protobuf::StepDirectory> to_protobuf() const override;
50  void from_protobuf(const Odb::Lib::Protobuf::StepDirectory& message) override;
51 
52  private:
53  std::string m_name;
54  std::filesystem::path m_path;
55 
56  LayerDirectory::StringMap m_layersByName;
57  NetlistFile::StringMap m_netlistsByName;
58  EdaDataFile m_edaData;
59  AttrListFile m_attrListFile;
60  FeaturesFile m_profileFile;
61  StepHdrFile m_stepHdrFile;
62 
63  bool ParseLayerFiles(std::filesystem::path layersPath);
64  bool ParseNetlistFiles(std::filesystem::path netlistsPath);
65  bool ParseEdaDataFiles(std::filesystem::path edaPath);
66  bool ParseAttrListFile(std::filesystem::path attrListFileDirectory);
67  bool ParseProfileFile(std::filesystem::path profileFileDirectory);
68  bool ParseStepHdrFile(std::filesystem::path stepHdrFileDirectory);
69 
70  constexpr inline static const char* PROFILE_FILENAME = "profile";
71 
72  };
73 }
74