xvr2::Byte Class Reference

#include <Byte.h>

Inheritance diagram for xvr2::Byte:

Inheritance graph
[legend]

List of all members.


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

Definition at line 37 of file Byte.h.


Public Member Functions

 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.
 ~Byte ()
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.
std::string toString ()
 Returns a string representation of this Byte using 0s and 1s.
virtual const char * getClassName ()
 Returns the name of the current class.

Static Public Member Functions

static void usleep (UInt32 usec)
 This will return how many CPUs are installed in the system.
static void debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)
 Will print a debug message to the screen.
static void debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__)

Protected Attributes

UInt8 value
 As the name says this is the binary value.
std::string * string_representation
std::string __cls_name

Friends

std::ostream & operator<< (std::ostream &stream, const Object &s)

Constructor & Destructor Documentation

xvr2::Byte::Byte (  ) 

Default constructor, it will initialize value to zero.

xvr2::Byte::Byte ( UInt8  v  ) 

This constructor will initialize the Byte value to v.

xvr2::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.

xvr2::Byte::Byte ( const String binary  ) 

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

The same restrictions apply

xvr2::Byte::~Byte (  ) 


Member Function Documentation

void xvr2::Byte::setValue ( UInt8  v = 0  ) 

This will set the interval value to v.

void xvr2::Byte::setValue ( const char *  binary  ) 

This will set the interval value to binary.

void xvr2::Byte::setValue ( const String binary  ) 

This will set the interval value to binary.

UInt8 xvr2::Byte::theByte (  ) 

This will return the binary bit as whole.

UInt8 xvr2::Byte::reversedByte (  ) 

This will return a reversed binary version of the value.

void xvr2::Byte::reverse (  ) 

This will invert the byte ordering of every bit.

bool xvr2::Byte::bit0 (  ) 

Returns the bit in position 0.

bool xvr2::Byte::bit1 (  ) 

Returns the bit in position 1.

bool xvr2::Byte::bit2 (  ) 

Returns the bit in position 2.

bool xvr2::Byte::bit3 (  ) 

Returns the bit in position 3.

bool xvr2::Byte::bit4 (  ) 

Returns the bit in position 4.

bool xvr2::Byte::bit5 (  ) 

Returns the bit in position 5.

bool xvr2::Byte::bit6 (  ) 

Returns the bit in position 6.

bool xvr2::Byte::bit7 (  ) 

Returns the bit in position 7.

std::string xvr2::Byte::toString (  )  [virtual]

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

Reimplemented from xvr2::Object.

static void xvr2::System::usleep ( UInt32  usec  )  [static, inherited]

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

This will return the CPU speed in megahertz Will return the total amount of system memory Will return the total amount of free system memory Will freeze the software for usec microseconds

virtual const char* xvr2::Object::getClassName (  )  [virtual, inherited]

Returns the name of the current class.

static void xvr2::Object::debugmsg ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]

Will print a debug message to the screen.

static void xvr2::Object::debugmsgln ( Object obj,
const char *  msg,
int  linenumber = __LINE__,
const char *  srcfile = __FILE__ 
) [static, inherited]


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  stream,
const Object s 
) [friend, inherited]


Member Data Documentation

UInt8 xvr2::Byte::value [protected]

As the name says this is the binary value.

Definition at line 41 of file Byte.h.

std::string* xvr2::Byte::string_representation [protected]

Definition at line 43 of file Byte.h.

std::string xvr2::Object::__cls_name [protected, inherited]

Definition at line 30 of file Object.h.


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

Generated on Fri Jun 20 22:55:50 2008 for X-VR2 SDK by  doxygen 1.5.5