summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/util/JOCLVersion.java
blob: 6c7e02dfdd1a033b3a9cdb450520dd41eda08e15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 * Created on Monday, November 15 2010 19:44
 */
package com.jogamp.opencl.util;

import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.JogampVersion;
import com.jogamp.common.util.VersionUtil;
import java.util.jar.Manifest;

import static com.jogamp.common.util.VersionUtil.*;

/**
 *
 * @author Michael Bien
 */
public class JOCLVersion extends JogampVersion {

    private static final String PACKAGE = "com.jogamp.opencl";

    private JOCLVersion(Manifest mf) {
        super(PACKAGE, mf);
    }

    private static JOCLVersion createInstance(){
        Manifest manifest = VersionUtil.getManifest(JOCLVersion.class.getClassLoader(), PACKAGE);
        return new JOCLVersion(manifest);
    }

    public static String getVersion() {
        return createInstance().toString();
    }

    public static String getAllVersions() {

        StringBuilder sb = new StringBuilder();

        sb.append(SEPERATOR).append(Platform.getNewline());
        sb.append(getPlatformInfo(null));
        sb.append(SEPERATOR).append(Platform.getNewline());

        createInstance().toString(sb);

        sb.append(GlueGenVersion.getInstance().toString());

        return sb.toString();
    }


    public StringBuilder toString(StringBuilder sb) {
        return sb.append(toString((StringBuffer)null));
    }
    
    @Override
    public StringBuffer toString(StringBuffer sb) {
        if(sb == null) {
            sb = new StringBuffer();
        }
        return super.toString(sb);
    }

    public static void main(String[] args) {
        System.out.println(JOCLVersion.getAllVersions());
    }
}