2020-09-19 19:50:02 +02:00
|
|
|
#include "FileSystemMessage.h"
|
|
|
|
#include "../objectmanager/ObjectManagerIF.h"
|
2020-08-28 18:33:29 +02:00
|
|
|
|
2020-09-19 19:41:41 +02:00
|
|
|
|
2020-10-04 14:31:06 +02:00
|
|
|
void FileSystemMessage::setDeleteFileCommand(
|
2020-09-19 19:41:41 +02:00
|
|
|
CommandMessage* message, store_address_t storageID) {
|
|
|
|
message->setCommand(DELETE_FILE);
|
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
2020-10-04 14:31:06 +02:00
|
|
|
void FileSystemMessage::setCreateDirectoryCommand(
|
2020-09-19 19:41:41 +02:00
|
|
|
CommandMessage* message, store_address_t storageID) {
|
|
|
|
message->setCommand(CREATE_DIRECTORY);
|
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
2020-10-04 14:31:06 +02:00
|
|
|
void FileSystemMessage::setDeleteDirectoryCommand(
|
2020-09-19 19:41:41 +02:00
|
|
|
CommandMessage* message, store_address_t storageID) {
|
|
|
|
message->setCommand(DELETE_DIRECTORY);
|
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
2020-10-04 14:31:06 +02:00
|
|
|
void FileSystemMessage::setWriteCommand(CommandMessage* message,
|
2020-09-19 19:41:41 +02:00
|
|
|
store_address_t storageID) {
|
2020-10-04 23:24:36 +02:00
|
|
|
message->setCommand(APPEND_TO_FILE);
|
2020-09-19 19:41:41 +02:00
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
2020-10-04 14:31:06 +02:00
|
|
|
void FileSystemMessage::setReadCommand(CommandMessage* message,
|
2020-09-19 19:41:41 +02:00
|
|
|
store_address_t storageID) {
|
2020-10-04 23:24:36 +02:00
|
|
|
message->setCommand(READ_FROM_FILE);
|
2020-09-19 19:41:41 +02:00
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
2020-10-04 14:31:06 +02:00
|
|
|
void FileSystemMessage::setReadReply(CommandMessage* message,
|
2020-09-19 19:41:41 +02:00
|
|
|
store_address_t storageID) {
|
|
|
|
message->setCommand(READ_REPLY);
|
2020-08-28 18:33:29 +02:00
|
|
|
message->setParameter2(storageID.raw);
|
|
|
|
}
|
|
|
|
|
2020-10-04 23:24:36 +02:00
|
|
|
void FileSystemMessage::setCreateFileCommand(CommandMessage *message,
|
|
|
|
store_address_t storeId) {
|
|
|
|
message->setCommand(CREATE_FILE);
|
|
|
|
message->setParameter2(storeId.raw);
|
|
|
|
}
|
|
|
|
|
2020-09-19 19:41:41 +02:00
|
|
|
store_address_t FileSystemMessage::getStoreId(const CommandMessage* message) {
|
2020-08-28 18:33:29 +02:00
|
|
|
store_address_t temp;
|
|
|
|
temp.raw = message->getParameter2();
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
2020-09-19 21:36:12 +02:00
|
|
|
void FileSystemMessage::setSuccessReply(CommandMessage *message) {
|
|
|
|
message->setCommand(COMPLETION_SUCCESS);
|
2020-08-28 18:33:29 +02:00
|
|
|
}
|
|
|
|
|
2020-09-19 21:36:12 +02:00
|
|
|
void FileSystemMessage::setFailureReply(CommandMessage *message,
|
|
|
|
ReturnValue_t errorCode) {
|
|
|
|
message->setCommand(COMPLETION_SUCCESS);
|
|
|
|
message->setParameter(errorCode);
|
|
|
|
}
|
2020-09-20 13:38:53 +02:00
|
|
|
|
|
|
|
ReturnValue_t FileSystemMessage::getFailureReply(
|
|
|
|
const CommandMessage *message) {
|
|
|
|
return message->getParameter();
|
|
|
|
}
|
2020-10-04 23:24:36 +02:00
|
|
|
|