LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
logicalaccess::DataType Class Referenceabstract

A data type. More...

#include <datatype.hpp>

Inheritance diagram for logicalaccess::DataType:
logicalaccess::Encoding logicalaccess::BCDByteDataType logicalaccess::BCDNibbleDataType logicalaccess::BinaryDataType

Public Member Functions

 DataType ()
 Constructor.
 
virtual ~DataType ()
 Constructor.
 
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.
 
void setLeftParityType (ParityType type)
 Set the left parity type of the wiegand format.
 
ParityType getLeftParityType () const
 Get the left parity type.
 
void setRightParityType (ParityType type)
 Set the right parity type of the wiegand format.
 
ParityType getRightParityType () const
 Get the right parity type.
 
void setBitDataRepresentationType (EncodingType bitDataRepresentationType)
 Get the bit data representation type.
 
EncodingType getBitDataRepresentationType () const
 Get the bit data representation type.
 
unsigned char getBitDataSize () const
 
- Public Member Functions inherited from logicalaccess::Encoding
virtual ~Encoding ()=default
 
virtual std::string getName () const =0
 Get the encoder name.
 
virtual EncodingType getType () const =0
 Get the encoder type.
 

Static Public Member Functions

static DataTypegetByEncodingType (EncodingType type)
 Create a new Data Type instance by the encoding type.
 
static long long pow (int base, unsigned int exp)
 
static BitsetStream addParity (ParityType leftParity, ParityType rightParity, unsigned int blocklen, BitsetStream &buf)
 Add parity to a buffer.
 
static BitsetStream removeParity (ParityType leftParity, ParityType rightParity, unsigned int blocklen, BitsetStream &buf)
 Remove parity to a buffer.
 
static unsigned char invertBitSex (unsigned char c, size_t length=8)
 Convert a character to the oser bit-sex (Least Significant Bit / Most Significant Bit).
 

Protected Attributes

ParityType d_leftParityType
 The left parity type.
 
ParityType d_rightParityType
 The right parity type.
 
EncodingType d_bitDataRepresentationType
 The bit data representation type.
 

Detailed Description

A data type.

Constructor & Destructor Documentation

◆ DataType()

logicalaccess::DataType::DataType ( )

Constructor.

◆ ~DataType()

virtual logicalaccess::DataType::~DataType ( )
inlinevirtual

Constructor.

Member Function Documentation

◆ addParity()

BitsetStream logicalaccess::DataType::addParity ( ParityType  leftParity,
ParityType  rightParity,
unsigned int  blocklen,
BitsetStream buf 
)
static

Add parity to a buffer.

Parameters
leftParityThe left parity type.
rightParityThe right parity type.
blocklenThe length of a block for calculate parity (in bits).
bufThe current buffer.
buflenThe current buffer length (in bits).
procbufThe allocated buffer with parity.
procbuflenThe allocated buffer length (in bits).
Returns
The buffer with parity length (in bits).

◆ convert()

virtual BitsetStream logicalaccess::DataType::convert ( unsigned long long  data,
unsigned int  dataLengthBits 
)
pure virtual

Convert "data" to the data type.

Parameters
dataData to convert
dataLengthBitsLength of data to convert in bits
dataConvertedData after conversion
dataConvertedLengthBytesLength of "dataConverted" in bytes
Returns
Length of data written in bits

Implemented in logicalaccess::BCDByteDataType, logicalaccess::BCDNibbleDataType, and logicalaccess::BinaryDataType.

◆ getBitDataRepresentationType()

EncodingType logicalaccess::DataType::getBitDataRepresentationType ( ) const

Get the bit data representation type.

Returns
The bit data representation type.

◆ getBitDataSize()

unsigned char logicalaccess::DataType::getBitDataSize ( ) const

◆ getByEncodingType()

DataType * logicalaccess::DataType::getByEncodingType ( EncodingType  type)
static

Create a new Data Type instance by the encoding type.

Parameters
typeThe encoding type
Returns
The new Data Type instance, or null if the type is unknown.

◆ getLeftParityType()

ParityType logicalaccess::DataType::getLeftParityType ( ) const

Get the left parity type.

Returns
The left parity type.

◆ getRightParityType()

ParityType logicalaccess::DataType::getRightParityType ( ) const

Get the right parity type.

Returns
The right parity type.

◆ invertBitSex()

unsigned char logicalaccess::DataType::invertBitSex ( unsigned char  c,
size_t  length = 8 
)
static

Convert a character to the oser bit-sex (Least Significant Bit / Most Significant Bit).

Parameters
cThe character.
Returns
The character in other bit-sex.

◆ pow()

long long logicalaccess::DataType::pow ( int  base,
unsigned int  exp 
)
static

◆ removeParity()

BitsetStream logicalaccess::DataType::removeParity ( ParityType  leftParity,
ParityType  rightParity,
unsigned int  blocklen,
BitsetStream buf 
)
static

Remove parity to a buffer.

Parameters
leftParityThe left parity type.
rightParityThe right parity type.
blocklenThe length of a block for calculate parity (in bits).
bufThe current buffer with parity.
buflenThe current buffer length (in bits).
procbufThe allocated buffer without parity.
procbuflenThe allocated buffer length (in bits).
Returns
The buffer without parity length (in bits).

◆ revert()

virtual unsigned long long logicalaccess::DataType::revert ( BitsetStream data,
unsigned int  dataLengthBits 
)
pure virtual

Revert data type to data.

Parameters
dataData to revert
dataLengthBytesLength of "data" in bits
lengthBitsLength of data to revert in bits
Returns
Data after reversion

Implemented in logicalaccess::BCDByteDataType, logicalaccess::BCDNibbleDataType, and logicalaccess::BinaryDataType.

◆ setBitDataRepresentationType()

void logicalaccess::DataType::setBitDataRepresentationType ( EncodingType  bitDataRepresentationType)

Get the bit data representation type.

Parameters
bitDataRepresentationTypeThe bit data representation type.

◆ setLeftParityType()

void logicalaccess::DataType::setLeftParityType ( ParityType  type)

Set the left parity type of the wiegand format.

Parameters
typeNew parity type.

◆ setRightParityType()

void logicalaccess::DataType::setRightParityType ( ParityType  type)

Set the right parity type of the wiegand format.

Parameters
typeNew parity type.

Member Data Documentation

◆ d_bitDataRepresentationType

EncodingType logicalaccess::DataType::d_bitDataRepresentationType
protected

The bit data representation type.

◆ d_leftParityType

ParityType logicalaccess::DataType::d_leftParityType
protected

The left parity type.

◆ d_rightParityType

ParityType logicalaccess::DataType::d_rightParityType
protected

The right parity type.


The documentation for this class was generated from the following files: