DATAKIT SDK  V2026.4
BillOfMaterial.hpp
Go to the documentation of this file.
1 //*************************************************************************************
2 // BillOfMaterial.hpp
3 // Declarations for Bill of Materials traversal functions.
4 //*************************************************************************************
5 
6 #pragma once
7 
8 #include "datakit.h"
9 
10 // Represents a single entry in the Bill of Materials.
11 struct BomEntry
12 {
13  Dtk_string partName; // Prototype (part) name
14  Dtk_string instanceName; // Instance name (empty for the root)
15  Dtk_Int32 depth; // Nesting depth in the assembly tree (root = 0)
16  Dtk_Int32 occurrenceCount; // How many times this part appears at this level
17  bool isMissing; // true if ComponentMissing flag is set on the prototype
18 };
19 
20 // Creates a Bill of Materials for the given Dtk_MainDoc by traversing its assembly tree.
21 void CreateBomForMainDoc( Dtk_MainDocPtr inMainDoc, Dtk_tab<BomEntry> &outBomEntries );
22 
23 // Traverses the assembly tree starting from inComponent and populates outBomEntries.
24 // inDepth is the current nesting depth (start with 0 for the root).
25 void TraverseBom(Dtk_ComponentPtr inComponent, Dtk_tab<BomEntry> &outBomEntries, Dtk_Int32 inDepth = 0);
26 
27 // Prints the BOM entries to the standard output in a human-readable tree format.
28 void PrintBom(const Dtk_tab<BomEntry> &inBomEntries);
29 
30 // Prints a summary that counts how many times each unique part name appears across
31 // the whole assembly (flattened occurrence count).
32 void PrintBomSummary(const Dtk_tab<BomEntry> &inBomEntries);
33 
34 
35 
BomEntry::depth
Dtk_Int32 depth
Definition: BillOfMaterial.hpp:15
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
CreateBomForMainDoc
void CreateBomForMainDoc(Dtk_MainDocPtr inMainDoc, Dtk_tab< BomEntry > &outBomEntries)
Definition: BillOfMaterial.cpp:24
BomEntry::isMissing
bool isMissing
Definition: BillOfMaterial.hpp:17
PrintBom
void PrintBom(const Dtk_tab< BomEntry > &inBomEntries)
Definition: BillOfMaterial.cpp:133
PrintBomSummary
void PrintBomSummary(const Dtk_tab< BomEntry > &inBomEntries)
Definition: BillOfMaterial.cpp:178
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:686
BomEntry::occurrenceCount
Dtk_Int32 occurrenceCount
Definition: BillOfMaterial.hpp:16
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
datakit.h
Dtk_tab
This is a high level array class.
Definition: util_stl_dtk.hpp:84
TraverseBom
void TraverseBom(Dtk_ComponentPtr inComponent, Dtk_tab< BomEntry > &outBomEntries, Dtk_Int32 inDepth=0)
Definition: BillOfMaterial.cpp:43
BomEntry
Definition: BillOfMaterial.hpp:12
BomEntry::partName
Dtk_string partName
Definition: BillOfMaterial.hpp:13
BomEntry::instanceName
Dtk_string instanceName
Definition: BillOfMaterial.hpp:14