Repository navigation
Expand file tree
/
Copy pathField_id.cpp
More file actions
65 lines (54 loc) · 1.73 KB
/
Copy pathField_id.cpp
File metadata and controls
65 lines (54 loc) · 1.73 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
/*!
* @file Field_id.cpp
* @brief Implementations of the functions defined in \a Field_id.h
* @author lhm
* @date 29/08/2019
*/
#include <bitset>
#include <cmath>
#include <limits.h>
#include "Logger.h"
#include "Header.h"
#include "Exception.h"
#include "Conf_format.h"
#include "time_util.h"
#include "Field_id.h"
namespace ModGen {
using namespace std;
////////////////////////////////////////////////////////////////////////
Field_id::Field_id(): Field()
{}
////////////////////////////////////////////////////////////////////////
Field_id::~Field_id()
{}
////////////////////////////////////////////////////////////////////////
Field_id::Field_id(const Field_id& p_other): Field(p_other)
{}
////////////////////////////////////////////////////////////////////////
bool Field_id::isValid() const
{
return ( !name.empty() &&
pos != -1 &&
size != -1 &&
endianness != _UNDEFINED
);
}
////////////////////////////////////////////////////////////////////////
string Field_id::getDesc() const
{
return (
"Field_id " + name +
"\n\t-pos = " + to_string(pos) +
"\n\t-size = " + to_string(size) +
"\n\t-endianness = " + endianString[endianness] +
"\n\t-swap = " + (swap ? "true":"false") +
"\n\t-invert = " + (invert ? "true":"false") + "\n"
);
}
////////////////////////////////////////////////////////////////////////
void Field_id::addToMessage(vector<uint8_t>& p_mesg)
{
// TODO: Voir avec Anthony la méthode de calcul de l'ID numérique
Field::addToMessage(p_mesg);
}
} // namespace ModGen