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

A static format. More...

#include <staticformat.hpp>

Inheritance diagram for logicalaccess::StaticFormat:
logicalaccess::Format logicalaccess::XmlSerializable logicalaccess::ASCIIFormat logicalaccess::BariumFerritePCSCFormat logicalaccess::DataClockFormat logicalaccess::FASCN200BitFormat logicalaccess::Getronik40BitFormat logicalaccess::HIDHoneywell40BitFormat logicalaccess::RawFormat logicalaccess::Wiegand35Format logicalaccess::Wiegand37WithFacilityRightParity2Format logicalaccess::WiegandFormat

Public Member Functions

 StaticFormat ()
 Constructor.
 
virtual ~StaticFormat ()=default
 
std::shared_ptr< DataRepresentationgetDataRepresentation () const
 Get the Data Representation for the format.
 
void setDataRepresentation (std::shared_ptr< DataRepresentation > &encoding)
 Set the Data Representation for the format.
 
std::shared_ptr< DataTypegetDataType () const
 Get the Data Type for the format.
 
void setDataType (std::shared_ptr< DataType > &encoding)
 Set the Data Type for the format.
 
unsigned long long getUid () const
 Get the UID number.
 
void setUid (unsigned long long uid)
 Set the UID number.
 
virtual bool needUserConfigurationToBeUse () const
 The format need user configuration to be use.
 
virtual void convertField (BitsetStream &data, unsigned long long field, unsigned int fieldlen) const
 Convert a field into the configured DataRepresentation and DataType.
 
unsigned long long revertField (BitsetStream &data, unsigned int *pos, unsigned int fieldlen) const
 Revert a field using the configured DataRepresentation and DataType.
 
size_t getSkeletonLinearData (ByteVector &data) const override
 Get skeleton linear data.
 
void setSkeletonLinearData (const ByteVector &data) override
 Set skeleton linear data.
 
- Public Member Functions inherited from logicalaccess::Format
 Format ()
 Constructor.
 
 Format (const Format &other)=delete
 Remove copy.
 
Formatoperator= (const Format &)=delete
 
virtual ~Format ()=default
 
virtual unsigned int getDataLength () const =0
 Get data length in bits.
 
virtual std::string getName () const =0
 Get the format name.
 
virtual ByteVector getLinearData () const =0
 Get linear data.
 
virtual void setLinearData (const ByteVector &data)=0
 Set linear data.
 
virtual size_t getSkeletonLinearData (ByteVector &data) const =0
 Get skeleton linear data.
 
virtual void setSkeletonLinearData (const ByteVector &data)=0
 Set skeleton linear data.
 
virtual FormatType getType () const =0
 Get the format type.
 
virtual std::vector< std::string > getValuesFieldList () const
 Get values field list.
 
virtual unsigned int getFieldLength (const std::string &field) const
 Get the field length.
 
virtual bool checkSkeleton (std::shared_ptr< Format > format) const =0
 Check the current format skeleton with another format.
 
virtual ByteVector getIdentifier ()
 Get the identifier.
 
virtual std::vector< std::shared_ptr< DataField > > getFieldList ()
 Get the format field list.
 
virtual void setFieldList (std::vector< std::shared_ptr< DataField > > fields)
 Get the format field list.
 
std::shared_ptr< DataFieldgetFieldFromName (std::string field) const
 Get the field object from name.
 
bool isRepeatable () const
 
void setRepeatable (bool v)
 
- Public Member Functions inherited from logicalaccess::XmlSerializable
virtual ~XmlSerializable ()=default
 
virtual std::string serialize ()
 Serialize object to Xml Node string.
 
virtual std::string serializeWithHeaders ()
 Serialize object to Xml Node string, with xml headers.
 
virtual void serialize (boost::property_tree::ptree &parentNode)=0
 Serialize object to Xml Node.
 
virtual void serializeToFile (const std::string &filename)
 Serialize object to a Xml file.
 
virtual void unSerialize (boost::property_tree::ptree &node)=0
 UnSerialize object from a Xml Node.
 
virtual void unSerialize (const std::string &xmlstring, const std::string &rootNode)
 UnSerialize object from a Xml Node string.
 
virtual void unSerialize (std::istream &is, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerialize (boost::property_tree::ptree &node, const std::string &rootNode)
 UnSerialize object from a Xml node.
 
virtual void unSerializeFromFile (const std::string &filename)
 UnSerialize object from a Xml file.
 
virtual std::string getDefaultXmlNodeName () const =0
 Get the default Xml Node name for this object.
 

Static Public Member Functions

static unsigned char calculateParity (const BitsetStream &data, ParityType parityType, size_t start, size_t parityLengthBits)
 Calculate parity for a block of data.
 
- Static Public Member Functions inherited from logicalaccess::Format
static std::shared_ptr< FormatgetByFormatType (FormatType type)
 Get a new format instance from a format type.
 
static unsigned char calculateParity (const BitsetStream &data, ParityType parityType, std::vector< unsigned int > positions)
 Calculate parity for a block of data.
 
- Static Public Member Functions inherited from logicalaccess::XmlSerializable
static std::string removeXmlDeclaration (const std::string &xmlstring)
 Remove Xml declaration from a xml string.
 
static ByteVector formatHexString (std::string hexstr)
 Format hex string to hex string with space.
 

Protected Member Functions

virtual size_t getFormatLinearData (ByteVector &data) const =0
 Get the format linear data in bytes.
 
virtual size_t getEncodingLinearData (ByteVector &data) const
 Get the encoding linear data in bytes (Data Representation and Data Type).
 
virtual void setFormatLinearData (const ByteVector &data, size_t *indexByte)=0
 Set the format linear data in bytes.
 
virtual void setEncodingLinearData (const ByteVector &data, size_t *indexByte)
 Set the encoding linear data in bytes (Data Representation and Data Type).
 

Protected Attributes

std::shared_ptr< DataRepresentationd_dataRepresentation
 The Data Representation.
 
std::shared_ptr< DataTyped_dataType
 The Data Type.
 
unsigned long long d_uid
 The UID number.
 
- Protected Attributes inherited from logicalaccess::Format
std::list< std::shared_ptr< DataField > > d_fieldList
 The field list.
 
bool is_repeatable_
 

Additional Inherited Members

- Static Protected Member Functions inherited from logicalaccess::XmlSerializable
static unsigned long long atoull (const std::string &str)
 

Detailed Description

A static format.

Constructor & Destructor Documentation

◆ StaticFormat()

logicalaccess::StaticFormat::StaticFormat ( )

Constructor.

Create a Format.

◆ ~StaticFormat()

virtual logicalaccess::StaticFormat::~StaticFormat ( )
virtualdefault

Member Function Documentation

◆ calculateParity()

unsigned char logicalaccess::StaticFormat::calculateParity ( const BitsetStream data,
ParityType  parityType,
size_t  start,
size_t  parityLengthBits 
)
static

Calculate parity for a block of data.

Parameters
dataData block
dataLengthBytesLength of data in bytes
parityTypeParity type
startBit to start
parityLengthBitsLength of parity in bits
Returns
The parity.

◆ convertField()

void logicalaccess::StaticFormat::convertField ( BitsetStream data,
unsigned long long  field,
unsigned int  fieldlen 
) const
virtual

Convert a field into the configured DataRepresentation and DataType.

Parameters
dataThe buffer data that will contains the result.
dataLengthBytesThe buffer data length.
posThe current bit position into the buffer. Will contains the new position.
fieldThe field value.
fieldlenThe field length (in bits).

◆ getDataRepresentation()

std::shared_ptr< DataRepresentation > logicalaccess::StaticFormat::getDataRepresentation ( ) const

Get the Data Representation for the format.

Returns
The Data Representation.

◆ getDataType()

std::shared_ptr< DataType > logicalaccess::StaticFormat::getDataType ( ) const

Get the Data Type for the format.

Returns
The Data Type.

◆ getEncodingLinearData()

size_t logicalaccess::StaticFormat::getEncodingLinearData ( ByteVector data) const
protectedvirtual

Get the encoding linear data in bytes (Data Representation and Data Type).

Parameters
dataThe data buffer
dataLengthBytesThe data buffer length
Returns
The encoding linear data length.

◆ getFormatLinearData()

virtual size_t logicalaccess::StaticFormat::getFormatLinearData ( ByteVector data) const
protectedpure virtual

◆ getSkeletonLinearData()

size_t logicalaccess::StaticFormat::getSkeletonLinearData ( ByteVector data) const
overridevirtual

Get skeleton linear data.

Parameters
dataWhere to put data
dataLengthBytesLength in byte of data

Implements logicalaccess::Format.

◆ getUid()

unsigned long long logicalaccess::StaticFormat::getUid ( ) const

Get the UID number.

Returns
The UID.

◆ needUserConfigurationToBeUse()

bool logicalaccess::StaticFormat::needUserConfigurationToBeUse ( ) const
virtual

The format need user configuration to be use.

Returns
True if it need, false otherwise.

Reimplemented in logicalaccess::ASCIIFormat, logicalaccess::RawFormat, and logicalaccess::Wiegand35Format.

◆ revertField()

unsigned long long logicalaccess::StaticFormat::revertField ( BitsetStream data,
unsigned int *  pos,
unsigned int  fieldlen 
) const

Revert a field using the configured DataRepresentation and DataType.

Parameters
dataThe buffer data that contains the encoded field value.
dataLengthBytesThe buffer data length.
posThe current bit position into the buffer. Will contains the new position.
fieldlenThe field length (in bits).
Returns
The field value.

◆ setDataRepresentation()

void logicalaccess::StaticFormat::setDataRepresentation ( std::shared_ptr< DataRepresentation > &  encoding)

Set the Data Representation for the format.

Parameters
encodingThe Data Representation.

◆ setDataType()

void logicalaccess::StaticFormat::setDataType ( std::shared_ptr< DataType > &  encoding)

Set the Data Type for the format.

Parameters
encodingThe Data Type.

◆ setEncodingLinearData()

void logicalaccess::StaticFormat::setEncodingLinearData ( const ByteVector data,
size_t *  indexByte 
)
protectedvirtual

Set the encoding linear data in bytes (Data Representation and Data Type).

Parameters
dataThe data buffer
indexByteThe data offset

◆ setFormatLinearData()

virtual void logicalaccess::StaticFormat::setFormatLinearData ( const ByteVector data,
size_t *  indexByte 
)
protectedpure virtual

◆ setSkeletonLinearData()

void logicalaccess::StaticFormat::setSkeletonLinearData ( const ByteVector data)
overridevirtual

Set skeleton linear data.

Parameters
dataWhere to get data
dataLengthBytesLength in byte of data

Implements logicalaccess::Format.

◆ setUid()

void logicalaccess::StaticFormat::setUid ( unsigned long long  uid)

Set the UID number.

Parameters
uidThe UID.

Member Data Documentation

◆ d_dataRepresentation

std::shared_ptr<DataRepresentation> logicalaccess::StaticFormat::d_dataRepresentation
protected

The Data Representation.

◆ d_dataType

std::shared_ptr<DataType> logicalaccess::StaticFormat::d_dataType
protected

The Data Type.

◆ d_uid

unsigned long long logicalaccess::StaticFormat::d_uid
protected

The UID number.


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