01: package org.jacorb.orb;
02:
03: /*
04: * JacORB - a free Java ORB
05: *
06: * Copyright (C) 1997-2004 Gerald Brose.
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Library General Public
10: * License as published by the Free Software Foundation; either
11: * version 2 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Library General Public License for more details.
17: *
18: * You should have received a copy of the GNU Library General Public
19: * License along with this library; if not, write to the Free
20: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21: */
22:
23: import java.util.*;
24:
25: /**
26: * information the has to be saved for each encapsulation and
27: * restored later
28: * @author Gerald Brose
29: * @version $Id: EncapsInfo.java,v 1.15 2006/07/17 15:43:05 alphonse.bendt Exp $
30: */
31:
32: public class EncapsInfo {
33: public boolean littleEndian;
34: public final int index;
35: public final int start;
36: public int size;
37: public Map valueMap;
38: public Map repIdMap;
39: public Map codebaseMap;
40:
41: /** constructor used by CDRInputStream */
42:
43: public EncapsInfo(boolean le, int index, int start, int size) {
44: littleEndian = le;
45: this .index = index;
46: this .start = start;
47: this .size = size;
48: }
49:
50: /**
51: * constructor used by CDROutputStream:
52: * record the index a new encapsulation starts with
53: * and the start position in the buffer. CORBA specifies that "indirections
54: * may not cross encapsulation boundaries", so the new encapsulation must
55: * set up its own indirection maps for values, repository ids and codebase
56: * strings. The maps currently in use are also recorded, to be restored at
57: * the end of the encapsulation.
58: */
59:
60: public EncapsInfo(int index, int start, Map valueMap, Map repIdMap,
61: Map codebaseMap) {
62: this .index = index;
63: this .start = start;
64: this .valueMap = valueMap;
65: this .repIdMap = repIdMap;
66: this .codebaseMap = codebaseMap;
67:
68: if (valueMap == null) {
69: valueMap = new HashMap();
70: }
71: if (repIdMap == null) {
72: repIdMap = new HashMap();
73: }
74: if (codebaseMap == null) {
75: codebaseMap = new HashMap();
76: }
77: }
78: }
|