13#include <peak/dll_interface/peak_dll_interface_util.hpp>
79 FileAdapter(
const std::shared_ptr<NodeMap>& nodeMap,
const std::string& fileName);
158 void Write(
const std::vector<uint8_t>& data, uint64_t offset = 0)
const;
178 void Write(
const uint8_t* buffer, uint64_t bufferSize, uint64_t offset = 0)
const;
229 const std::shared_ptr<NodeMap>& nodeMap);
237 if (nodeMap ==
nullptr)
242 peak::core::ExecuteAndMapReturnCodes([&] {
244 nodeMap->Handle(), fileName.c_str(), &m_backendHandle);
255 std::vector<uint8_t> array(
static_cast<size_t>(size));
256 uint64_t readBytes{};
258 peak::core::ExecuteAndMapReturnCodes([&] {
262 array.resize(
static_cast<size_t>(readBytes));
274 uint64_t readBytes{};
276 peak::core::ExecuteAndMapReturnCodes([&] {
285 peak::core::ExecuteAndMapReturnCodes([&] {
292 peak::core::ExecuteAndMapReturnCodes(
298 peak::core::ExecuteAndMapReturnCodes(
305 peak::core::ExecuteAndMapReturnCodes(
314 peak::core::ExecuteAndMapReturnCodes(
322 if (nodeMap ==
nullptr)
328 if (fileSelectorNode ==
nullptr)
332 std::vector<std::string> availableFileNames{};
334 availableFileNames.reserve(entries.size());
336 for (
const auto& entry : entries)
338 availableFileNames.emplace_back(entry->SymbolicValue());
340 return availableFileNames;
The exception thrown for passing an invalid argument to a function.
Definition peak_exception.hpp:118
The exception thrown for signaling that a feature is not available in the device.
Definition peak_exception.hpp:181
FileAdapter(FileAdapter &&other)=delete
void Delete() const
Deletes the file the adapter references.
Definition peak_fileadapter.hpp:296
FileAdapter(const FileAdapter &other)=delete
~FileAdapter()
Definition peak_fileadapter.hpp:248
PEAK_COMMON_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:302
FileAdapter & operator=(FileAdapter &&other)=delete
static PEAK_COMMON_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:320
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:235
PEAK_COMMON_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:253
PEAK_COMMON_NO_DISCARD std::vector< uint8_t > ReadAll() const
Returns the entire content of the file that the adapter references.
Definition peak_fileadapter.hpp:267
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:283
PEAK_COMMON_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:311
Represents a GenAPI enumeration node.
Definition peak_enumeration_node.hpp:37
PEAK_COMMON_NO_DISCARD std::vector< std::shared_ptr< EnumerationEntryNode > > AvailableEntries() const
Returns the currently selectable entries.
Definition peak_enumeration_node.hpp:439
Definition peak_fileadapter.hpp:24
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:32
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_buffer.hpp:29
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.
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:487
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_COMMON_NO_DISCARD
Definition peak_common_defines.h:89
#define PEAK_C_ABI_PREFIX
Definition peak_dll_defines.h:13