cpphlib.PPBITMANIPULATOR Class Reference

- Main Page
- Namespaces
- Classes

- Class List
- Class Members

Public Member Functions
cpphlib.PPBITMANIPULATOR Class Reference

Bit and byte manipulator. More...

List of all members.

## Public Member Functions
def | __init__
def | int2binstr
| Documentation for method.
def | binstr2int
| Documentation for method.
def | binstr2hexstr
| Documentation for method.
def | hexstr2binstr
| Documentation for method.
def | inversebinstr
| Documentation for method.
def | inverse1
| Documentation for method.
def | inverse
| Documentation for method.
def | getbitstate
| Documentation for method.
def | setbitstate
| Documentation for method.
def | mask
| Documentation for method.

## Detailed Description

Bit and byte manipulator.

This class contains all methods needed for manipulating bits and bytes, and converting to different formats.

## Constructor & Destructor Documentation

def cpphlib.PPBITMANIPULATOR.__init__ | ( |  | self | ) |

    Short description: Constructs PPBITMANIPULATOR class

## Member Function Documentation

def cpphlib.PPBITMANIPULATOR.binstr2hexstr | ( |  | self,
|  |  | binstr
| ) |  |

Documentation for method.

It converts defined binary string to hexadecimal string

Parameters:

  binstr | The binary string to be converted Return value is a byte sized two characters long string.
      Short description: It converts defined binary string to hexadecimal string

def cpphlib.PPBITMANIPULATOR.binstr2int | ( |  | self,
|  |  | binstr
| ) |  |

Documentation for method.

It converts defined binary string to integer number.

Parameters:

  binstr | The binary string to be converted
      Short description: It converts defined binary string to integer

def cpphlib.PPBITMANIPULATOR.getbitstate | ( |  | self,
|  |  | input,
|  |  | position,
|  |  | output = `""`
| ) |  |

Documentation for method.

It returns a decimal, hexadecimal, or hexastring formed, byte-sized number's bit's value, based on the bitposition, in the required format. If the output format is not defined, result is string.

Parameters:

  input | The defined, byte-sized number
  position | The position of the bit, which can be 0..7
  output | The output fomat. It can be "int", or "str"
      Short description: It returns a number's bit's value, based on the bit position

def cpphlib.PPBITMANIPULATOR.hexstr2binstr | ( |  | self,
|  |  | str
| ) |  |

Documentation for method.

It converts hexadecimal string to binary string

Parameters:

  binstr | The hexadecimal string to be converted Return value is an eight characters long string.
      Short description: It converts hexadecimal string to binary string

def cpphlib.PPBITMANIPULATOR.int2binstr | ( |  | self,
|  |  | n,
|  |  | length
| ) |  |

Documentation for method.

Converts defined number to binary string with defined length

Parameters:

  n | The number to be converted, entered in decimal or hexadecimal form
  lenght | Length of the binary string
      Short description: Converts defined number to binary string

def cpphlib.PPBITMANIPULATOR.inverse | ( |  | self,
|  |  | invertable,
|  |  | output = `""`
| ) |  |

Documentation for method.

It inverts the defined byte-sized number, and gives the result in a required output format. If the output format is not defined, then the result is string.

Parameters:

  invertable | The defined number. The number can be defined in three forms, like 255, 0xFF, or "FF"
  output | The output format. Its value can be "int", or "str".
      Short description: It inverts the defined byte-sized number

def cpphlib.PPBITMANIPULATOR.inverse1 | ( |  | self,
|  |  | invertable
| ) |  |

Documentation for method.

Inmediate method.

def cpphlib.PPBITMANIPULATOR.inversebinstr | ( |  | self,
|  |  | binstr
| ) |  |

Documentation for method.

It inverts the elements of the binary string bit by bit.

Parameters:

  binstr | The binary string to be invertred
      Short description: It inverts the elements of the binary string

def cpphlib.PPBITMANIPULATOR.mask | ( |  | self,
|  |  | input,
|  |  | mask,
|  |  | output = `""`
| ) |  |

Documentation for method.

Masking a decimal, hexadecimal, or hexastring formed byte-sized number with a decimal, hexadecimal, or hexastring formed byte-sized mask, and provides the result in the required output format. If output format is not defined, result is string.

Parameters:

  input | The defined byte-sized number
  mask | The defined byte-sized mask
  output | The output format. It can be "int", or "str"
      Short description: Masking a number with a mask

def cpphlib.PPBITMANIPULATOR.setbitstate | ( |  | self,
|  |  | input,
|  |  | bitstate,
|  |  | position,
|  |  | output = `""`
| ) |  |

Documentation for method.

It sets the value of a hexadecimal, or hexastring fomatted, byte-sized number's bit's value based on bit position. It returns the modified byte in a required format. If the format is not defined, result is string.

Parameters:

  input | The defined byte-sized number
  bitstate | The state of the bit, to set to, binary (fx. 0 or 1), and allowed in string format as well (fx. "0" or "1")
  position | The bit position, which can be 0..7
  output | The output format. Its value can be "int", like integer, or "str", like hexa string, or "pic" like bitmap string.
      Short description: It sets the number's bit's value based on bit position

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

- cpphlib.py