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

  1 karl  1.13 //%2006////////////////////////////////////////////////////////////////////////
  2 schuur 1.1  //
  3 karl   1.7  // 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.7  // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8             // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl   1.11 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10             // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 karl   1.13 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 12             // EMC Corporation; Symantec Corporation; The Open Group.
 13 schuur 1.1  //
 14             // Permission is hereby granted, free of charge, to any person obtaining a copy
 15             // of this software and associated documentation files (the "Software"), to
 16             // deal in the Software without restriction, including without limitation the
 17             // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 18             // sell copies of the Software, and to permit persons to whom the Software is
 19             // furnished to do so, subject to the following conditions:
 20 karl   1.7  // 
 21 schuur 1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 22             // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 23             // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 24             // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 25             // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 26             // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 27             // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 28             // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 29             //
 30             //==============================================================================
 31             //
 32             //%/////////////////////////////////////////////////////////////////////////////
 33             
 34 schuur 1.4  #include "CMPI_Version.h"
 35 schuur 1.2  
 36 schuur 1.1  #include "CMPI_SubCond.h"
 37             #include "CMPI_Ftabs.h"
 38             #include "CMPI_Value.h"
 39             #include "CMPI_String.h"
 40 ms.aruran 1.17 #include <Pegasus/Common/Tracer.h>
 41 schuur    1.1  
 42                PEGASUS_USING_STD;
 43                PEGASUS_NAMESPACE_BEGIN
 44                
 45 venkat.puvvada 1.16 extern "C"
 46                     {
 47 schuur         1.6  
 48 venkat.puvvada 1.16     CMPIStatus sbcRelease(CMPISubCond* sc)
 49                         {
 50 ms.aruran      1.17         PEG_METHOD_ENTER(
 51                                 TRC_CMPIPROVIDERINTERFACE,
 52                                 "CMPI_SubCond:sbcRelease()");
 53 venkat.puvvada 1.16         CMPI_SubCond *sbc = (CMPI_SubCond*)sc->hdl;
 54                             if( sbc )
 55                             {
 56                                 delete sbc;
 57                                 reinterpret_cast<CMPI_Object*>(sc)->unlinkAndDelete();
 58 ms.aruran      1.17             PEG_METHOD_EXIT();
 59 venkat.puvvada 1.16             CMReturn(CMPI_RC_OK);
 60                             }
 61                             else
 62                             {
 63 ms.aruran      1.17             PEG_TRACE_CSTRING(
 64                                     TRC_CMPIPROVIDERINTERFACE,
 65 marek          1.18                 Tracer::LEVEL1,
 66 ms.aruran      1.17                 "Invalid handle in CMPI_SubCond:sbcRelease");
 67                                 PEG_METHOD_EXIT();
 68 venkat.puvvada 1.16             CMReturn(CMPI_RC_ERR_INVALID_HANDLE);
 69                             }
 70                         }
 71                     
 72                         CMPISubCond* sbcClone(const CMPISubCond* eSc, CMPIStatus* rc)
 73                         {
 74                             CMSetStatus(rc,CMPI_RC_ERR_NOT_SUPPORTED);
 75                             return NULL;
 76                         }
 77                     
 78                         CMPICount sbcGetCount(const CMPISubCond* eSbc, CMPIStatus* rc)
 79                         {
 80 ms.aruran      1.17         PEG_METHOD_ENTER(
 81                                 TRC_CMPIPROVIDERINTERFACE,
 82                                 "CMPI_SubCond:sbcGetCount()");
 83 venkat.puvvada 1.16         const CMPI_SubCond *sbc = (CMPI_SubCond*)eSbc->hdl;
 84                             if( !sbc )
 85                             {
 86 ms.aruran      1.17             PEG_TRACE_CSTRING(
 87                                     TRC_CMPIPROVIDERINTERFACE,
 88 marek          1.18                 Tracer::LEVEL1,
 89 ms.aruran      1.17                 "Invalid handle in CMPI_SubCond:sbcGetCount");
 90 venkat.puvvada 1.16             CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
 91 ms.aruran      1.17             PEG_METHOD_EXIT();
 92 venkat.puvvada 1.16             return 0;
 93                             }
 94                             CMPI_TableauRow* row = (CMPI_TableauRow* )sbc->priv;
 95                             CMSetStatus(rc,CMPI_RC_OK);
 96                             if( row )
 97                             {
 98 ms.aruran      1.17             PEG_METHOD_EXIT();
 99 venkat.puvvada 1.16             return row->size();
100                             }
101 ms.aruran      1.17         PEG_METHOD_EXIT();
102 venkat.puvvada 1.16         return 0;
103                         }
104                     
105                         CMPIPredicate* sbcGetPredicateAt(const CMPISubCond* eSbc, 
106                         unsigned int index, CMPIStatus* rc)
107                         {
108 ms.aruran      1.17         PEG_METHOD_ENTER(
109                                 TRC_CMPIPROVIDERINTERFACE,
110                                 "CMPI_SubCond:sbcGetPredicateAt()");
111 venkat.puvvada 1.16         const CMPI_SubCond *sbc = (CMPI_SubCond*)eSbc->hdl;
112                             if( !sbc )
113                             {
114 ms.aruran      1.17             PEG_TRACE_CSTRING(
115                                     TRC_CMPIPROVIDERINTERFACE,
116 marek          1.18                 Tracer::LEVEL1,
117 ms.aruran      1.17                 "Invalid handle in CMPI_SubCond:sbcGetPredicateAt");
118 venkat.puvvada 1.16             CMSetStatus(rc, CMPI_RC_ERR_INVALID_HANDLE);
119 ms.aruran      1.17             PEG_METHOD_EXIT();
120 venkat.puvvada 1.16             return 0;
121                             }
122                             CMPI_TableauRow* row = (CMPI_TableauRow* )sbc->priv;
123                     
124                             if( row )
125                             {
126                                 if( index<=row->size() )
127                                 {
128                                     const CMPI_term_el *term=(row->getData())+index;
129                     
130                                     CMPIPredicate *prd=(CMPIPredicate*)new CMPI_Predicate(term);
131                                     /**
132                                        CMPI_Object puts in the hdl the pointer to the 
133                                        CMPI_Predicate The sbcRelease will use that pointer to 
134                                        de-allocate the CMPI_Predicate
135                                        structure.  
136                                      */
137                                     CMPI_Object *obj = new CMPI_Object(prd);
138                     
139                                     CMSetStatus(rc,CMPI_RC_OK);
140 ms.aruran      1.17                 CMPIPredicate* cmpiPredicate = 
141                                         reinterpret_cast<CMPIPredicate*>(obj);
142                                     PEG_METHOD_EXIT();
143                                     return cmpiPredicate;
144 venkat.puvvada 1.16             }
145                             }
146                             CMSetStatus(rc, CMPI_RC_ERR_NO_SUCH_PROPERTY);
147 ms.aruran      1.17         PEG_METHOD_EXIT();
148 venkat.puvvada 1.16         return NULL; 
149                         }
150                     
151                         CMPIPredicate* sbcGetPredicate(
152                         const CMPISubCond* eSbc,
153                         const char *name, CMPIStatus* rc)
154                         {
155                             /**
156                                CMPI_SubCond *sc=(CMPI_SubCond*)eSbc;
157                            */
158                             return NULL;
159                         }
160 schuur         1.1  
161                     }
162                     
163 venkat.puvvada 1.16 static CMPISubCondFT scnd_FT=
164                     {
165                         CMPICurrentVersion,
166                         sbcRelease,
167                         sbcClone,
168                         sbcGetCount,
169                         sbcGetPredicateAt,
170                         sbcGetPredicate
171                     };
172 schuur         1.1  
173                     CMPISubCondFT *CMPI_SubCond_Ftab=&scnd_FT;
174                     
175 konrad.r       1.10 CMPI_SubCond::CMPI_SubCond(const CMPI_TableauRow* tblor)
176 venkat.puvvada 1.16 : priv((void*)tblor) 
177                     {
178                         ft=CMPI_SubCond_Ftab;
179 schuur         1.1  }
180                     
181                     
182                     PEGASUS_NAMESPACE_END

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2