001/*
002 * This file is part of the Tuning Fork Visualization Platform
003 *  (http://sourceforge.net/projects/tuningforkvp)
004 *
005 * Copyright (c) 2005 - 2008 IBM Corporation.
006 * All rights reserved. This program and the accompanying materials
007 * are made available under the terms of the Eclipse Public License v1.0
008 * which accompanies this distribution, and is available at
009 * http://www.eclipse.org/legal/epl-v10.html
010 *
011 * Contributors:
012 *     IBM Corporation - initial API and implementation
013 */
014
015package com.ibm.tuningfork.tracegen.chunk;
016
017import org.vmmagic.pragma.Uninterruptible;
018
019import com.ibm.tuningfork.tracegen.types.EventTypeSpaceVersion;
020
021@Uninterruptible
022public class EventTypeSpaceChunk extends Chunk {
023
024    public static final int EVENT_TYPE_SPACE_ID = 3;
025
026    public EventTypeSpaceChunk(EventTypeSpaceVersion eventTypeSpaceVersion) {
027        super(EVENT_TYPE_SPACE_ID, DATA_OFFSET + eventTypeSpaceVersion.name.length() * 3 + ENCODING_SPACE_INT);
028        addStringInternal(getChars(eventTypeSpaceVersion.name));  /* Cannot fail because we made conservative estimate of bytes required */
029        addInt(eventTypeSpaceVersion.version);
030        close();
031    }
032
033}