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::Format Class Referenceabstract

A format. More...

#include <format.hpp>

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

Public Member Functions

 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 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 Attributes

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 format.

Constructor & Destructor Documentation

◆ Format() [1/2]

logicalaccess::Format::Format ( )

Constructor.

Create a Format.

◆ Format() [2/2]

logicalaccess::Format::Format ( const Format other)
delete

Remove copy.

◆ ~Format()

virtual logicalaccess::Format::~Format ( )
virtualdefault

Member Function Documentation

◆ calculateParity()

unsigned char logicalaccess::Format::calculateParity ( const BitsetStream data,
ParityType  parityType,
std::vector< unsigned int >  positions 
)
static

Calculate parity for a block of data.

Parameters
dataData block
dataLengthBytesLength of data in bytes
parityTypeParity type
positionsList of positions to calculate parity
nbPositionsNumber of parity in the list
Returns
The parity.

◆ checkSkeleton()

virtual bool logicalaccess::Format::checkSkeleton ( std::shared_ptr< Format format) const
pure virtual

◆ getByFormatType()

std::shared_ptr< Format > logicalaccess::Format::getByFormatType ( FormatType  type)
static

Get a new format instance from a format type.

Parameters
typeThe format type.
Returns
The new format instance.

◆ getDataLength()

virtual unsigned int logicalaccess::Format::getDataLength ( ) const
pure virtual

◆ getFieldFromName()

std::shared_ptr< DataField > logicalaccess::Format::getFieldFromName ( std::string  field) const

Get the field object from name.

◆ getFieldLength()

unsigned int logicalaccess::Format::getFieldLength ( const std::string &  field) const
virtual

Get the field length.

Parameters
fieldThe field.
Returns
The field length.

Reimplemented in logicalaccess::RawFormat.

◆ getFieldList()

std::vector< std::shared_ptr< DataField > > logicalaccess::Format::getFieldList ( )
virtual

Get the format field list.

Returns
The field list.

◆ getIdentifier()

ByteVector logicalaccess::Format::getIdentifier ( )
virtual

Get the identifier.

Returns
The identifier.

◆ getLinearData()

virtual ByteVector logicalaccess::Format::getLinearData ( ) const
pure virtual

◆ getName()

virtual std::string logicalaccess::Format::getName ( ) const
pure virtual

◆ getSkeletonLinearData()

virtual size_t logicalaccess::Format::getSkeletonLinearData ( ByteVector data) const
pure virtual

Get skeleton linear data.

Parameters
dataWhere to put data
dataLengthBytesLength in byte of data

Implemented in logicalaccess::CustomFormat, and logicalaccess::StaticFormat.

◆ getType()

virtual FormatType logicalaccess::Format::getType ( ) const
pure virtual

◆ getValuesFieldList()

std::vector< std::string > logicalaccess::Format::getValuesFieldList ( ) const
virtual

Get values field list.

Returns
The values field list.

◆ isRepeatable()

bool logicalaccess::Format::isRepeatable ( ) const

◆ operator=()

Format & logicalaccess::Format::operator= ( const Format )
delete

◆ setFieldList()

void logicalaccess::Format::setFieldList ( std::vector< std::shared_ptr< DataField > >  fields)
virtual

Get the format field list.

Parameters
fieldsThe field list.

◆ setLinearData()

virtual void logicalaccess::Format::setLinearData ( const ByteVector data)
pure virtual

◆ setRepeatable()

void logicalaccess::Format::setRepeatable ( bool  v)

◆ setSkeletonLinearData()

virtual void logicalaccess::Format::setSkeletonLinearData ( const ByteVector data)
pure virtual

Set skeleton linear data.

Parameters
dataWhere to get data
dataLengthBytesLength in byte of data

Implemented in logicalaccess::CustomFormat, and logicalaccess::StaticFormat.

Member Data Documentation

◆ d_fieldList

std::list<std::shared_ptr<DataField> > logicalaccess::Format::d_fieldList
protected

The field list.

◆ is_repeatable_

bool logicalaccess::Format::is_repeatable_
protected

If true, we expect the format to be concatenated multiple time in a single Location.


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