1 // -*- Mode: C++; -*- 2 // Package : omniORB 3 // CORBA_NamedValue.h Created on: 2001/08/17 4 // Author : Duncan Grisby (dpg1) 5 // 6 // Copyright (C) 2001 AT&T Laboratories Cambridge 7 // 8 // This file is part of the omniORB library 9 // 10 // The omniORB library is free software; you can redistribute it and/or 11 // modify it under the terms of the GNU Lesser General Public 12 // License as published by the Free Software Foundation; either 13 // version 2.1 of the License, or (at your option) any later version. 14 // 15 // This library is distributed in the hope that it will be useful, 16 // but WITHOUT ANY WARRANTY; without even the implied warranty of 17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 // Lesser General Public License for more details. 19 // 20 // You should have received a copy of the GNU Lesser General Public 21 // License along with this library. If not, see http://www.gnu.org/licenses/ 22 // 23 // 24 // Description: 25 // CORBA::NamedValue, NVList 26 // 27 28 #ifndef INSIDE_OMNIORB_CORBA_MODULE 29 # error "Must only be #included by CORBA.h" 30 #endif 31 32 ////////////////////////////////////////////////////////////////////// 33 ///////////////////////////// NamedValue ///////////////////////////// 34 ////////////////////////////////////////////////////////////////////// 35 36 enum _Flags { 37 ARG_IN = 0x1, 38 ARG_OUT = 0x2, 39 ARG_INOUT = 0x3, //? Defined in CORBA 2.5. Odd. 40 CTX_RESTRICT_SCOPE = 0xF, //? Defined in CORBA 2.5. Odd. 41 OUT_LIST_MEMORY = 0x10, 42 IN_COPY_VALUE = 0x20 43 }; 44 45 typedef ULong Flags; 46 47 class NamedValue; 48 typedef NamedValue* NamedValue_ptr; 49 typedef NamedValue_ptr NamedValueRef; 50 typedef _CORBA_PseudoObj_Var<NamedValue> NamedValue_var; 51 typedef _CORBA_PseudoObj_Out<NamedValue,NamedValue_var> NamedValue_out; 52 53 class NamedValue { 54 public: 55 virtual ~NamedValue(); 56 57 virtual const char* name() const = 0; 58 // Retains ownership of return value. 59 60 virtual Any* value() const = 0; 61 // Retains ownership of return value. 62 63 virtual Flags flags() const = 0; 64 65 virtual Boolean NP_is_nil() const = 0; 66 virtual NamedValue_ptr NP_duplicate() = 0; 67 68 static NamedValue_ptr _duplicate(NamedValue_ptr); 69 static NamedValue_ptr _nil(); 70 PR_is_valid(NamedValue_ptr p)71 static inline _CORBA_Boolean PR_is_valid(NamedValue_ptr p ) { 72 return ((p) ? (p->pd_magic == PR_magic) : 1); 73 } 74 75 static _dyn_attr const _CORBA_ULong PR_magic; 76 77 protected: NamedValue()78 NamedValue() { pd_magic = PR_magic; } 79 80 private: 81 _CORBA_ULong pd_magic; 82 83 NamedValue(const NamedValue&); 84 NamedValue& operator=(const NamedValue&); 85 }; 86 87 88 ////////////////////////////////////////////////////////////////////// 89 /////////////////////////////// NVList /////////////////////////////// 90 ////////////////////////////////////////////////////////////////////// 91 92 class NVList; 93 typedef NVList* NVList_ptr; 94 typedef NVList_ptr NVListRef; 95 typedef _CORBA_PseudoObj_Var<NVList> NVList_var; 96 typedef _CORBA_PseudoObj_Out<NVList,NVList_var> NVList_out; 97 98 class NVList { 99 public: 100 virtual ~NVList(); 101 102 virtual ULong count() const = 0; 103 virtual NamedValue_ptr add(Flags) = 0; 104 virtual NamedValue_ptr add_item(const char*, Flags) = 0; 105 virtual NamedValue_ptr add_value(const char*, const Any&, Flags) = 0; 106 virtual NamedValue_ptr add_item_consume(char*,Flags) = 0; 107 virtual NamedValue_ptr add_value_consume(char*, Any*, Flags) = 0; 108 virtual NamedValue_ptr item(ULong index) = 0; 109 virtual void remove (ULong) = 0; 110 111 virtual Boolean NP_is_nil() const = 0; 112 virtual NVList_ptr NP_duplicate() = 0; 113 114 static NVList_ptr _duplicate(NVList_ptr); 115 static NVList_ptr _nil(); 116 117 // OMG Interface: 118 OMNIORB_DECLARE_USER_EXCEPTION_IN_CORBA(Bounds,_dyn_attr)119 OMNIORB_DECLARE_USER_EXCEPTION_IN_CORBA(Bounds, _dyn_attr) 120 121 static inline _CORBA_Boolean PR_is_valid(NVList_ptr p ) { 122 return ((p) ? (p->pd_magic == PR_magic) : 1); 123 } 124 125 static _dyn_attr const _CORBA_ULong PR_magic; 126 127 protected: NVList()128 NVList() { pd_magic = PR_magic; } 129 130 private: 131 _CORBA_ULong pd_magic; 132 133 NVList(const NVList& nvl); 134 NVList& operator=(const NVList&); 135 }; 136 137