16#include <peak/dll_interface/peak_dll_interface_util.hpp>
82 FileAdapter(
const std::shared_ptr<NodeMap>& nodeMap,
const std::string& fileName);
128 uint64_t
Read(uint8_t* buffer, uint64_t size, uint64_t offset = 0)
const;
149 void Write(
const std::vector<uint8_t>& data, uint64_t offset = 0)
const;
169 void Write(
const uint8_t* buffer, uint64_t bufferSize, uint64_t offset = 0)
const;
227 if (nodeMap ==
nullptr)
232 peak::core::ExecuteAndMapReturnCodes([&] {
244 std::vector<uint8_t> array(
static_cast<size_t>(size));
245 uint64_t readBytes{};
247 peak::core::ExecuteAndMapReturnCodes([&] {
251 array.resize(
static_cast<size_t>(readBytes));
258 uint64_t readBytes{};
260 peak::core::ExecuteAndMapReturnCodes([&] {
269 peak::core::ExecuteAndMapReturnCodes([&] {
276 peak::core::ExecuteAndMapReturnCodes([&] {
283 peak::core::ExecuteAndMapReturnCodes([&] {
291 peak::core::ExecuteAndMapReturnCodes([&] {
301 peak::core::ExecuteAndMapReturnCodes([&] {
310 if (nodeMap ==
nullptr)
316 if (fileSelectorNode ==
nullptr)
320 std::vector<std::string> availableFileNames{};
322 availableFileNames.reserve(entries.size());
324 for (
const auto& entry : entries)
326 availableFileNames.emplace_back(entry->SymbolicValue());
328 return availableFileNames;
The exception thrown for passing an invalid argument to a function.
Definition peak_exception.hpp:74
Represents a GenAPI node map.
Definition peak_node_map.hpp:62
The exception thrown for signaling that a feature is not available in the device.
Definition peak_exception.hpp:98
FileAdapter(FileAdapter &&other)=delete
void Delete() const
Deletes the file the adapter references.
Definition peak_fileadapter.hpp:281
FileAdapter(const FileAdapter &other)=delete
~FileAdapter()
Definition peak_fileadapter.hpp:237
PEAK_NO_DISCARD uint64_t Size() const
Returns the content size of the file the adapter references. This is the maximum size that can be rea...
Definition peak_fileadapter.hpp:288
FileAdapter & operator=(FileAdapter &&other)=delete
static PEAK_NO_DISCARD std::vector< std::string > AvailableFileNames(const std::shared_ptr< NodeMap > &nodeMap)
Returns a vector of available file names from the given NodeMap. File names may vary depending on the...
Definition peak_fileadapter.hpp:308
FileAdapter(const std::shared_ptr< NodeMap > &nodeMap, const std::string &fileName)
Constructs a FileAdapter for a specific file name in the RemoteDevice's NodeMap.
Definition peak_fileadapter.hpp:225
PEAK_NO_DISCARD std::vector< uint8_t > Read(uint64_t size, uint64_t offset=0) const
Returns the contents of the file that the adapter references.
Definition peak_fileadapter.hpp:242
FileAdapter & operator=(const FileAdapter &other)=delete
void Write(const std::vector< uint8_t > &data, uint64_t offset=0) const
Writes the data to the file the adapter references.
Definition peak_fileadapter.hpp:267
PEAK_NO_DISCARD uint64_t MaxSize() const
Returns the maximum size of the file the adapter references. This is the maximum size that can be wri...
Definition peak_fileadapter.hpp:298
Represents a GenAPI enumeration node.
Definition peak_enumeration_node.hpp:39
std::vector< std::shared_ptr< EnumerationEntryNode > > AvailableEntries() const
Returns the currently selectable entries.
Definition peak_enumeration_node.hpp:400
Definition peak_fileadapter.hpp:28
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:31
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:33
PEAK_C_API PEAK_FileAdapter_GetMaxSize(PEAK_FILE_ADAPTER_HANDLE fileAdapterHandle, uint64_t *maxSize)
Queries the maximum size of the given file.
PEAK_C_API PEAK_FileAdapter_Read(PEAK_FILE_ADAPTER_HANDLE fileAdapterHandle, uint64_t size, uint64_t offset, uint8_t *data, uint64_t *dataSize)
Reads from the given file.
#define PEAK_NO_DISCARD
Definition peak_backend.h:27
PEAK_C_API PEAK_FileAdapter_GetSize(PEAK_FILE_ADAPTER_HANDLE fileAdapterHandle, uint64_t *size)
Queries the size of the given file.
PEAK_C_API PEAK_FileAdapter_Delete(PEAK_FILE_ADAPTER_HANDLE fileAdapterHandle)
Deletes the given file.
struct PEAK_FILE_ADAPTER * PEAK_FILE_ADAPTER_HANDLE
Definition peak_backend.h:489
PEAK_C_API PEAK_FileAdapter_Write(PEAK_FILE_ADAPTER_HANDLE fileAdapterHandle, const uint8_t *data, uint64_t size, uint64_t offset)
Writes to the given file.
PEAK_C_API PEAK_FileAdapter_Construct(PEAK_NODE_MAP_HANDLE nodeMapHandle, const char *fileName, PEAK_FILE_ADAPTER_HANDLE *fileAdapterHandle)
Creates a file adapter.
PEAK_C_API PEAK_FileAdapter_Destruct(PEAK_FILE_ADAPTER_HANDLE fileAdapterHandle)
Destroys the given file adapter.
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:16