Zivid C++ API 2.19.0+b5c53d0f-1
SupportBundle.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of the Zivid API
3 *
4 * Copyright 2015-2026 (C) Zivid AS
5 * All rights reserved.
6 *
7 * Zivid Software License, v1.0
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 *
19 * 3. Neither the name of Zivid AS nor the names of its contributors may be used
20 * to endorse or promote products derived from this software without specific
21 * prior written permission.
22 *
23 * 4. This software, with or without modification, must not be used with any
24 * other 3D camera than from Zivid AS.
25 *
26 * 5. Any software provided in binary form under this license must not be
27 * reverse engineered, decompiled, modified and/or disassembled.
28 *
29 * THIS SOFTWARE IS PROVIDED BY ZIVID AS "AS IS" AND ANY EXPRESS OR IMPLIED
30 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
31 * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
32 * DISCLAIMED. IN NO EVENT SHALL ZIVID AS OR CONTRIBUTORS BE LIABLE FOR ANY
33 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
35 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
36 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
38 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Contact: Zivid Customer Success Team <customersuccess@zivid.com>
41 * Info: http://www.zivid.com
42 ******************************************************************************/
43
44#pragma once
45
47#include "Zivid/Detail/Pimpl.h"
48
49#include <chrono>
50#include <cstddef>
51#include <cstdint>
52#include <filesystem>
53#include <future>
54#include <optional>
55#include <string>
56#include <utility>
57#include <vector>
58
59namespace Zivid
60{
61 class Application;
62 class Frame;
63 class Frame2D;
64
66 {
67#ifndef NO_DOC
69 namespace Detail
70 {
71 struct ProgressSentinel
72 {};
73
74 class ProgressIterator;
75 } // namespace Detail
76#endif
77
92 {
94
95 public:
97 struct Update
98 {
101
103 std::string description;
104 };
105
108
110 ZIVID_CORE_EXPORT Detail::ProgressIterator begin() const;
111
113 static ZIVID_CORE_EXPORT Detail::ProgressSentinel end();
114 };
115
116#ifndef NO_DOC
117 class Detail::ProgressIterator
118 {
119 public:
120 ZIVID_CORE_EXPORT const Progress::Update &operator*() const;
121 ZIVID_CORE_EXPORT ProgressIterator &operator++();
122 ZIVID_CORE_EXPORT bool operator==(ProgressSentinel /*unused*/) const;
123 ZIVID_CORE_EXPORT bool operator!=(ProgressSentinel sentinel) const;
124
125 private:
126 ProgressIterator(Progress progress, std::pair<Progress::Update, std::size_t> current);
127 friend class SupportBundle::Progress;
128
129 Progress m_progress;
130 std::optional<std::pair<Progress::Update, std::size_t>> m_current;
131 };
132#endif
133
140 class Future
141 {
143
144 public:
152 ZIVID_CORE_EXPORT std::filesystem::path get() const;
153
156
161 ZIVID_CORE_EXPORT std::future_status waitFor(std::chrono::nanoseconds timeout) const;
162
165 };
166
169 {
171 std::uint64_t logBytes;
173 std::uint64_t frameBytes;
174 };
175
178 {
180 std::chrono::system_clock::time_point created;
182 std::chrono::system_clock::time_point modified;
184 std::uint64_t sizeBytes;
185 };
186
208 {
210
211 public:
213 ZIVID_CORE_EXPORT Builder &attachedFrames(std::vector<Frame> frames);
214
218 ZIVID_CORE_EXPORT Builder &attachedFrame2Ds(std::vector<Frame2D> frames);
223 ZIVID_CORE_EXPORT Builder &attachedZDFFiles(std::vector<std::filesystem::path> files);
224
235 std::chrono::system_clock::time_point since,
236 std::chrono::system_clock::time_point before);
237
245
257 [[nodiscard]] ZIVID_CORE_EXPORT Future create(Application &application) const;
258 };
259
267 ZIVID_CORE_EXPORT Builder builder(const std::filesystem::path &destinationFolder);
268
278 ZIVID_CORE_EXPORT std::vector<LogFileInfo> logFiles();
279 } // namespace Experimental::SupportBundle
280
281} // namespace Zivid
#define ZIVID_CORE_EXPORT
Definition CoreExport.h:56
#define ZIVID_PIMPL_VALUE_SEMANTICS(ClassName, Attributes)
Definition Pimpl.h:53
#define ZIVID_PIMPL_MOVE_ONLY(ClassName, Attributes)
Definition Pimpl.h:110
#define ZIVID_PIMPL_REFERENCE_SEMANTICS(ClassName, Attributes)
Definition Pimpl.h:149
Manager class for Zivid.
Definition Application.h:100
Configures a support bundle: a compressed archive (.tar.zst) of SDK logs, frames and camera informati...
Definition SupportBundle.h:208
ZIVID_CORE_EXPORT SizeEstimate estimateSize() const
Estimates how large the bundle will be, split into logs and frames.
ZIVID_CORE_EXPORT Builder & attachedFrames(std::vector< Frame > frames)
Frames to include in the bundle. They are saved as ZDF files. Replaces any frames set earlier.
ZIVID_CORE_EXPORT Future create(Application &application) const
Creates the support bundle from the given application in the background, and returns a Future for it ...
ZIVID_CORE_EXPORT Builder & attachedFrame2Ds(std::vector< Frame2D > frames)
2D frames to include in the bundle. They are saved as ZDF files. Replaces any 2D frames set earlier.
ZIVID_CORE_EXPORT Builder & attachedZDFFiles(std::vector< std::filesystem::path > files)
ZDF files to include in the bundle. Replaces any files set earlier.
ZIVID_CORE_EXPORT Builder & filterLogs(std::chrono::system_clock::time_point since, std::chrono::system_clock::time_point before)
Includes only the log files that were written to between since and before .
A support bundle being collected in the background, returned by Builder::create.
Definition SupportBundle.h:141
ZIVID_CORE_EXPORT void wait() const
Blocks until collection has finished or failed.
ZIVID_CORE_EXPORT Progress progress() const
Returns a view of the collection's progress. It stays valid after the Future is destroyed.
ZIVID_CORE_EXPORT std::filesystem::path get() const
Blocks until collection has finished, then returns the path of the support bundle.
ZIVID_CORE_EXPORT std::future_status waitFor(std::chrono::nanoseconds timeout) const
Blocks until collection has finished or failed, or until the timeout has passed. Returns std::future_...
A view of a support bundle collection's progress, from Future::progress.
Definition SupportBundle.h:92
ZIVID_CORE_EXPORT Update latest() const
Returns the newest update without blocking.
static ZIVID_CORE_EXPORT Detail::ProgressSentinel end()
Returns the end of the range, reached when collection has finished or failed.
ZIVID_CORE_EXPORT Detail::ProgressIterator begin() const
Returns an iterator at the newest update. Used by range-based for loops.
A 2D frame captured by a Zivid camera.
Definition Frame2D.h:74
A frame captured by a Zivid camera.
Definition Frame.h:70
Definition EnvironmentInfo.h:74
Definition SupportBundle.h:66
ZIVID_CORE_EXPORT Builder builder(const std::filesystem::path &destinationFolder)
Starts configuring a support bundle that will be written to the given folder.
ZIVID_CORE_EXPORT std::vector< LogFileInfo > logFiles()
Returns information about the log files that a support bundle can include.
The main Zivid namespace. All Zivid code is found here.
Definition Application.h:85
The time span and size of one log file, returned from logFiles.
Definition SupportBundle.h:178
std::uint64_t sizeBytes
The size of the file.
Definition SupportBundle.h:184
std::chrono::system_clock::time_point modified
When the file was last written to.
Definition SupportBundle.h:182
std::chrono::system_clock::time_point created
When the first entry in the file was written.
Definition SupportBundle.h:180
A snapshot of how far collection has come.
Definition SupportBundle.h:98
double percentage
Progress from 0 to 100. It never decreases.
Definition SupportBundle.h:100
std::string description
What is being collected, for example "Adding log files".
Definition SupportBundle.h:103
An estimate of the size of a support bundle, in bytes, split by content.
Definition SupportBundle.h:169
std::uint64_t logBytes
The size of the log files the bundle will include.
Definition SupportBundle.h:171
std::uint64_t frameBytes
The size of the attached frames and ZDF files.
Definition SupportBundle.h:173