Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

clawsoft::Byte Class Reference

#include <Byte.h>

Inheritance diagram for clawsoft::Byte:

Inheritance graph
[legend]
Collaboration diagram for clawsoft::Byte:

Collaboration graph
[legend]

Detailed Description

This class represents a Byte, bit by bit and provides a means for accesing each bit individually.

According to the system the ordering of every bit may vary. Depending on what you think the ordering should be for every bit we will use the following standard in this library
bit 7bit 6bit 5bit 4bit 3bit 2bit 1bit 0

Please note that every bit is ordered from right to left, it is going to remain this way no matter the architecture or system you're working on.

TODO: TAKE CARE OF THE PLATFORM ENDIANNESS

STATUS: READY TO TEST


Public Methods

 Byte ()
 Default constructor, it will initialize value to zero.

 Byte (Uint8 v)
 This constructor will initialize the Byte value to v.

 Byte (const char *binary)
 This constructor will parse an array of 0s and 1s and will construct a byte, if you use characters different from '0' or '1' or if you use a string larger than 8 chars then you will receive the appropiate exception.

 Byte (const String &binary)
 Almost the sam as the above constructor but the the argument is now a String.

void setValue (Uint8 v=0)
 This will set the interval value to v.

void setValue (const char *binary)
 This will set the interval value to binary.

void setValue (const String &binary)
 This will set the interval value to binary.

Uint8 theByte ()
 This will return the binary bit as whole.

Uint8 reversedByte ()
 This will return a reversed binary version of the value.

void reverse ()
 This will invert the byte ordering of every bit.

bool bit0 ()
 Returns the bit in position 0.

bool bit1 ()
 Returns the bit in position 1.

bool bit2 ()
 Returns the bit in position 2.

bool bit3 ()
 Returns the bit in position 3.

bool bit4 ()
 Returns the bit in position 4.

bool bit5 ()
 Returns the bit in position 5.

bool bit6 ()
 Returns the bit in position 6.

bool bit7 ()
 Returns the bit in position 7.

const StringtoString ()
 Returns a string representation of this Byte using 0s and 1s.

const char * getClassName ()
 Returns the name of the current class.


Static Public Methods

int installedCPUs ()
 This will return how many CPUs are installed in the system.

double cpuSpeed ()
 This will return the CPU speed in megahertz.

int totalMemory ()
 Will return the total amount of system memory.

int freeMemory ()
 Will return the total amount of free system memory.

void usleep (Uint32 usec)
 Will freeze the software for usec microseconds.


Protected Methods

void setClassName (const char *n)
 Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.


Protected Attributes

Uint8 value
 As the name says this is the binary value.


Constructor & Destructor Documentation

clawsoft::Byte::Byte  
 

Default constructor, it will initialize value to zero.

clawsoft::Byte::Byte Uint8    v
 

This constructor will initialize the Byte value to v.

clawsoft::Byte::Byte const char *    binary
 

This constructor will parse an array of 0s and 1s and will construct a byte, if you use characters different from '0' or '1' or if you use a string larger than 8 chars then you will receive the appropiate exception.

clawsoft::Byte::Byte const String   binary
 

Almost the sam as the above constructor but the the argument is now a String.

The same restrictions apply


Member Function Documentation

bool clawsoft::Byte::bit0  
 

Returns the bit in position 0.

bool clawsoft::Byte::bit1  
 

Returns the bit in position 1.

bool clawsoft::Byte::bit2  
 

Returns the bit in position 2.

bool clawsoft::Byte::bit3  
 

Returns the bit in position 3.

bool clawsoft::Byte::bit4  
 

Returns the bit in position 4.

bool clawsoft::Byte::bit5  
 

Returns the bit in position 5.

bool clawsoft::Byte::bit6  
 

Returns the bit in position 6.

bool clawsoft::Byte::bit7  
 

Returns the bit in position 7.

double clawsoft::System::cpuSpeed   [static, inherited]
 

This will return the CPU speed in megahertz.

int clawsoft::System::freeMemory   [static, inherited]
 

Will return the total amount of free system memory.

const char * clawsoft::Object::getClassName   [inherited]
 

Returns the name of the current class.

int clawsoft::System::installedCPUs   [static, inherited]
 

This will return how many CPUs are installed in the system.

void clawsoft::Byte::reverse  
 

This will invert the byte ordering of every bit.

Uint8 clawsoft::Byte::reversedByte  
 

This will return a reversed binary version of the value.

void clawsoft::Object::setClassName const char *    n [protected, inherited]
 

Call this method when you need to set the name of the class you're creating, typically in it's constructor, remember that you must set the classname for every class you create, that way you can have more information while debugging.

void clawsoft::Byte::setValue const String   binary
 

This will set the interval value to binary.

void clawsoft::Byte::setValue const char *    binary
 

This will set the interval value to binary.

void clawsoft::Byte::setValue Uint8    v = 0
 

This will set the interval value to v.

Uint8 clawsoft::Byte::theByte  
 

This will return the binary bit as whole.

const String & clawsoft::Byte::toString  
 

Returns a string representation of this Byte using 0s and 1s.

int clawsoft::System::totalMemory   [static, inherited]
 

Will return the total amount of system memory.

void clawsoft::System::usleep Uint32    usec [static, inherited]
 

Will freeze the software for usec microseconds.


Field Documentation

Uint8 clawsoft::Byte::value [protected]
 

As the name says this is the binary value.


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

Authors:

Juan V. Guerrero
Jannette C. Mejia
Juan C. Guevara

Powered by:

SourceForgeLogo