ADC Home > Reference Library > Reference > Darwin > Kernel Framework Reference

 


OSNumber

Inherits from:
Declared In:

Overview

A container class for numeric values.



Functions

addValue

Adds an integer value to the internal numeric value of the OSNumber object.

free

Releases and deallocates resources created by the OSNumber instances.

init(const char *, unsigned int)

Initializes an instance of OSNumber.

init(unsigned long long, unsigned int)

Initializes an instance of OSNumber.

isEqualTo(const OSMetaClassBase *)

Tests the equality of an arbitrary OSObject-derived object and an OSNumber object.

isEqualTo(const OSNumber *)

Tests the equality of two OSNumber objects.

numberOfBits

Returns the number of bits used to represent the value.

numberOfBytes

Returns the number of bytes used to represent the value.

serialize

Archives the receiver.

setValue

Replaces the current internal numeric value of the OSNumber object by the value given.

unsigned16BitValue

Returns its internal value as a 16-bit value.

unsigned32BitValue

Returns its internal value as a 32-bit value.

unsigned64BitValue

Returns its internal value as a 64-bit value.

unsigned8BitValue

Returns its internal value as an 8-bit value.

withNumber(const char *, unsigned int)

Creates and initializes an instance of OSNumber with a given value represented as a simple C string.

withNumber(unsigned long long, unsigned int)

Creates and initializes an instance of OSNumber with a given value.


addValue


Adds an integer value to the internal numeric value of the OSNumber object.

public

virtual void addValue( signed long long value);
Parameters
value

The value to be added.


free


Releases and deallocates resources created by the OSNumber instances.

public

virtual void free();
Discussion

This function should not be called directly, use release() instead.


init(const char *, unsigned int)


Initializes an instance of OSNumber.

public

virtual bool init( const char *value, unsigned int numberOfBits);
Parameters
value

A C string representation of a numeric value.

numberOfBits

The number of bits required to represent the value.

Return Value

Returns true if the instance was successfully initialized, false otherwise.


init(unsigned long long, unsigned int)


Initializes an instance of OSNumber.

public

virtual bool init( unsigned long long value, unsigned int numberOfBits);
Parameters
value

An integer value.

numberOfBits

The number of bits required to represent the value.

Return Value

Returns true if the instance was successfully initialized, false otherwise.


isEqualTo(const OSMetaClassBase *)


Tests the equality of an arbitrary OSObject-derived object and an OSNumber object.

public

virtual bool isEqualTo( const OSMetaClassBase *obj) const;
Parameters
obj

The OSObject-derived object to be compared to the receiver.

Return Value

Returns true if the two objects are equivalent, false otherwise.


isEqualTo(const OSNumber *)


Tests the equality of two OSNumber objects.

public

virtual bool isEqualTo( const OSNumber *integer) const;
Parameters
integer

The OSNumber object to be compared against the receiver.

Return Value

Returns true if the two objects are equivalent, false otherwise.


numberOfBits


Returns the number of bits used to represent the value.

public

virtual unsigned int numberOfBits() const;
Return Value

Returns the number of bits required to represent the value.


numberOfBytes


Returns the number of bytes used to represent the value.

public

virtual unsigned int numberOfBytes() const;
Return Value

Returns the number of bytes required to represent the value.


serialize


Archives the receiver.

public

virtual bool serialize( OSSerialize *s) const;
Parameters
s

The OSSerialize object.

Return Value

Returns true if serialization was successful, false if not.


setValue


Replaces the current internal numeric value of the OSNumber object by the value given.

public

virtual void setValue( unsigned long long value);
Parameters
value

The new value for the OSNumber object.


unsigned16BitValue


Returns its internal value as a 16-bit value.

public

virtual unsigned short unsigned16BitValue() const;
Return Value

Returns the internal value as a 16-bit value.


unsigned32BitValue


Returns its internal value as a 32-bit value.

public

virtual unsigned int unsigned32BitValue() const;
Return Value

Returns the internal value as a 32-bit value.


unsigned64BitValue


Returns its internal value as a 64-bit value.

public

virtual unsigned long long unsigned64BitValue() const;
Return Value

Returns the internal value as a 64-bit value.


unsigned8BitValue


Returns its internal value as an 8-bit value.

public

virtual unsigned char unsigned8BitValue() const;
Return Value

Returns the internal value as an 8-bit value.


withNumber(const char *, unsigned int)


Creates and initializes an instance of OSNumber with a given value represented as a simple C string.

public

static OSNumber *withNumber( const char *value, unsigned int numberOfBits);
Parameters
value

A C string representing a numeric value.

numberOfBits

The number of bits required to represent the value.

Return Value

Returns an instance of OSNumber or 0 if an error occurred.

Discussion

This function does not work on IOKit versions prior to 8.0 (prior to Mac OS X v10.4). For IOKit versions 8.0 and later, it works but is limited to parsing unsigned 32-bit quantities The format of the C string may be decimal, hexadecimal ("0x" prefix), binary ("0b" prefix), or octal ("0" prefix).


withNumber(unsigned long long, unsigned int)


Creates and initializes an instance of OSNumber with a given value.

public

static OSNumber *withNumber( unsigned long long value, unsigned int numberOfBits);
Parameters
value

The numeric integer value.

numberOfBits

The number of bits required to represent the value.

Return Value

Returns an instance of OSNumber or 0 if an error occurred.

Member Data


reserved


protected

ExpansionData *reserved;
Discussion

Reserved for future use. (Internal use only)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.

 

Last Updated: 2008-12-19