2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
24 * $XConsortium: oid_t.h /main/6 1996/08/21 15:52:31 drk $
26 * Copyright (c) 1992 HAL Computer Systems International, Ltd.
27 * All rights reserved. Unpublished -- rights reserved under
28 * the Copyright Laws of the United States. USE OF A COPYRIGHT
29 * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
32 * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
33 * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
34 * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
35 * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
38 * RESTRICTED RIGHTS LEGEND
39 * Use, duplication, or disclosure by the Government is subject
40 * to the restrictions as set forth in subparagraph (c)(l)(ii)
41 * of the Rights in Technical Data and Computer Software clause
42 * at DFARS 252.227-7013.
44 * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
55 #include "utility/c_stringstream.h"
60 #include "utility/funcs.h"
61 #include "utility/buffer.h"
63 typedef unsigned short e_code_t;
64 typedef unsigned short c_code_t;
65 typedef mmdb_pos_t i_code_t;
67 #define OID_T_SZ (sizeof(i_code_t))
69 /*************************************
71 **************************************/
76 oid_t() : v_c_code(0), v_i_code(0), v_e_code(0) {};
77 oid_t(c_code_t c, i_code_t i) : v_c_code(c), v_i_code(i), v_e_code(0) {};
78 oid_t(const char* source, Boolean ascii_format, Boolean swap_order);
79 oid_t(const oid_t& x) :
80 v_c_code(x.v_c_code), v_i_code(x.v_i_code), v_e_code(x.v_e_code) {};
83 // oid_t equal and less test
84 Boolean eq(const oid_t&) const;
85 Boolean ls(const oid_t&) const;
86 bool operator==(const oid_t& arg) const { return eq(arg); };
88 // class code, oid type and instance code export functions
89 const c_code_t ccode() const { return v_c_code; } ;
90 const i_code_t& icode() const { return v_i_code; } ;
92 static unsigned hash(const oid_t&);
95 io_status asciiIn(istream&) ;
96 io_status asciiOut(ostream&) const;
98 io_status _asciiIn(istream&) ; // a version of asciiIn that does not
99 // eat the trailing '\n'
102 friend ostream& operator<<(ostream&, const oid_t&) ;
104 // compacted disk representation In and Out functions
106 io_status cdrOut(buffer&);
107 io_status cdrIn(buffer&, c_code_t c_code_to_use = 0);
109 // out to char strings
110 void to_char_string(char* sink, Boolean swap_order) const;
115 friend class dl_list_cell;
116 friend class dl_list;
117 friend class compressed_pstring;
118 friend class service_mgr_t;
119 friend class storage_mgr_t;
120 friend class handler;
121 friend class smart_ptr;
122 friend class template_mgr_t;
125 void become(const oid_t& x) {
126 v_e_code = x.v_e_code;
127 v_c_code = x.v_c_code;
128 v_i_code = x.v_i_code;
130 void set_c_code(c_code_t c) {
133 void set_i_code(i_code_t i) {
136 void set_e_code(e_code_t e) {
141 c_code_t v_c_code; // class code
142 i_code_t v_i_code; // instance code
143 e_code_t v_e_code; // extended code. Not used within this class.
144 // for using extra space purpose.
147 typedef oid_t* oid_tPtr;
150 extern oid_t* ground_ptr;
151 #define ground (*ground_ptr)