/usr/include/omniORB4/omniObjKey.h is in libomniorb4-dev 4.1.6-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | // -*- Mode: C++; -*-
// Package : omniORB2
// omniObjKey.h Created on: 30/3/99
// Author : David Riddoch (djr)
//
// Copyright (C) 1996-1999 AT&T Research Cambridge
//
// This file is part of the omniORB library
//
// The omniORB library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this library; if not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA
//
//
// Description:
// Representation of an object key.
//
/*
$Log$
Revision 1.2.2.3 2003/01/14 11:48:15 dgrisby
Remove warnings from gcc -Wshadow. Thanks Pablo Mejia.
Revision 1.2.2.2 2000/09/27 17:11:40 sll
Removed reference to the obsoluted MemBufferedStream and NetBufferedStream.
Revision 1.2.2.1 2000/07/17 10:35:35 sll
Merged from omni3_develop the diff between omni3_0_0_pre3 and omni3_0_0.
Revision 1.3 2000/07/13 15:26:05 dpg1
Merge from omni3_develop for 3.0 release.
Revision 1.1.2.1 1999/09/24 09:51:47 djr
Moved from omniORB2 + some new files.
*/
#ifndef __OMNIOBJKEY_H__
#define __OMNIOBJKEY_H__
#include <string.h>
// This is just big enough to fit a root poa key.
#define INLINE_BUF_SIZE 14
class omniObjKey {
public:
inline omniObjKey() : pd_key(pd_inline_buf), pd_size(0) {}
inline omniObjKey(const _CORBA_Octet* key_, int size_)
: pd_key(pd_inline_buf), pd_size(size_) {
if( size_ > INLINE_BUF_SIZE ) pd_key = new _CORBA_Octet[size_];
memcpy(pd_key, key_, size_);
}
// Copies <key>.
inline omniObjKey(_CORBA_Octet* key_, int size_)
: pd_key(key_), pd_size(size_) {
if( size_ <= INLINE_BUF_SIZE ) {
pd_key = pd_inline_buf;
memcpy(pd_key, key_, size_);
delete[] key_;
}
}
// Consumes <key>.
inline omniObjKey(omniObjKey& k, int release)
: pd_size(k.pd_size) {
if( pd_size <= INLINE_BUF_SIZE ) {
pd_key = pd_inline_buf;
}
else if( release ) {
//assert(k.pd_key != k.pd_inline_buf);
pd_key = k.pd_key;
k.pd_key = k.pd_inline_buf;
k.pd_size = 0;
return;
}
else {
pd_key = new _CORBA_Octet[pd_size];
}
memcpy(pd_key, k.pd_key, pd_size);
}
// If <release>, may (or may not) grab the key storage
// (if any) from <k>. ie. On return, <k> may be
// empty.
inline ~omniObjKey() {
if( pd_key != pd_inline_buf ) delete[] pd_key;
}
inline const _CORBA_Octet* key() const { return pd_key; }
inline int size() const { return pd_size; }
inline int is_equal(const _CORBA_Octet* key_, int keysize) const {
return keysize == pd_size && !memcmp(key_, pd_key, keysize);
}
inline void set_size(int size_) {
if( size_ > pd_size && size_ > INLINE_BUF_SIZE ) {
if( pd_key != pd_inline_buf ) delete[] pd_key;
pd_key = new _CORBA_Octet[size_];
}
pd_size = size_;
}
inline _CORBA_Octet* write_key() { return pd_key; }
inline void copy(const _CORBA_Octet* key_, int keysize) {
set_size(keysize);
memcpy(pd_key, key_, keysize);
}
#if 0
inline void consume(_CORBA_Octet* key, int keysize) {
if( pd_key != pd_inline_buf ) delete[] pd_key;
pd_key = key;
pd_size = keysize;
}
#endif
inline _CORBA_Octet* return_key() {
if( pd_key != pd_inline_buf ) {
_CORBA_Octet* tmp = pd_key;
pd_key = pd_inline_buf;
pd_size = 0;
return tmp;
}
_CORBA_Octet* tmp = new _CORBA_Octet[pd_size];
memcpy(tmp, pd_key, pd_size);
return tmp;
}
private:
_CORBA_Octet pd_inline_buf[INLINE_BUF_SIZE];
_CORBA_Octet* pd_key;
int pd_size;
};
#undef INLINE_BUF_SIZE
#endif // __OMNIOBJREF_H__
|