| // utils.h | |
| // Transaction structure | |
| struct Transaction { | |
| std::string productName; | |
| int quantity; | |
| double unitPrice; | |
| std::string transactionType; | |
| }; | |
| // Function Declarations | |
| std::vector<Transaction> parseTransactionData(const std::string &filePath); | |
| std::vector<std::string> getProductList(const std::string &filePath, int &totalRows); | |
| void getUserSelectedProducts(const std::vector<std::string> &availableProducts, std::vector<std::string> &userSelectedProducts); | |
| std::vector<std::string> tokenizeString(const std::string &str, char delimiter); | |
| std::vector<std::string> retrieveWarehouseFiles(const std::string &directoryPath); | |
| std::string trimWhitespace(const std::string& str); | |
| // Logging Functions | |
| void logInfo(const std::string &message, const char* progName); | |
| void logError(const std::string &errorMessage, const char* progName); | |
| // Utility Functions for I/O Operations | |
| ssize_t writeAll(int fd, const void* buffer, size_t count); | |
| ssize_t readAll(int fd, void* buffer, size_t count); | |
| // RAII Wrapper for FIFO | |
| class FifoWrapper { | |
| public: | |
| FifoWrapper(const std::string& path, int flags, mode_t mode); | |
| ~FifoWrapper(); | |
| int getFd() const; | |
| const std::string& getPath() const; | |
| // Disable copy semantics | |
| FifoWrapper(const FifoWrapper&) = delete; | |
| FifoWrapper& operator=(const FifoWrapper&) = delete; | |
| // Enable move semantics | |
| FifoWrapper(FifoWrapper&& other) noexcept; | |
| FifoWrapper& operator=(FifoWrapper&& other) noexcept; | |
| private: | |
| std::string fifoPath; | |
| int fd; | |
| }; | |
Xet Storage Details
- Size:
- 1.69 kB
- Xet hash:
- e06a59627f798151a767e9d5fd8518e1754b1d3ada9de642b4f239d6c98aff13
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.