Public Member Functions | Static Public Member Functions | Protected Attributes

VCValue Class Reference

Value wrapper class representing a value/timestamp pair. More...

List of all members.

Public Member Functions

(id) - initWithPointerAndCopy:dataType:timestamp:
 Initializes a new value object by copying the memory provided and storin the provided timestamp.
(id) - initWithPointerAndFree:dataType:timestamp:
 Initializes a new value object by taking control of the memory provided and storin the provided timestamp.
(int) - dataType
 Returns the data type of the value object.
(VCTimestamp *) - timestamp
 Timestamp associated with the value.
(int) - intValue
 Returns the value as an integer.
(double) - doubleValue
 Returns the value as a double.
(double) - doubleAtRow:column:
 If the value represented is a matrix, returns the value at the specified row and column as a double. Row and column numbers begin at 1, not 0.
(int) - numberOfRows
 If the value represented is a matrix, returns the number of rows in the matrix.
(int) - numberOfColumns
 If the value represented is a matrix, returns the number of columns in the matrix.
(void *) - data
 Returns the underlying data pointer.
(BOOL) - valueIsEqual:
 Check whether or not the value (not timestamp) contained is identical to that of another VCValue.
(NSString *) - description
 Return an NSString representation of the value.

Static Public Member Functions

(id) + valueWithPointerAndCopy:dataType:timestamp:
 Creates a new, autoreleased value object by copying the memory provided and storing the provided timestamp.
(id) + valueWithPointerAndFree:dataType:timestamp:
 Creates a new, autoreleased value object by taking control of the memory provided and storing the provided timestamp.
(id) + valueWithInteger:andTimestamp:
(id) + valueWithDouble:andTimestamp:

Protected Attributes

VCTimestamptimestamp

Detailed Description

Value class for scalar and matrix data. Data points return their data encapsulated in VCValue objects, which also contain timestamp and data type information.


Member Function Documentation

- (void *) data

Retrieve the raw data pointer for the data represented by this value. Do not modify the buffer returned by this method.

Returns:
A pointer to the raw data buffer.
- (int) dataType

Retrieve the data type associated with the raw data stored in this VCValue.

Returns:
The data type stored. Generally one of the values from enum VCDataTypes.
- (double) doubleAtRow: (int)  row
column: (int)  column 

Retrieve the double at a specific row and column in this value, if it is a matrix. For integer and double values, this function acts as -(double)doubleValue.

Parameters:
rowThe row (1-based) of the value of interest.
columnThe column (1-based) of the value of interest.
Returns:
The double at the specified row. If the data type of this value is not one of VCDataTypeInt, VCDataTypeDouble, VCDataTypeMatrix, then 0.0 will be returned.
- (double) doubleValue

Attempt to convert the stored data to a double and return the result.

Returns:
If the stored data can be converted to a double, the result will be returned. If it cannot be converted, 0.0 will be returned.
- (id) initWithPointerAndCopy: (void *)  pointer
dataType: (int)  type
timestamp: (VCTimestamp *)  aTimestamp 

Create a new value object. The object's value will be taken by making a copy of the data pointed to by pointer, the type of which must be accurately described by the dataType parameter.

Parameters:
pointerA pointer to the location of the value that should be stored. The data at this location will be copied.
typeThe data type (see enum VCDataTypes) of the value.
aTimestampThe time to associate with this value.
Returns:
A newly allocated (effective retain count = 1) value object.
- (int) intValue

Attempt to convert the stored data to an integer and return the result.

Returns:
If the stored data can be converted to an integer, the result will be returned. If it cannot be converted, 0 will be returned.
- (int) numberOfColumns

Retrieve the number of columns for this value.

Returns:
The number of columns for this matrix value. If this value does not represent a matrix, 1 will be returned.
- (int) numberOfRows

Retrieve the number of rows for this value.

Returns:
The number of rows for this matrix value. If this value does not represent a matrix, 1 will be returned.
- (BOOL) valueIsEqual: (VCValue *)  v

Determine whether or not the represented values are equal, not counting the timestamps associated with them.

Parameters:
vThe value to which the receiver should be compared
Returns:
true if the values are equal, false if otherwise. If v is nil, or either v or the reciever is invalid, will return false
+ (id) valueWithDouble: (double)  value
andTimestamp: (VCTimestamp *)  timestamp 

Create a new, autoreleased value object. The object's type will be VCDataTypeDouble, and its value will be that provided by the first parameter.

Parameters:
valueThe value for the new VCValue object.
timestampThe time to associate with this value.
Returns:
A newly allocated and autoreleased (effective retain count = 0) value object.
+ (id) valueWithInteger: (int32_t)  value
andTimestamp: (VCTimestamp *)  timestamp 

Create a new, autoreleased value object. The object's type will be VCDataTypeInt, and its value will be that provided by the first parameter.

Parameters:
valueThe value for the new VCValue object.
timestampThe time to associate with this value.
Returns:
A newly allocated and autoreleased (effective retain count = 0) value object.
+ (id) valueWithPointerAndCopy: (void *)  pointer
dataType: (int)  type
timestamp: (VCTimestamp *)  aTimestamp 

Create a new, autoreleased value object. The object's value will be taken by making a copy of the data pointed to by pointer, the type of which must be accurately described by the dataType parameter.

Parameters:
pointerA pointer to the location of the value that should be stored. The data at this location will be copied.
typeThe data type (see enum VCDataTypes) of the value.
aTimestampThe time to associate with this value.
Returns:
A newly allocated and autoreleased (effective retain count = 0) value object.
+ (id) valueWithPointerAndFree: (void *)  pointer
dataType: (int)  type
timestamp: (VCTimestamp *)  aTimestamp 

Create a new, autoreleased value object. The object's value will be taken by making a copy of the data pointed to by pointer, the type of which must be accurately described by the dataType parameter.

Parameters:
pointerA pointer to the location of the value that should be stored. The data at this location will be destroyed when this object is deallocated.
typeThe data type (see enum VCDataTypes) of the value.
aTimestampThe time to associate with this value.
Returns:
A newly allocated and autoreleased (effective retain count = 0) value object.

Member Data Documentation

- (VCTimestamp *) timestamp [protected]

Retrieve the timestamp associated with this value.

Parameters:
AVCTimestamp object representing the timestamp for this value.

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