 |
DATAKIT SDK
V2026.4
|
|
Go to the source code of this file.
◆ CreateBomForMainDoc()
27 if( rootComponent.
IsNULL() )
29 std::cout <<
"Warning: document has no root component." << std::endl;
◆ PrintBom()
135 std::cout << std::endl;
136 std::cout <<
"Bill of Materials" << std::endl;
137 std::cout <<
"-----------------" << std::endl;
139 if (inBomEntries.
size() == 0)
141 std::cout <<
" (no components found)" << std::endl;
147 const BomEntry &entry = inBomEntries[i];
152 for (
Dtk_Int32 d = 0; d < depth - 1; ++d)
167 std::cout <<
" [MISSING]";
169 std::cout << std::endl;
◆ PrintBomSummary()
180 std::cout << std::endl;
181 std::cout <<
"Summary (flattened occurrence count)" << std::endl;
182 std::cout <<
"------------------------------------" << std::endl;
184 if (inBomEntries.
size() == 0)
186 std::cout <<
" (no components found)" << std::endl;
191 std::map<std::string, int> countMap;
192 std::map<std::string, bool> missingMap;
196 const BomEntry &entry = inBomEntries[i];
200 missingMap[key] =
true;
204 std::cout <<
" Part Name | Count | Status" << std::endl;
205 std::cout <<
" ---------------------------------- | ----- | --------------------" << std::endl;
207 for (std::map<std::string, int>::const_iterator it = countMap.begin();
208 it != countMap.end(); ++it)
210 const std::string &key = it->first;
213 std::string name = key;
214 if (name.size() > 34)
215 name = name.substr(0, 31) +
"...";
219 for (
size_t pad = name.size(); pad < 34; ++pad)
224 std::string countStr = std::to_string(it->second);
225 for (
size_t pad = countStr.size(); pad < 5; ++pad)
227 std::cout << countStr;
231 bool hasMissing = missingMap.count(key) > 0;
233 std::cout <<
" [MISSING]";
234 std::cout << std::endl;
236 std::cout << std::endl;
◆ TraverseBom()
53 Dtk_string instanceName = inComponent->InstanceName();
56 if (inComponent->GetNumChildren() > 0)
64 entry.
depth = inDepth;
78 Dtk_Size_t numChildren = inComponent->GetNumChildren();
81 TraverseBom(inComponent->GetChild(i), outBomEntries, inDepth);
89 Dtk_Size_t numChildren = inComponent->GetNumChildren();
93 if (activatedIndices.
size() > 0)
97 TraverseBom(inComponent->GetChild(activatedIndices[i]), outBomEntries, inDepth);
103 Dtk_Int32 defaultIndex = inComponent->GetDefaultChildInCatalog();
104 if (defaultIndex >= 0 &&
static_cast<Dtk_Size_t>(defaultIndex) < numChildren)
106 TraverseBom(inComponent->GetChild(defaultIndex), outBomEntries, inDepth);
115 Dtk_Size_t numChildren = inComponent->GetNumChildren();
118 TraverseBom(inComponent->GetChild(i), outBomEntries, inDepth);
void TraverseBom(Dtk_ComponentPtr inComponent, Dtk_tab< BomEntry > &outBomEntries, Dtk_Int32 inDepth)
Definition: BillOfMaterial.cpp:43
@ CatalogComponentType
Definition: dtk_maindoc.hpp:575
Dtk_Int32 depth
Definition: BillOfMaterial.hpp:15
Dtk_bool IsNotNULL() const
Definition: util_ptr_dtk.hpp:119
#define DTK_TRUE
Definition: define.h:726
This is a high level string class.
Definition: dtk_string.hpp:53
size_t Dtk_Size_t
Definition: define.h:711
bool isMissing
Definition: BillOfMaterial.hpp:17
@ VirtualComponentType
Definition: dtk_maindoc.hpp:576
@ InstanceComponentType
Definition: dtk_maindoc.hpp:573
Dtk_bool is_not_NULL() const
int32_t Dtk_Int32
Definition: define.h:686
Dtk_Int32 occurrenceCount
Definition: BillOfMaterial.hpp:16
ComponentTypeEnum
Definition: dtk_maindoc.hpp:572
Dtk_bool IsNULL() const
Definition: util_ptr_dtk.hpp:118
Definition: util_ptr_dtk.hpp:37
const char * c_str() const
Retrieve the ASCII conversion string.
Dtk_Size_t size() const
Returns the size of the array.
Definition: util_stl_dtk.hpp:503
Definition: BillOfMaterial.hpp:12
Dtk_string partName
Definition: BillOfMaterial.hpp:13
@ PrototypeComponentType
Definition: dtk_maindoc.hpp:574
@ ComponentMissing
Definition: dtk_maindoc.hpp:562
int len() const
Retrieve the length of the Dtk_string.
void push_back(const T &x)
Inserts an element at the end of the array.
Definition: util_stl_dtk.hpp:416
Dtk_string instanceName
Definition: BillOfMaterial.hpp:14