Skip to main content
summaryrefslogtreecommitdiffstats
blob: 926b4dc698b1d87d45faed70f84a937630e47fe4 (plain) (blame)
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
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.ote.messaging.dds;

import java.nio.ByteBuffer;

/**
 * Provides the DDS system with a generic means of handling any data type. Any messages that are sent through the system
 * must implement this interface so that the DDS system has a means of handling them in a platform independent manner.
 * 
 * @author Robert A. Fisher
 * @author David Diepenbrock
 */
public interface Data {

   /**
    * This method is used to get a byte array representation of the data. This data should be in such a form that it can
    * be passed to the <code>setFromByteArray</code> method to acquire the "same" object.
    * 
    * @return A byte array version of the state information for this <code>Data</code>
    */
   public byte[] toByteArray();

   public ByteBuffer toByteBuffer();

   /**
    * This method is used to restore a data item's state from a byte array. This method should work in such a manner
    * that the array received from a <code>Data</code>'s <code>toByteArray</code> method can be passed to this method to
    * construct an object that is the "same".
    * 
    * @param input The byte array to build the state information from.
    */
   public void setFromByteArray(byte[] input);

   public void setFromByteBuffer(ByteBuffer buffer);

   public void copyFrom(Data buffer);

   /**
    * This method is here for future functionality that is described in the DDS specification but has not been
    * implemented or used.
    */
   public Object getKeyValue();

   public int getOffset();

}

Back to the top