src/ParallelFilesystemCommand.h
branchv_0
changeset 57 c40a241d6e0c
parent 56 81a53e7cf0ab
child 58 4679f67a8324
equal deleted inserted replaced
56:81a53e7cf0ab 57:c40a241d6e0c
    16  */
    16  */
    17 #pragma once
    17 #pragma once
    18 
    18 
    19 #include <mqueue.h>
    19 #include <mqueue.h>
    20 #include <limits.h>
    20 #include <limits.h>
       
    21 #include <ext/stdio_filebuf.h>
    21 
    22 
    22 #include "FilesystemCommand.h"
    23 #include "FilesystemCommand.h"
    23 
    24 
    24 namespace relpipe {
    25 namespace relpipe {
    25 namespace in {
    26 namespace in {
   123 };
   124 };
   124 
   125 
   125 class ParallelFilesystemCommand : public FilesystemCommand {
   126 class ParallelFilesystemCommand : public FilesystemCommand {
   126 public:
   127 public:
   127 
   128 
   128 	void process(std::istream& input, std::ostream& output, Configuration& configuration) {
   129 	void process(int inputFD, int outputFD, Configuration& configuration) {
   129 		// TODO: ParallelFilesystemCommand
   130 		// TODO: ParallelFilesystemCommand
   130 
   131 
   131 		{ // TODO: demo code – remove:
   132 		{ // TODO: demo code – remove:
   132 			std::string queueName = "/relpipe-in-filesystem_parallel_" + std::to_string(getpid());
   133 			std::string queueName = "/relpipe-in-filesystem_parallel_" + std::to_string(getpid());
   133 
   134 
   144 			writeBuffer.setStringData("ahoj");
   145 			writeBuffer.setStringData("ahoj");
   145 
   146 
   146 			mqWriter.send(&writeBuffer);
   147 			mqWriter.send(&writeBuffer);
   147 
   148 
   148 			mqReader.receive(&readBuffer);
   149 			mqReader.receive(&readBuffer);
   149 			
   150 
   150 			std::string readData(readBuffer.data, readBuffer.dataLength);
   151 			std::string readData(readBuffer.data, readBuffer.dataLength);
   151 			std::wstring_convert < codecvt_utf8<wchar_t>> convertor;
   152 			std::wstring_convert < codecvt_utf8<wchar_t>> convertor;
   152 
   153 
   153 			std::wcerr << L"Zpráva „" << convertor.from_bytes(readData).c_str() << L"“ typu " << (int) readBuffer.type << L" o celkové délce " << readBuffer.getMessageLength() << L" a délce dat " << readBuffer.dataLength << L" byla přijata." << std::endl;
   154 			std::wcerr << L"Zpráva „" << convertor.from_bytes(readData).c_str() << L"“ typu " << (int) readBuffer.type << L" o celkové délce " << readBuffer.getMessageLength() << L" a délce dat " << readBuffer.dataLength << L" byla přijata." << std::endl;
   154 		}
   155 		}