NVIDIA DOCA SDK
Data Center on a Chip Framework Documentation
binary_content.hpp
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2025 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3
*
4
* Redistribution and use in source and binary forms, with or without modification, are permitted
5
* provided that the following conditions are met:
6
* * Redistributions of source code must retain the above copyright notice, this list of
7
* conditions and the following disclaimer.
8
* * Redistributions in binary form must reproduce the above copyright notice, this list of
9
* conditions and the following disclaimer in the documentation and/or other materials
10
* provided with the distribution.
11
* * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12
* to endorse or promote products derived from this software without specific prior written
13
* permission.
14
*
15
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21
* STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
*
24
*/
25
26
#ifndef APPLICATIONS_STORAGE_STORAGE_COMMON_BINARY_CONTENT_HPP_
27
#define APPLICATIONS_STORAGE_STORAGE_COMMON_BINARY_CONTENT_HPP_
28
29
#include <cstdint>
30
#include <string>
31
#include <vector>
32
33
namespace
storage
{
34
35
/*
36
* Structure representing the content of a storage binary content (.sbc) file
37
*/
38
struct
binary_content
{
39
uint32_t
block_size
;
40
uint32_t
block_count
;
41
std::vector<uint8_t>
content
;
42
};
43
44
bool
file_has_binary_content_header
(std::string
const
&file_name);
45
46
/*
47
* Load a .sbc file from disk
48
*
49
* @file_name [in]: Name of file to load from
50
* @return: loaded content
51
* @throws storage::runtime_error - an error occurred
52
*/
53
storage::binary_content
load_binary_content_from_file
(std::string
const
&file_name);
54
55
/*
56
* Write content into a .sbc file on disk
57
*
58
* @file_name [in]: Name of file to write into
59
* @sbc: Content to write
60
* @throws storage::runtime_error - an error occurred
61
*/
62
void
write_binary_content_to_file
(std::string
const
&file_name,
storage::binary_content
const
&sbc);
63
64
}
// namespace storage
65
66
#endif
/* APPLICATIONS_STORAGE_STORAGE_COMMON_BINARY_CONTENT_HPP_ */
storage
Definition:
aligned_new.hpp:34
storage::write_binary_content_to_file
void write_binary_content_to_file(std::string const &file_name, storage::binary_content const &sbc)
Definition:
binary_content.cpp:141
storage::file_has_binary_content_header
bool file_has_binary_content_header(std::string const &file_name)
Definition:
binary_content.cpp:74
storage::load_binary_content_from_file
storage::binary_content load_binary_content_from_file(std::string const &file_name)
Definition:
binary_content.cpp:94
storage::binary_content
Definition:
binary_content.hpp:38
storage::binary_content::block_count
uint32_t block_count
Definition:
binary_content.hpp:40
storage::binary_content::content
std::vector< uint8_t > content
Definition:
binary_content.hpp:41
storage::binary_content::block_size
uint32_t block_size
Definition:
binary_content.hpp:39
applications
storage
storage_common
binary_content.hpp
Generated on Wed Aug 13 2025 09:23:36 for NVIDIA DOCA SDK by
1.9.1