-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathHarpoonBattle.h
50 lines (35 loc) · 1.29 KB
/
HarpoonBattle.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
* File: HarpoonBattle.h
* Author: Kjell Hedstrom
*
* Created on November 30, 2015
*/
#pragma once
#include "KrakenBattle.h"
#include "Kraken.h"
#include <Result.h>
#include <string>
#include <tuple>
/**
* The Harpoon Battle namespace provides necesassary functionality
* to parse out the data from incoming Kraken streams
* As the data comes in it will contain (if run through KrakenBattle)
* some KrakenBattle headers. Typically the data will be
* session_id <STATE> data
*
* What's interesting to receive back is all three of these but of course separated.
*/
namespace HarpoonBattle {
enum class ReceivedType {
Begin = static_cast<int>(KrakenBattle::SendType::Begin), // optional
Data = static_cast<int>(KrakenBattle::SendType::Data),
Done = static_cast<int>(KrakenBattle::SendType::Done),
Error = static_cast<int>(KrakenBattle::SendType::Error),
End = static_cast<int>(KrakenBattle::SendType::End)
};
std::string EnumToString(const ReceivedType& type);
ReceivedType StringToEnum(const std::string& type);
enum ReceivedPartsIndex {IndexOfSession, IndexOfReceivedType, IndexOfChunk};
using ReceivedParts = std::tuple<std::string, ReceivedType, Kraken::Chunks>;
ReceivedParts ExtractToParts(const Kraken::Chunks& chunks);
} // HarpoonBattle