(file) Return to CMPI_SelectCond.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / ProviderManager2 / CMPI

  1 karl  1.5 //%2004////////////////////////////////////////////////////////////////////////
  2 schuur 1.1 //
  3 karl   1.5 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 schuur 1.1 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl   1.5 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 schuur 1.1 //
 10            // Permission is hereby granted, free of charge, to any person obtaining a copy
 11            // of this software and associated documentation files (the "Software"), to
 12            // deal in the Software without restriction, including without limitation the
 13            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 14            // sell copies of the Software, and to permit persons to whom the Software is
 15            // furnished to do so, subject to the following conditions:
 16 karl   1.5 // 
 17 schuur 1.1 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 18            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 19            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 20            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 21            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 22            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 23            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 24            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 25            //
 26            //==============================================================================
 27            //
 28            // Author:      Adrian Schuur, schuur@de.ibm.com
 29            //
 30            // Modified By:
 31            //
 32            //%/////////////////////////////////////////////////////////////////////////////
 33            
 34 schuur 1.3 #include "CMPI_Version.h"
 35 schuur 1.2 
 36 schuur 1.1 #include "CMPI_SelectCond.h"
 37            #include "CMPI_Ftabs.h"
 38            #include "CMPI_Value.h"
 39            #include "CMPI_String.h"
 40            
 41            PEGASUS_USING_STD;
 42            PEGASUS_NAMESPACE_BEGIN
 43            
 44 schuur 1.4 extern "C" {
 45 schuur 1.1 
 46 konrad.r 1.7    CMPIStatus scndRelease(CMPISelectCond* eSc) {
 47              	  CMPI_SelectCond *sc = (CMPI_SelectCond*)eSc->hdl;
 48                    if (sc) {
 49              		 CMPI_SelectCondData *data = (CMPI_SelectCondData *)sc->priv;
 50              		 if (data) 
 51              		 	delete data;
 52                       delete sc;
 53                       ((CMPI_Object*)eSc)->unlinkAndDelete();
 54                    }
 55               
 56 schuur   1.4       CMReturn(CMPI_RC_OK);
 57                 }
 58              
 59                 CMPISelectCond* scndClone(CMPISelectCond* eSc, CMPIStatus* rc) {
 60                       if (rc) CMSetStatus(rc,CMPI_RC_ERR_NOT_SUPPORTED);
 61                       return NULL;
 62                 }
 63              
 64                 CMPICount scndGetCountAndType(CMPISelectCond* eSc, int* type, CMPIStatus* rc) {
 65 konrad.r 1.7 
 66              	  CMPI_SelectCond *sc=(CMPI_SelectCond*)eSc;
 67              	  CMPI_SelectCondData *data = (CMPI_SelectCondData *)sc->priv;
 68              
 69              	  if (data)
 70              	   {
 71                    		if (type!=NULL) *type=data->type;
 72                    		if (rc) CMSetStatus(rc,CMPI_RC_OK);
 73                    		return data->tableau->size();
 74              		}
 75              	  return 0;
 76 schuur   1.4    }
 77              
 78                 CMPISubCond* scndGetSubCondAt(CMPISelectCond* eSc, unsigned int index, CMPIStatus* rc) {
 79                    CMPI_SelectCond *sc=(CMPI_SelectCond*)eSc;
 80 konrad.r 1.7       CMPI_SelectCondData *data = (CMPI_SelectCondData *)sc->priv;
 81              	  if (data)
 82              		{
 83                    	  if (index<=data->tableau->size()) {
 84 konrad.r 1.8          	const CMPI_TableauRow *row=(data->tableau->getData())+index;
 85 konrad.r 1.7 
 86                       	CMPISubCond *sbc=(CMPISubCond*)new CMPI_SubCond(row);
 87              			CMPI_Object *obj = new CMPI_Object(sbc);
 88              			obj->priv = ((CMPI_SubCond *)(sbc))->priv;
 89                       	if (rc) CMSetStatus(rc,CMPI_RC_OK);
 90                       	return reinterpret_cast<CMPISubCond *>(obj);
 91              		}
 92                    } else  
 93                    	if (rc) CMSetStatus(rc,CMPI_RC_ERR_FAILED);
 94 schuur   1.4       return NULL; 
 95                 }
 96 schuur   1.1 
 97              }
 98              
 99              static CMPISelectCondFT scnd_FT={
100                   CMPICurrentVersion,
101                   scndRelease,
102                   scndClone,
103                   scndGetCountAndType,
104                   scndGetSubCondAt,
105               };
106              
107              CMPISelectCondFT *CMPI_SelectCond_Ftab=&scnd_FT;
108              
109 konrad.r 1.8 CMPI_SelectCondData::CMPI_SelectCondData(CMPI_Tableau *tblo, int t)
110 konrad.r 1.7   : tableau(tblo), type(t) { }
111              
112 konrad.r 1.8 CMPI_SelectCond::CMPI_SelectCond(CMPI_Tableau* tblo, int t)
113 konrad.r 1.7   {
114                 priv = new CMPI_SelectCondData(tblo, t);
115 schuur   1.1    ft=CMPI_SelectCond_Ftab;
116              }
117              
118              
119              PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2