forked from RGNC/plingua
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathformats.hpp
More file actions
97 lines (80 loc) · 2.38 KB
/
formats.hpp
File metadata and controls
97 lines (80 loc) · 2.38 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef _FORMATS_HPP_
#define _FORMATS_HPP_
#include <vector>
#include <string>
#include <serialization.hpp>
#include <parser/parser.hpp>
// INSTRUCTIONS TO ADD A NEW FORMAT
// A) IN FORMATS.HPP
// 1) ADD AN ENUM VALUE FOR YOUR NEW FORMAT
// 2) UPDATE MAX FORMATS
// 3) ADD AN UNIQUE ID FOR YOUR NEW FORMAT
// 4) ADD A SHORT DESCRIPTION FOR YOUR NEW FORMAT
// 5) ADD A HEADER FOR YOUR CODIFYING FUNCTION
// B) IN FORMATS.CPP
// 6) ADD A FUNCTION CALL TO YOUR CODIFYING FUNCTION
// note: ALL OF YOUR IMPLEMENTATION SHOULD BE IN YOUR FILES.
// KEEP CLEAN FORMATS.HPP AND FORMATS.CPP
// C) IN YOUR FILES
// 7) IMPLEMENT YOUR CODIFYING FUNCTION
// D) IN MAKEFILE
// 8) INCLUDE YOUR FILES
namespace plingua
{
// ADD AN ENUM VALUE FOR YOUR NEW FORMAT
enum Format
{
JSON,
XML,
PLI,
BINARY,
PORTABLE,
CPLUSPLUS
// HERE
};
const Format defaultFormat = JSON;
// UPDATE MAX FORMATS
const unsigned maxFormats = 6; // HERE
// ADD AN UNIQUE ID FOR YOUR NEW FORMAT
const std::vector<std::string> formatId =
{
"json",
"xml",
"pli",
"bin",
"bin2",
"c++"
// HERE
};
// ADD A SHORT DESCRIPTION FOR YOUR NEW FORMAT
const std::vector<std::string> formatDescription =
{
"JSON format",
"XML format",
"unrolled P-Lingua format",
"compact bit level representation",
"compact bit level representation which tracks the endianness of the data",
"optimized ad-hoc C++ simulator"
// HERE
};
// ADD A HEADER FOR YOUR CODIFYING FUNCTION
bool codifyJson(const File& file, const std::string& path);
bool codifyXml(const File& file, const std::string& path);
bool codifyPli(const File& file, const std::string& path);
bool codifyBinary(const File& file, const std::string& path);
bool codifyPortable(const File& file, const std::string& path);
bool codifyCplusplus(const File& file, const std::string& path);
// HERE
////////////////////////////////////////
// DO NOT MODIFY THE REST OF THIS FILE
////////////////////////////////////////
bool codify(Format format, const File& file, const std::string& path);
/////////////////////////////////////////////////////////
// Utility functions, you can use them for printing messages
void printFatalMessage(const std::string& message) ;
void printErrorMessage(const std::string& message) ;
void printWarningMessage(const std::string& message) ;
void printInfoMessage(const std::string& message) ;
void printDebugMessage(const std::string& message) ;
}
#endif