OdbDesign
OdbDesign ODB++ Parser - C++ library, gRPC/REST server, CLI, tests
 
Loading...
Searching...
No Matches
StepDirectory.h
Go to the documentation of this file.
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 "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
22{
23 class ODBDESIGN_EXPORT StepDirectory : public IProtoBuffable<Odb::Lib::Protobuf::StepDirectory>, public ISaveable
24 {
25 public:
26 StepDirectory(std::filesystem::path path);
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 // M6 streaming: same message with every layer's feature records
51 // omitted (layers serialized as skeletons; the records are delivered
52 // via FeatureBatch chunks). Profile/eda/netlist/components ride whole.
53 std::unique_ptr<Odb::Lib::Protobuf::StepDirectory> to_protobuf_skeleton() const;
54 void from_protobuf(const Odb::Lib::Protobuf::StepDirectory& message) override;
55
56 private:
57 std::string m_name;
58 std::filesystem::path m_path;
59
60 LayerDirectory::StringMap m_layersByName;
61 NetlistFile::StringMap m_netlistsByName;
62 EdaDataFile m_edaData;
63 AttrListFile m_attrListFile;
64 FeaturesFile m_profileFile;
65 StepHdrFile m_stepHdrFile;
66
67 bool ParseLayerFiles(std::filesystem::path layersPath);
68 bool ParseNetlistFiles(std::filesystem::path netlistsPath);
69 bool ParseEdaDataFiles(std::filesystem::path edaPath);
70 bool ParseAttrListFile(std::filesystem::path attrListFileDirectory);
71 bool ParseProfileFile(std::filesystem::path profileFileDirectory);
72 bool ParseStepHdrFile(std::filesystem::path stepHdrFileDirectory);
73
74 // Shared body of to_protobuf() / to_protobuf_skeleton(); only the
75 // layer serialization differs, keeping the skeleton byte-compatible
76 // with the full serialization.
77 void FillProtobufMessage(Odb::Lib::Protobuf::StepDirectory& stepDirectoryMessage, bool layerSkeletons) const;
78
79
80 constexpr inline static const char* PROFILE_FILENAME = "profile";
81
82 };
83}
84
85
std::map< std::string, std::shared_ptr< LayerDirectory > > StringMap
std::map< std::string, std::shared_ptr< NetlistFile > > StringMap
std::map< std::string, std::shared_ptr< StepDirectory > > StringMap
#define ODBDESIGN_EXPORT