OdbDesign
OdbDesign ODB++ Parser - C++ library, gRPC/REST server, CLI, tests
 
Loading...
Searching...
No Matches
LayerDirectory.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#include "../../odbdesign_export.h"
8#include "ComponentsFile.h"
9#include "../../IProtoBuffable.h"
10#include "layerdirectory.pb.h"
11#include "FeaturesFile.h"
12#include "AttrListFile.h"
13#include "ToolsFile.h"
14#include "../ISaveable.h"
15
16
18{
19 class ODBDESIGN_EXPORT LayerDirectory : public IProtoBuffable<Odb::Lib::Protobuf::LayerDirectory>, public ISaveable
20 {
21 public:
22 LayerDirectory(std::filesystem::path path);
23 virtual ~LayerDirectory();
24
25 std::string GetName() const;
26 std::filesystem::path GetPath() const;
27
28 bool Parse();
29 // Inherited via ISaveable
30 bool Save(const std::filesystem::path& directory) override;
31
32 bool ParseComponentsFile(std::filesystem::path directory);
33 bool ParseFeaturesFile(std::filesystem::path directory);
34 bool ParseAttrListFile(std::filesystem::path directory);
35 bool ParseToolsFile(std::filesystem::path directory);
36
37 const ComponentsFile& GetComponentsFile() const;
38 const FeaturesFile& GetFeaturesFile() const;
39 const AttrListFile& GetAttrListFile() const;
40 const ToolsFile& GetToolsFile() const;
41
42 typedef std::map<std::string, std::shared_ptr<LayerDirectory>> StringMap;
43
44 // Inherited via IProtoBuffable
45 std::unique_ptr<Odb::Lib::Protobuf::LayerDirectory> to_protobuf() const override;
46 // M6 streaming: same message with the features file serialized as a
47 // skeleton (featureRecords omitted, delivered via FeatureBatch chunks).
48 std::unique_ptr<Odb::Lib::Protobuf::LayerDirectory> to_protobuf_skeleton() const;
49 void from_protobuf(const Odb::Lib::Protobuf::LayerDirectory& message) override;
50
51 private:
52 std::string m_name;
53 std::filesystem::path m_path;
54
55 ComponentsFile m_componentsFile;
56 FeaturesFile m_featuresFile;
57 AttrListFile m_attrListFile;
58 ToolsFile m_toolsFile;
59
60 // Shared body of to_protobuf() / to_protobuf_skeleton(); only the
61 // features-file serialization differs, keeping the skeleton
62 // byte-compatible with the full serialization.
63 void FillProtobufMessage(Odb::Lib::Protobuf::LayerDirectory& layerDirectoryMessage, bool includeFeatureRecords) const;
64
65 };
66}
std::map< std::string, std::shared_ptr< LayerDirectory > > StringMap
#define ODBDESIGN_EXPORT