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 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198
|
// -*- Mode: C++; -*-
// Package : omniORB
// CORBA_Policy.h Created on: 2001/08/17
// Author : Duncan Grisby (dpg1)
//
// Copyright (C) 2001 AT&T Laboratories 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 Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see http://www.gnu.org/licenses/
//
//
// Description:
// CORBA::Policy
//
#ifndef INSIDE_OMNIORB_CORBA_MODULE
# error "Must only be #included by CORBA.h"
#endif
//////////////////////////////////////////////////////////////////////
/////////////////////////////// Policy ///////////////////////////////
//////////////////////////////////////////////////////////////////////
typedef ULong PolicyType;
class Policy;
typedef Policy* Policy_ptr;
typedef Policy_ptr PolicyRef;
class Policy : public virtual Object {
public:
virtual ~Policy();
virtual PolicyType policy_type();
virtual Policy_ptr copy();
// This at least needs to be overridden in subclasses.
virtual void destroy();
// May throw NO_PERMISSION.
static Policy_ptr _duplicate(Policy_ptr);
static Policy_ptr _narrow(Object_ptr);
static Policy_ptr _nil();
// omniORB internal.
Policy(PolicyType type);
Policy(); // nil policy
virtual void* _ptrToObjRef(const char* repoId);
virtual void _NP_incrRefCount();
virtual void _NP_decrRefCount();
// Override Object.
static _core_attr const char* _PD_repoId;
private:
Policy(const Policy&);
Policy& operator = (const Policy&);
int pd_refCount;
PolicyType pd_type;
};
typedef _CORBA_PseudoObj_Var<Policy> Policy_var;
typedef _CORBA_PseudoObj_Member<Policy, Policy_var> Policy_member;
typedef _CORBA_Pseudo_Unbounded_Sequence<Policy, Policy_member> PolicyList;
typedef _CORBA_Unbounded_Sequence_w_FixSizeElement<_CORBA_ULong,4,4> PolicyTypeSeq;
class PolicyList_out;
class PolicyList_var {
public:
inline PolicyList_var() : _pd_seq(0) {}
inline PolicyList_var(PolicyList* _s) : _pd_seq(_s) {}
inline PolicyList_var(const PolicyList_var& _s) {
if( _s._pd_seq ) _pd_seq = new PolicyList(*_s._pd_seq);
else _pd_seq = 0;
}
inline ~PolicyList_var() { if( _pd_seq ) delete _pd_seq; }
inline PolicyList_var& operator = (PolicyList* _s) {
if( _pd_seq ) delete _pd_seq;
_pd_seq = _s;
return *this;
}
inline PolicyList_var& operator = (const PolicyList_var& _s) {
if( _s._pd_seq ) {
if( !_pd_seq ) _pd_seq = new PolicyList;
*_pd_seq = *_s._pd_seq;
} else if( _pd_seq ) {
delete _pd_seq;
_pd_seq = 0;
}
return *this;
}
inline Policy_member& operator [] (_CORBA_ULong _s) {
return (*_pd_seq)[_s];
}
inline PolicyList* operator -> () { return _pd_seq; }
#if defined(__GNUG__)
inline operator PolicyList& () const { return *_pd_seq; }
#else
inline operator const PolicyList& () const { return *_pd_seq; }
inline operator PolicyList& () { return *_pd_seq; }
#endif
inline const PolicyList& in() const { return *_pd_seq; }
inline PolicyList& inout() { return *_pd_seq; }
inline PolicyList*& out() {
if( _pd_seq ) { delete _pd_seq; _pd_seq = 0; }
return _pd_seq;
}
inline PolicyList* _retn() { PolicyList* tmp = _pd_seq; _pd_seq = 0; return tmp; }
friend class PolicyList_out;
private:
PolicyList* _pd_seq;
};
class PolicyList_out {
public:
inline PolicyList_out(PolicyList*& _s) : _data(_s) { _data = 0; }
inline PolicyList_out(PolicyList_var& _s)
: _data(_s._pd_seq) { _s = (PolicyList*) 0; }
inline PolicyList_out(const PolicyList_out& _s) : _data(_s._data) {}
inline PolicyList_out& operator = (const PolicyList_out& _s) {
_data = _s._data;
return *this;
}
inline PolicyList_out& operator = (PolicyList* _s) {
_data = _s;
return *this;
}
inline operator PolicyList*&() { return _data; }
inline PolicyList*& ptr() { return _data; }
inline PolicyList* operator->() { return _data; }
inline Policy* operator [] (_CORBA_ULong _i) {
return (*_data)[_i];
}
PolicyList*& _data;
private:
PolicyList_out();
PolicyList_out& operator=(const PolicyList_var&);
};
#ifdef OMNIORB_DECLARE_POLICY_OBJECT
#error OMNIORB_DECLARE_POLICY_OBJECT is already defined!
#endif
#define OMNIORB_DECLARE_POLICY_OBJECT(name, type) \
class name; \
typedef name* name##_ptr; \
typedef name##_ptr name##Ref; \
\
class name : public CORBA::Policy \
{ \
public: \
inline name(name##Value value_) : \
CORBA::Policy(type), pd_value(value_) {} \
inline name() {} \
virtual ~name(); \
\
virtual CORBA::Policy_ptr copy(); \
virtual name##Value value() { return pd_value; } \
\
virtual void* _ptrToObjRef(const char* repoId); \
\
static name##_ptr _duplicate(name##_ptr p); \
static name##_ptr _narrow(CORBA::Object_ptr p); \
static name##_ptr _nil(); \
\
static _core_attr const char* _PD_repoId; \
\
private: \
name##Value pd_value; \
}; \
\
typedef _CORBA_PseudoObj_Var<name> name##_var;
|