00001 00002 /* 00003 * 00004 * CmpiArray.h 00005 * 00006 * (C) Copyright IBM Corp. 2003 00007 * 00008 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE 00009 * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE 00010 * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. 00011 * 00012 * You can obtain a current copy of the Common Public License from 00013 * http://oss.software.ibm.com/developerworks/opensource/license-cpl.html 00014 * 00015 * Author: Adrian Schuur <schuur@de.ibm.com> 00016 * Contributors: 00017 * 00018 * Description: CMPI C++ helper class 00019 * 00020 */ 00021 00022 #ifndef _CmpiArray_h_ 00023 #define _CmpiArray_h_ 00024 00025 #include "OW_config.h" 00026 #include "cmpidt.h" 00027 #include "CmpiProviderBase.h" 00028 #include "CmpiObject.h" 00029 00030 class CmpiString; 00031 class CmpiArray; 00032 00033 class CmpiArrayIdx { 00034 friend class CmpiArray; 00035 CmpiArray &ar; 00036 CMPICount idx; 00037 public: 00038 CmpiArrayIdx(CmpiArray &a, CMPICount i) 00039 : ar(a), idx(i) {} 00040 void operator=(const CmpiString); 00041 void operator=(const char*); 00042 00043 void operator=(const CMPISint8); 00044 void operator=(const CMPISint16); 00045 void operator=(const CMPISint32); 00046 void operator=(const int); 00047 void operator=(const CMPISint64); 00048 00049 void operator=(const CMPIUint8); 00050 void operator=(const CMPIUint16); 00051 void operator=(const CMPIUint32); 00052 void operator=(const unsigned int); 00053 void operator=(const CMPIUint64); 00054 00055 void operator>>(CmpiString&); 00056 00057 void operator>>(CMPISint8&); 00058 void operator>>(CMPISint16&); 00059 void operator>>(CMPISint32&); 00060 void operator>>(int&); 00061 void operator>>(CMPISint64&); 00062 00063 void operator>>(CMPIUint8&); 00064 void operator>>(CMPIUint16&); 00065 void operator>>(CMPIUint32&); 00066 void operator>>(unsigned int&); 00067 void operator>>(CMPIUint64&); 00068 }; 00069 00070 00091 class CmpiArray : public CmpiObject { 00092 friend class CmpiArrayIdx; 00093 public: 00094 void operator=(int x) {} 00097 inline CMPIArray *getEnc() const 00098 { return (CMPIArray*)enc; } 00099 void *makeArray(CMPIBroker *mb,CMPICount max, CMPIType type); 00100 00101 inline CmpiArray(CMPICount max, CMPIType type) { 00102 enc=makeArray(CmpiProviderBase::getBroker(),max,type); 00103 } 00104 CmpiArray() {} 00105 CMPICount size(); 00106 inline CmpiArrayIdx operator[](int idx) { 00107 return CmpiArrayIdx(*this,idx); 00108 } 00109 }; 00110 00111 #endif 00112 00113 00114