Class CPointer<T>
- java.lang.Object
-
- org.cakelab.blender.nio.CFacade
-
- org.cakelab.blender.nio.CPointer<T>
-
- Type Parameters:
T
- Target type of the pointer.
- Direct Known Subclasses:
CArrayFacade
,CPointerMutable
public class CPointer<T> extends CFacade
Objects of this class represent a C pointer in Java. It provides the following main functionalities:- pointer arithmetics
- type casting
Pointer Type
A pointer in C is defined by its target type and the level of indirection. For exampleint** pint
is said to be a pointer on a pointer of typeint
. Thus, the target type isint
and the level of indirection is2
.
In Java Blend a pointer is mapped to this template class where the target type is provided through the template parameterT
. Thus an object ofCPointer<CPointer<Integer>>
is the equivalent representation ofint**
.
CPointer Objects are Immutable
Objects of CPointer are immutable, that means you cannot change its address. Thus, CPointer objects behave like String's in Java: Every 'modification' creates a copy of the object with that modification, while the original objects stays unmodified. This has disadvantages in performance, if you heavily depend on pointer arithmetics. Hence, there is another class called
CPointerMutable
which allows in-place modification of pointers (similar to the relationship between String and StringBuffer).To change the value of a pointer, which is stored in a block, you have to use the setter method of the facade, array or pointer associated with the block.
Examples
Consider a case where you have created a new object and you'd like to attach it to the list of objects in a scene. In this case you need to assign the pointer to this object to the member variable id.next of the previous object.BlenderObject newObject = ..; // instantiated a new object ID id = object.getId(); // get id of previous object // get a pointer on the new object CPointer<BlenderObject> pNewObj = newObject.__io__addressof(); id.setNext(pNewObj); // set id.next to point to new obj
In the last line, the new address was written to the underlying block associated with the previous object.
In case you do not have a facade on the data in the block, you will have either an array of pointers or a pointer of pointer. The following example demonstrates it for an int* stored in a block.
// We have a pointer refering to a pointer stored in a block CPointer<CPointer<Integer>> ppint = ..; // And we have received a new address for that pointer from elsewhere CPointer<Integer> pint = ..; // To assign the new address to the pointer in the block we use the setter. ppint.set(pint);
Pointer Arithmetics
A pointer supports referencing (seeget()
) and basic algebra (seeplus(int)
). For advanced pointer arithmetics seeCPointerMutable
.Referencing
Referencing the target object throughget()
returns that objects (Java) value.-
If the target object
is of complex type (a class), the value returned is a reference on an
instance of a class derived from
CFacade
. That means, you get access by reference: all modifications to the objects data will be reflected in the memory backing the object. This applies also toCArrayFacade
objects but it applies not to instances ofCPointer
itself (see below). - If the target object is a scalar, then the value is the value read from the target address. That means, modifications to that value will not be reflected in the memory location of its origination.
CPointer
is a reference but treated as a scalar. That means, if you receive a pointer from a method (e.g. from a facade, array or another pointer) than it is a copy - disconnected from its own memory location. Any modification to the pointer is not reflected in its original memory location. To assign a new address to its original memory location, you have to use the set method of the object, which provided you the pointer.
Example
CPointer next = link.getNext(); // retrieve address Link anotherLink = .. ; // link we received elsewhere link.setNext(anotherLink.__io__addressof()); // assign new address to link.next
See also
CPointerMutable
andCFacade.__io__addressof(long[])
.Basic Algebra
Typical pointer arithmetics are incrementing and decrementing the address by the size of the target type. This actually reflects the same functionality provided by array types. CPointer provides different ways to achieve this functionality: Conversion to an array (see Section Array Conversion below) and the method
plus(int)
.Array conversion provides you either a Java array type or an iterable CArrayFacade which is pretty straight forward to handle. The method
plus(int)
increments the address by the given increment multiplied by the size of the pointer target type. Thus you can use the pointer like an iterator as in the example below.Example
// iterating over a null terminated list of materials for (CPointer
pmat = .. ; !pmat.isNull(); // null check pmat = pmat.plus(+1)) // inc address by sizeof(Material) { Material mat = pmat.get(); } Please note, that the result of
plus(int)
has to be assigned to pmat, sinceCPointer
is immutable andplus(int)
does not change the address of the pointer itself (see alsoCPointerMutable
).This functionality of course requires that the pointer is of the correct type (same as in C). Pointer arithmetics to a
void*
(which is mapped toCPointer<Object>
are permitted. Thus, you have to cast the pointer to the correct target type first (see Section Type Casts below).Type Casts
Type casts are supported through the methodscast(Class)
andcast(Class[])
. Both take a parameter which describes the new target type of the casted pointer. Since template parameters are not available at runtime, type casts of pointers with multiple indirections and pointers on arrays require you to provide even the types of the targeted types. For example, if you have a pointer on a pointer of type Link, than the first pointer is of type pointer on pointer and the second pointer is of type pointer on Link.Example
CPointer<CPointer<Link>> pplink = .. ; CPointer<CPointer<Scene>> ppscene; ppscene = pplink.cast(new Class[]{Pointer.class, Scene.class}; CPointer<Scene> pscene = ppscene.get(); Scene scene = pscene.get();
This can get confusing but you will need to cast pointers with multiple levels of indirection rather rare or never.
Array Conversion
The method
toArray(int)
returns an array with copies of the values received from the address the pointer points to.Since it is not possible to use scalar types (such as int, double etc.) as template parameter, there are several different flavours of
toArray(byte[], int, int)
andtoByteArray(int)
for all scalar types. Please note, that there are two special methods for int64, since long can refer to integer of 4 or 8 byte depending on the data received from blender file. Refer to the originating facade, you received the pointer from, to determine its actual type.- Author:
- homac
-
-
Field Summary
Fields Modifier and Type Field Description protected long
targetSize
protected java.lang.Class<?>[]
targetTypeList
Type of the target the pointer is able to address.-
Fields inherited from class org.cakelab.blender.nio.CFacade
__io__address, __io__arch_index, __io__block, __io__blockTable, __io__pointersize
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected T
__get(long address)
protected void
__set(long address, T value)
Copies the given value to the given address.<U> CPointer<U>
cast(java.lang.Class<?>[] types)
Type cast for pointers with multiple levels of indirection (pointer on pointer).<U> CPointer<U>
cast(java.lang.Class<U> type)
Type cast for pointers with just one indirection.CArrayFacade<T>
cast(CArrayFacade<T> type)
Type cast a pointer to an array.boolean
equals(java.lang.Object obj)
Compares addresses (not the memory).void
fromArray(byte[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromArray(byte[] data, int off, int len)
Copies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.void
fromArray(double[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromArray(double[] data, int off, int len)
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.void
fromArray(float[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromArray(float[] data, int off, int len)
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.void
fromArray(int[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromArray(int[] data, int off, int len)
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.void
fromArray(long[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromArray(long[] data, int off, int len)
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.void
fromArray(short[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromArray(short[] data, int off, int len)
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.void
fromInt64Array(long[] data)
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.void
fromInt64Array(long[] data, int off, int len)
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.T
get()
This method returns the value, the pointer points to.long
getAddress()
This returns the address this pointer points to.protected T
getCFacade(long targetAddress)
Returns a facade or pointer on the given targetAddress, depending on the type of this pointer.protected T
getScalar(long address)
Returns a copy of the scalar from memory referenced by the given address.boolean
isNull()
Checks whether the address of the pointer equals null.protected boolean
isPrimitive(java.lang.Class<?> type)
Determines if the given type is a primitive type (scalar).boolean
isValid()
Tells whether the pointer points to actual data or in a region of memory, which does not exist.CPointerMutable<T>
mutable()
Creates a mutable pointer which allows to change its address in-place.CPointer<T>
plus(int value)
plus(int)
returns new instance with the result of the addition.void
set(T value)
Sets the value the pointer points to.protected void
setScalar(long address, T elem)
byte[]
toArray(byte[] data, int off, int len)
Copies 'len' bytes from the memory referenced by this pointer to the given 'data' array starting at index 'off'.double[]
toArray(double[] data, int off, int len)
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.float[]
toArray(float[] data, int off, int len)
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.T[]
toArray(int length)
Converts the data referenced by the pointer into a Java array of the given length.int[]
toArray(int[] data, int off, int len)
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.long[]
toArray(long[] data, int off, int len)
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.short[]
toArray(short[] data, int off, int len)
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.long[]
toArrayInt64(long[] data, int off, int len)
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.byte[]
toByteArray(int len)
Converts the data referenced by the pointer into a Java array of the given length.CArrayFacade<T>
toCArrayFacade(int len)
Converts the data referenced by the pointer into an array with a CArrayFacade of the given length.double[]
toDoubleArray(int len)
Converts the data referenced by the pointer into a Java array of the given length.float[]
toFloatArray(int len)
Converts the data referenced by the pointer into a Java array of the given length.long[]
toInt64Array(int len)
Converts the data referenced by the pointer into a Java array of the given length.int[]
toIntArray(int len)
Converts the data referenced by the pointer into a Java array of the given length.long[]
toLongArray(int len)
Converts the data referenced by the pointer into a Java array of the given length.short[]
toShortArray(int len)
Converts the data referenced by the pointer into a Java array of the given length.-
Methods inherited from class org.cakelab.blender.nio.CFacade
__io__addressof, __io__addressof, __io__equals, __io__generic__copy, __io__generic__copy, __io__instanceof, __io__native__copy, __io__newInstance, __io__same__encoding, __io__sizeof, __io__sizeof, __io__subclassof, hashCode
-
-
-
-
Constructor Detail
-
CPointer
public CPointer(CPointer<T> other)
Copy constructor. It creates another instance of the 'other' pointer.- Parameters:
other
- Pointer to be copied.
-
CPointer
public CPointer(long targetAddress, java.lang.Class<?>[] targetTypes, Block block, BlockTable memory)
Common constructor for pointers.- Parameters:
targetAddress
- Address the pointer will point to.targetTypes
- Type of the pointer (please read class documentation)block
- Block, which contains the targetAddress.memory
- Associated block table, which contains memory for the targetAddress.
-
-
Method Detail
-
get
public T get() throws java.io.IOException
This method returns the value, the pointer points to. Whether the returned value is a reference or a copy depends on its type. If this is a null pointer, the value returned will be null. In case this pointer references a scalar type, you should checkisNull()
before callingget()
.- Scalar types will be returned by value.
- Pointers will be returned by value.
- Arrays and structs will be returned by reference.
- Returns:
- Returns the value the pointer points to.
- Throws:
java.io.IOException
-
__get
protected T __get(long address) throws java.io.IOException
- Throws:
java.io.IOException
-
set
public void set(T value) throws java.io.IOException
Sets the value the pointer points to. This performs a (shallow) copy of the underlying data. If the referenced value is an instance of a struct or array this method will perform a copy of the memory region inside the associated block of the source instance ('value'). If the data is a scalar or a pointer this method will write its value to the address where this pointer refers to.- Parameters:
value
- Value to be copied to the address this pointer points to.- Throws:
java.io.IOException
-
__set
protected void __set(long address, T value) throws java.io.IOException
Copies the given value to the given address. See alsoset(Object)
.- Parameters:
address
- to write the value to.value
- to be copied.- Throws:
java.io.IOException
-
getAddress
public long getAddress() throws java.io.IOException
This returns the address this pointer points to.- Throws:
java.io.IOException
- address the pointer points to
-
isNull
public boolean isNull()
Checks whether the address of the pointer equals null.
-
isValid
public boolean isValid()
Tells whether the pointer points to actual data or in a region of memory, which does not exist. Thus, it is a bit more than a null pointer check (isNull()
and it is more expensive performance wise.
This method is mainly intended for debugging purposes.- Returns:
- true, if you can access the memory
-
cast
public <U> CPointer<U> cast(java.lang.Class<U> type)
Type cast for pointers with just one indirection. Creates a new pointer of a different targetType.Pointer<ListBase> p; .. Pointer <Scene> pscene = p.cast(Scene.class);
Attention!
This is a very dangerous and error prone method since you can cast to anything. But you will need it several times.
-
cast
public <U> CPointer<U> cast(java.lang.Class<?>[] types)
Type cast for pointers with multiple levels of indirection (pointer on pointer). Creates a new pointer of a different targetType.CPointer<CPointer<ListBase>> p; .. CPointer<CPointer<Scene>> pscene = p.cast(new Class>[]{CPointer.class, Scene.class});
Attention!
This is an even more dangerous and error prone method thancast(Class)
since you can do even more nasty stuff.
-
cast
public CArrayFacade<T> cast(CArrayFacade<T> type) throws java.io.IOException
Type cast a pointer to an array. Since arrays require a length value, this method will work only on pointers, which are arrays already (i.e. (p instanceof CArrayFacade) == true
)). The parameter is needed only to differentiate it from othercast
methods. Thus, you can use it like this:CPointer<Float> p = null; CArrayFacade<Float> array = null; array = p.cast(array);
To create a new array facade for a given pointer you have to use the methodtoCArrayFacade(int)
.- Parameters:
type
-- Returns:
- pointer casted to CArrayFacade
- Throws:
java.io.IOException
-
toArray
public T[] toArray(int length) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
length
- of the new Java array instance.- Returns:
- New Java array instance or null if the pointer is null (
isNull()
). - Throws:
java.io.IOException
-
toCArrayFacade
public CArrayFacade<T> toCArrayFacade(int len)
Converts the data referenced by the pointer into an array with a CArrayFacade of the given length.
-
toArray
public byte[] toArray(byte[] data, int off, int len) throws java.io.IOException
Copies 'len' bytes from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
fromArray
public void fromArray(byte[] data, int off, int len) throws java.io.IOException
Copies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
toByteArray
public byte[] toByteArray(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromArray
public void fromArray(byte[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
toArray
public short[] toArray(short[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
fromArray
public void fromArray(short[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
toShortArray
public short[] toShortArray(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromArray
public void fromArray(short[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
toArray
public int[] toArray(int[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
toIntArray
public int[] toIntArray(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromArray
public void fromArray(int[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
fromArray
public void fromArray(int[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
toArray
public long[] toArray(long[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
toLongArray
public long[] toLongArray(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromArray
public void fromArray(long[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
fromArray
public void fromArray(long[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
toArrayInt64
public long[] toArrayInt64(long[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
toInt64Array
public long[] toInt64Array(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromInt64Array
public void fromInt64Array(long[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
fromInt64Array
public void fromInt64Array(long[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
toArray
public float[] toArray(float[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
toFloatArray
public float[] toFloatArray(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromArray
public void fromArray(float[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
fromArray
public void fromArray(float[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
toArray
public double[] toArray(double[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from the memory referenced by this pointer to the given 'data' array starting at index 'off'.- Parameters:
data
- Array, to copy the data to.off
- Start index in the data array.len
- Amount of elements to be copied to data.- Returns:
- The array provided with param 'data'
- Throws:
java.io.IOException
-
toDoubleArray
public double[] toDoubleArray(int len) throws java.io.IOException
Converts the data referenced by the pointer into a Java array of the given length.- Parameters:
len
- length of the new Java array instance.- Returns:
- New Java array instance.
- Throws:
java.io.IOException
-
fromArray
public void fromArray(double[] data, int off, int len) throws java.io.IOException
Copyies 'len' elements from from the given 'data' array starting at index 'off' to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.off
- Start index in the data array.len
- Amount of elements to be copied from 'data'.- Throws:
java.io.IOException
-
fromArray
public void fromArray(double[] data) throws java.io.IOException
Copyies all elements from from the given 'data' array to the memory referenced by this pointer.- Parameters:
data
- Array, to copy the data from.- Throws:
java.io.IOException
-
mutable
public CPointerMutable<T> mutable()
Creates a mutable pointer which allows to change its address in-place.- See Also:
CPointerMutable
-
plus
public CPointer<T> plus(int value) throws java.io.IOException
plus(int)
returns new instance with the result of the addition. Allows (almost) equivalent handling as operator.int *p, *a; a = p = .. ; a = (p+1)+1;
same asCPointerMutable
where the post conditionp, a; p = a = .. ; p = (p.plus(1)).plus(1); post condition: (p != a)
holds.- Parameters:
value
- increment- Returns:
- new instance of this pointer with an address+=targetSize * value
- Throws:
java.io.IOException
-
equals
public boolean equals(java.lang.Object obj)
Compares addresses (not the memory). In this regard, a pointer is equal to another pointer, object facade or facade iterator etc., if it references the same address in the same blender file.
-
isPrimitive
protected boolean isPrimitive(java.lang.Class<?> type)
Determines if the given type is a primitive type (scalar). Note: Works only for types supported by Java Blend.- Returns:
- True if its a primitive type.
-
getCFacade
protected T getCFacade(long targetAddress) throws java.io.IOException
Returns a facade or pointer on the given targetAddress, depending on the type of this pointer. Type of the facade is specified by the target type of the pointer.Precoditions:
- targetAddress has to be in range of the associated block of this pointer.
- Type of this pointer has to be either a pointer or a struct
(i.e. derived from
CFacade
).
- Parameters:
targetAddress
- Address- Returns:
- facade or pointer on the given address
- Throws:
java.io.IOException
-
getScalar
protected T getScalar(long address) throws java.io.IOException
Returns a copy of the scalar from memory referenced by the given address.Precoditions:
- targetAddress has to be in range of the associated block of this pointer.
- Type of this pointer has to scalar (i.e. int, double, etc.).
- Throws:
java.io.IOException
-
setScalar
protected void setScalar(long address, T elem) throws java.io.IOException
- Throws:
java.io.IOException
-
-