aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLInfoAccessor.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-04-12 22:18:39 +0200
committerMichael Bien <[email protected]>2010-04-12 22:18:39 +0200
commitbf07b44ed6a8958dd321cc4c08fd2bdd08299611 (patch)
treee24b7c4e4197a80e0ecaad75b9b3667299fd8323 /src/com/mbien/opencl/CLInfoAccessor.java
parent7680472b21ec1e2deacb49addae65c820a2e2a4d (diff)
renamed package com.mbien.* in com.jogamp.* JOCL is now officially a JogAmp team player ;).
Diffstat (limited to 'src/com/mbien/opencl/CLInfoAccessor.java')
-rw-r--r--src/com/mbien/opencl/CLInfoAccessor.java62
1 files changed, 0 insertions, 62 deletions
diff --git a/src/com/mbien/opencl/CLInfoAccessor.java b/src/com/mbien/opencl/CLInfoAccessor.java
deleted file mode 100644
index 9f2ae1aa..00000000
--- a/src/com/mbien/opencl/CLInfoAccessor.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package com.mbien.opencl;
-
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.common.nio.Int64Buffer;
-import com.mbien.opencl.util.CLUtil;
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-
-import static com.mbien.opencl.CLException.*;
-
-/**
- * Internal utility for common OpenCL clGetFooInfo calls.
- * Threadsafe.
- * @author Michael Bien
- */
-abstract class CLInfoAccessor {
-
- protected final static ThreadLocal<ByteBuffer> localBB = new ThreadLocal<ByteBuffer>() {
-
- @Override
- protected ByteBuffer initialValue() {
- return Buffers.newDirectByteBuffer(512);
- }
-
- };
- protected final static ThreadLocal<Int64Buffer> localPB = new ThreadLocal<Int64Buffer>() {
-
- @Override
- protected Int64Buffer initialValue() {
- return Int64Buffer.allocateDirect(1);
- }
-
- };
-
- public final long getLong(int key) {
-
- ByteBuffer buffer = localBB.get();
- int ret = getInfo(key, 8, buffer, null);
- checkForError(ret, "error while asking for info value");
-
- return buffer.getLong(0);
- }
-
- public final String getString(int key) {
-
- ByteBuffer buffer = localBB.get();
- Int64Buffer sizeBuffer = localPB.get();
- int ret = getInfo(key, buffer.capacity(), buffer, sizeBuffer);
- checkForError(ret, "error while asking for info string");
-
- int clSize = (int)sizeBuffer.get(0);
- byte[] array = new byte[clSize-1]; // last char is always null
- buffer.get(array).rewind();
-
- return CLUtil.clString2JavaString(array, clSize);
-
- }
-
- protected abstract int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet);
-
-
-}