16#include <peak/dll_interface/peak_dll_interface_util.hpp>
83 FileAdapter(
const std::shared_ptr<NodeMap>& nodeMap,
const std::string& fileName);
129 uint64_t
Read(uint8_t* buffer, uint64_t size, uint64_t offset = 0)
const;
150 void Write(
const std::vector<uint8_t>& data, uint64_t offset = 0)
const;
170 void Write(
const uint8_t* buffer, uint64_t bufferSize, uint64_t offset = 0)
const;
228 if (nodeMap ==
nullptr)
233 peak::core::ExecuteAndMapReturnCodes([&] {
245 std::vector<uint8_t> array(
static_cast<size_t>(size));
246 uint64_t readBytes{};
248 peak::core::ExecuteAndMapReturnCodes([&] {
252 array.resize(
static_cast<size_t>(readBytes));
259 uint64_t readBytes{};
261 peak::core::ExecuteAndMapReturnCodes([&] {
270 peak::core::ExecuteAndMapReturnCodes([&] {
277 peak::core::ExecuteAndMapReturnCodes([&] {
284 peak::core::ExecuteAndMapReturnCodes([&] {
292 peak::core::ExecuteAndMapReturnCodes([&] {
302 peak::core::ExecuteAndMapReturnCodes([&] {
311 if (nodeMap ==
nullptr)
317 if (fileSelectorNode ==
nullptr)
321 std::vector<std::string> availableFileNames{};
323 availableFileNames.reserve(entries.size());
325 for (
const auto& entry : entries)
327 availableFileNames.emplace_back(entry->SymbolicValue());
329 return availableFileNames;
The exception thrown for passing an invalid argument to a function.
Definition peak_exception.hpp:116
Represents a GenAPI node map.
Definition peak_node_map.hpp:63
The exception thrown for signaling that a feature is not available in the device.
Definition peak_exception.hpp:177
FileAdapter(FileAdapter &&other)=delete
void Delete() const
Deletes the file the adapter references.
Definition peak_fileadapter.hpp:282
FileAdapter(const FileAdapter &other)=delete
~FileAdapter()
Definition peak_fileadapter.hpp:238
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:289
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:309
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:226
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:243
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:268
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:299
Represents a GenAPI enumeration node.
Definition peak_enumeration_node.hpp:40
std::vector< std::shared_ptr< EnumerationEntryNode > > AvailableEntries() const
Returns the currently selectable entries.
Definition peak_enumeration_node.hpp:409
Definition peak_fileadapter.hpp:28
The "core" namespace contains the direct GenAPI and GenTL wrapper.
Definition peak_buffer.hpp:34
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition peak_dynamic_loader.h:35
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