LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
datatype.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_DATATYPE_HPP
8#define LOGICALACCESS_DATATYPE_HPP
9
13
14namespace logicalaccess
15{
19typedef enum { PT_NONE = 0x00, PT_EVEN = 0x01, PT_ODD = 0x02 } ParityType;
20
24class LLA_CORE_API DataType : public Encoding
25{
26 public:
30 DataType();
31
35 virtual ~DataType()
36 {
37 }
38
47 virtual BitsetStream convert(unsigned long long data,
48 unsigned int dataLengthBits) = 0;
49
57 virtual unsigned long long revert(BitsetStream &data,
58 unsigned int dataLengthBits) = 0;
59
65 static DataType *getByEncodingType(EncodingType type);
66
67 static long long pow(int base, unsigned int exp);
68
73 void setLeftParityType(ParityType type);
74
79 ParityType getLeftParityType() const;
80
85 void setRightParityType(ParityType type);
86
91 ParityType getRightParityType() const;
92
104 static BitsetStream addParity(ParityType leftParity, ParityType rightParity,
105 unsigned int blocklen, BitsetStream &buf);
106
118 static BitsetStream removeParity(ParityType leftParity, ParityType rightParity,
119 unsigned int blocklen, BitsetStream &buf);
120
125 void setBitDataRepresentationType(EncodingType bitDataRepresentationType);
126
131 EncodingType getBitDataRepresentationType() const;
132
139 static unsigned char invertBitSex(unsigned char c, size_t length = 8);
140
141 unsigned char getBitDataSize() const;
142
143 protected:
148
153
158};
159}
160
161#endif /* LOGICALACCESS_DATATYPE_HPP */
Definition: BitsetStream.hpp:15
A data type.
Definition: datatype.hpp:25
EncodingType d_bitDataRepresentationType
The bit data representation type.
Definition: datatype.hpp:157
ParityType d_rightParityType
The right parity type.
Definition: datatype.hpp:152
virtual BitsetStream convert(unsigned long long data, unsigned int dataLengthBits)=0
Convert "data" to the data type.
virtual unsigned long long revert(BitsetStream &data, unsigned int dataLengthBits)=0
Revert data type to data.
virtual ~DataType()
Constructor.
Definition: datatype.hpp:35
ParityType d_leftParityType
The left parity type.
Definition: datatype.hpp:147
An encoder type.
Definition: encoding.hpp:33
Encoding.
Definition: asn1.hpp:9
ParityType
Parity type.
Definition: datatype.hpp:19
@ PT_ODD
Definition: datatype.hpp:19
@ PT_NONE
Definition: datatype.hpp:19
@ PT_EVEN
Definition: datatype.hpp:19
EncodingType
Encoding type.
Definition: encoding.hpp:19
Reader provider.