2010-11-09 Francois Chouinard <fchouinard@gmail.com> Contribution for Bug315307
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng.jni / src / org / eclipse / linuxtools / lttng / jni / Jni_C_Common.java
CommitLineData
0152140d
ASL
1package org.eclipse.linuxtools.lttng.jni;
2
3import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant;
4
5/*******************************************************************************
6 * Copyright (c) 2009 Ericsson
7 *
8 * All rights reserved. This program and the accompanying materials are
9 * made available under the terms of the Eclipse Public License v1.0 which
10 * accompanies this distribution, and is available at
11 * http://www.eclipse.org/legal/epl-v10.html
12 *
13 * Contributors:
14 * William Bourque (wbourque@gmail.com) - Initial API and implementation
15 *******************************************************************************/
16
17
18/**
19 * <b><u>Jni_C_Common</u></b>
20 * <p>
3b7509b0
WB
21 * Common constants and methods that should be shared between JNI objects.
22 *
23 * <b>NOTE</b><p>
24 * This class is ABSTRACT, and will be extended by each LTTng structure (Trac, Tracefile, Event, ...)
25 *
0152140d 26 */
c85e8cb2
WB
27public abstract class Jni_C_Common extends Jni_C_Constant
28{
a9fcdd8d 29 // Native console printing function
c85e8cb2
WB
30 protected native void ltt_printC(int libId, String string_to_print);
31
0152140d
ASL
32 /**
33 * Java-side console printing function.<p>
34 *
35 * Call the C printing function to make sure all printing happen on the same side.
36 *
37 * @param msg The string to print in C.
38 */
3b38ea61 39 @SuppressWarnings("nls")
c85e8cb2 40 public void printC(int libId, String msg) {
0152140d
ASL
41 // Need to escape "%" for C printf
42 msg = msg.replaceAll("%", "%%");
c85e8cb2 43 ltt_printC(libId, msg);
0152140d
ASL
44 }
45
46 /**
47 * Java-side console printing function that add carriage return. <p>
48 *
49 * Call the C printing function to make sure all printing happen on the same side.
50 *
51 * @param msg The string to print in C.
52 */
3b38ea61 53 @SuppressWarnings("nls")
c85e8cb2
WB
54 public void printlnC(int libId, String msg) {
55 printC(libId, msg + "\n");
0152140d 56 }
c357e4b6
WB
57
58}
This page took 0.030834 seconds and 5 git commands to generate.