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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2