From: Wolfgang T. <ta...@us...> - 2005-08-16 15:58:44
|
Update of /cvsroot/sblim/cmpi-dns/provider/CIM_CollectionOfMSEs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20455/provider/CIM_CollectionOfMSEs Added Files: CIM_CollectionOfMSEsInstance.h CIM_CollectionOfMSEsExternal.cpp CIM_CollectionOfMSEsInstance.cpp CIM_CollectionOfMSEsInstanceName.cpp CIM_CollectionOfMSEsExternal.h makefile CIM_CollectionOfMSEsInstanceName.h Log Message: WBEM-SMT DNS provider component. First initial upload. This module includes: - CIM model for DNS - CMPI provider for DNS - Resource Access layer for DNS --- NEW FILE: CIM_CollectionOfMSEsInstance.cpp --- /** * CIM_CollectionOfMSEsInstance.cpp * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://www.opensource.org/licenses/cpl1.0.php * * author: Murillo Bernardes <ber...@br...> * * Contributors: * */ #include "CIM_CollectionOfMSEsInstance.h" #include "CmpiData.h" #include "CmpiString.h" #include "CmpiArray.h" #include <string> namespace genProvider { //********************************************************* //CIM_CollectionOfMSEsInstance //********************************************************* //empty constructor CIM_CollectionOfMSEsInstance:: CIM_CollectionOfMSEsInstance(){ init(); }; //copy constructor CIM_CollectionOfMSEsInstance:: CIM_CollectionOfMSEsInstance (const CIM_CollectionOfMSEsInstance& original){ init(original); }; //constructor using CmpiInstance CIM_CollectionOfMSEsInstance:: CIM_CollectionOfMSEsInstance (const CmpiInstance& inst, const char* instanceNamespace){ CmpiData cmpiData; init(); CmpiObjectPath cop=inst.getObjectPath(); cop.setNameSpace(instanceNamespace); setInstanceName(CIM_CollectionOfMSEsInstanceName(cop)); cmpiData = inst.getProperty("Caption"); if(!cmpiData.isNullValue()){ CmpiString Caption = cmpiData; setCaption(Caption.charPtr()); } cmpiData = inst.getProperty("CollectionID"); if(!cmpiData.isNullValue()){ CmpiString CollectionID = cmpiData; setCollectionID(CollectionID.charPtr()); } cmpiData = inst.getProperty("Description"); if(!cmpiData.isNullValue()){ CmpiString Description = cmpiData; setDescription(Description.charPtr()); } cmpiData = inst.getProperty("ElementName"); if(!cmpiData.isNullValue()){ CmpiString ElementName = cmpiData; setElementName(ElementName.charPtr()); } } //Destructor CIM_CollectionOfMSEsInstance:: ~CIM_CollectionOfMSEsInstance(){ reset(); }; //copy operator CIM_CollectionOfMSEsInstance& CIM_CollectionOfMSEsInstance::operator= (const CIM_CollectionOfMSEsInstance& original){ init(original); return *this; }; //converts to CmpiInstance CmpiInstance CIM_CollectionOfMSEsInstance:: getCmpiInstance(const char** properties) const{ CmpiObjectPath objectPath=getInstanceName().getObjectPath(); CmpiInstance cmpiInstance(objectPath); getInstanceName().fillKeys(cmpiInstance); if (properties) { cmpiInstance.setPropertyFilter(properties,0); } if(isSet.Caption){ cmpiInstance.setProperty("Caption",CmpiData(m_Caption)); } if(isSet.CollectionID){ cmpiInstance.setProperty("CollectionID",CmpiData(m_CollectionID)); } if(isSet.Description){ cmpiInstance.setProperty("Description",CmpiData(m_Description)); } if(isSet.ElementName){ cmpiInstance.setProperty("ElementName",CmpiData(m_ElementName)); } return cmpiInstance; } //InstanceName related methods unsigned int CIM_CollectionOfMSEsInstance:: isInstanceNameSet() const{ return isSet.instanceName; } const CIM_CollectionOfMSEsInstanceName& CIM_CollectionOfMSEsInstance::getInstanceName() const{ if(!isSet.instanceName) throw CmpiErrorFormater::getErrorException( CmpiErrorFormater::NOT_SET, "InstanceName not set in CIM_CollectionOfMSEs instance"); return m_instanceName; } void CIM_CollectionOfMSEsInstance::setInstanceName( const CIM_CollectionOfMSEsInstanceName& val){ m_instanceName = val; isSet.instanceName=1; } //Caption related methods unsigned int CIM_CollectionOfMSEsInstance::isCaptionSet() const{ return isSet.Caption; } void CIM_CollectionOfMSEsInstance:: setCaption(const char* val, int makeCopy){ if (isSet.Caption) { delete []m_Caption; } if (makeCopy&&val) { char* tmpval = new char[strlen(val)+1]; strcpy(tmpval,val); m_Caption = tmpval; } else { m_Caption = val; } isSet.Caption=1; } const char* CIM_CollectionOfMSEsInstance:: getCaption() const{ if(!isSet.Caption) throw CmpiErrorFormater::getErrorException( CmpiErrorFormater::NOT_SET, "Caption not set"); return m_Caption; } //CollectionID related methods unsigned int CIM_CollectionOfMSEsInstance::isCollectionIDSet() const{ return isSet.CollectionID; } void CIM_CollectionOfMSEsInstance:: setCollectionID(const char* val, int makeCopy){ if (isSet.CollectionID) { delete []m_CollectionID; } if (makeCopy&&val) { char* tmpval = new char[strlen(val)+1]; strcpy(tmpval,val); m_CollectionID = tmpval; } else { m_CollectionID = val; } isSet.CollectionID=1; } const char* CIM_CollectionOfMSEsInstance:: getCollectionID() const{ if(!isSet.CollectionID) throw CmpiErrorFormater::getErrorException( CmpiErrorFormater::NOT_SET, "CollectionID not set"); return m_CollectionID; } //Description related methods unsigned int CIM_CollectionOfMSEsInstance::isDescriptionSet() const{ return isSet.Description; } void CIM_CollectionOfMSEsInstance:: setDescription(const char* val, int makeCopy){ if (isSet.Description) { delete []m_Description; } if (makeCopy&&val) { char* tmpval = new char[strlen(val)+1]; strcpy(tmpval,val); m_Description = tmpval; } else { m_Description = val; } isSet.Description=1; } const char* CIM_CollectionOfMSEsInstance:: getDescription() const{ if(!isSet.Description) throw CmpiErrorFormater::getErrorException( CmpiErrorFormater::NOT_SET, "Description not set"); return m_Description; } //ElementName related methods unsigned int CIM_CollectionOfMSEsInstance::isElementNameSet() const{ return isSet.ElementName; } void CIM_CollectionOfMSEsInstance:: setElementName(const char* val, int makeCopy){ if (isSet.ElementName) { delete []m_ElementName; } if (makeCopy&&val) { char* tmpval = new char[strlen(val)+1]; strcpy(tmpval,val); m_ElementName = tmpval; } else { m_ElementName = val; } isSet.ElementName=1; } const char* CIM_CollectionOfMSEsInstance:: getElementName() const{ if(!isSet.ElementName) throw CmpiErrorFormater::getErrorException( CmpiErrorFormater::NOT_SET, "ElementName not set"); return m_ElementName; } //set isSet attributes to FALSE void CIM_CollectionOfMSEsInstance::init(){ isSet.instanceName=0; isSet.Caption=0; isSet.CollectionID=0; isSet.Description=0; isSet.ElementName=0; }; //copies another instance properties in this void CIM_CollectionOfMSEsInstance::init (const CIM_CollectionOfMSEsInstance& original){ init(); if(original.isInstanceNameSet()){ setInstanceName(original.getInstanceName()); } if(original.isCaptionSet()){ const char* CaptionOriginal=original.getCaption(); setCaption(CaptionOriginal, 1); } if(original.isCollectionIDSet()){ const char* CollectionIDOriginal=original.getCollectionID(); setCollectionID(CollectionIDOriginal, 1); } if(original.isDescriptionSet()){ const char* DescriptionOriginal=original.getDescription(); setDescription(DescriptionOriginal, 1); } if(original.isElementNameSet()){ const char* ElementNameOriginal=original.getElementName(); setElementName(ElementNameOriginal, 1); } } //reset the instance data void CIM_CollectionOfMSEsInstance::reset(){ if (isSet.Caption) delete(m_Caption); if (isSet.CollectionID) delete(m_CollectionID); if (isSet.Description) delete(m_Description); if (isSet.ElementName) delete(m_ElementName); }; //********************************************************* //CIM_CollectionOfMSEsInstanceEnumerationElement //********************************************************* CIM_CollectionOfMSEsInstanceEnumerationElement:: CIM_CollectionOfMSEsInstanceEnumerationElement(){ m_elementP=0; m_nextP=0; }; CIM_CollectionOfMSEsInstanceEnumerationElement:: ~CIM_CollectionOfMSEsInstanceEnumerationElement(){ if (m_elementP!=0) delete(m_elementP); if (m_nextP!=0) delete(m_nextP); }; //********************************************************* //CIM_CollectionOfMSEsInstanceNameEnumeration //********************************************************* CIM_CollectionOfMSEsInstanceEnumeration:: CIM_CollectionOfMSEsInstanceEnumeration(){ firstElementP=0; currentElementP=0; endElementP=0; }; CIM_CollectionOfMSEsInstanceEnumeration:: CIM_CollectionOfMSEsInstanceEnumeration( const CIM_CollectionOfMSEsInstanceEnumeration& original){ firstElementP=0; currentElementP=0; endElementP=0; int size=original.getSize(); for(int i=0;i<size;i++) addElement(original.getElement(i)); }; CIM_CollectionOfMSEsInstanceEnumeration:: ~CIM_CollectionOfMSEsInstanceEnumeration(){ if (firstElementP!=0) delete(firstElementP); }; void CIM_CollectionOfMSEsInstanceEnumeration::reset(){ currentElementP=firstElementP; }; bool CIM_CollectionOfMSEsInstanceEnumeration::hasNext() const{ return (currentElementP!=0); }; int CIM_CollectionOfMSEsInstanceEnumeration::getSize() const{ int size=0; CIM_CollectionOfMSEsInstanceEnumerationElement* followingP=firstElementP; while(followingP!=0){ followingP=followingP->m_nextP; size++; } return size; }; const CIM_CollectionOfMSEsInstance& CIM_CollectionOfMSEsInstanceEnumeration::getElement(int pos) const{ CIM_CollectionOfMSEsInstanceEnumerationElement* followingP=firstElementP; int i=0; while((followingP!=0)&&(i<pos)){ followingP=followingP->m_nextP; i++; } return *(followingP->m_elementP); }; const CIM_CollectionOfMSEsInstance& CIM_CollectionOfMSEsInstanceEnumeration::getNext() { CIM_CollectionOfMSEsInstanceEnumerationElement* currentP= currentElementP; currentElementP=currentElementP->m_nextP; return *(currentP->m_elementP); }; void CIM_CollectionOfMSEsInstanceEnumeration::addElement (const CIM_CollectionOfMSEsInstance& elementP){ if(firstElementP==0){ firstElementP=new CIM_CollectionOfMSEsInstanceEnumerationElement(); firstElementP->m_elementP=new CIM_CollectionOfMSEsInstance(elementP); endElementP=firstElementP; currentElementP=firstElementP; }else{ endElementP->m_nextP=new CIM_CollectionOfMSEsInstanceEnumerationElement(); endElementP=endElementP->m_nextP; endElementP->m_elementP=new CIM_CollectionOfMSEsInstance(elementP); } }; } --- NEW FILE: CIM_CollectionOfMSEsInstanceName.cpp --- /** * CIM_CollectionOfMSEsInstanceName.cpp * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://www.opensource.org/licenses/cpl1.0.php * * author: Murillo Bernardes <ber...@br...> * * Contributors: * */ #include "CIM_CollectionOfMSEsInstanceName.h" #include "CmpiData.h" #include "CmpiString.h" #include "CmpiArray.h" #include <string> namespace genProvider { //********************************************************* //CIM_CollectionOfMSEsInstanceName //********************************************************* //empty constructor CIM_CollectionOfMSEsInstanceName:: CIM_CollectionOfMSEsInstanceName(){ init(); }; //copy constructor CIM_CollectionOfMSEsInstanceName:: CIM_CollectionOfMSEsInstanceName (const CIM_CollectionOfMSEsInstanceName& original){ init(original); }; //contructor using CmpiObjectPath CIM_CollectionOfMSEsInstanceName:: CIM_CollectionOfMSEsInstanceName (const CmpiObjectPath& path){ init(); m_CIMClassNameP=path.getClassName().charPtr(); CmpiString namespaceOP; namespaceOP=path.getNameSpace(); setNamespace(namespaceOP.charPtr(),1); } //destructor CIM_CollectionOfMSEsInstanceName:: ~CIM_CollectionOfMSEsInstanceName(){ reset(); }; //copy operator CIM_CollectionOfMSEsInstanceName& CIM_CollectionOfMSEsInstanceName::operator= (const CIM_CollectionOfMSEsInstanceName& original){ init(original); return *this; } //returns the related CmpiObjectPath CmpiObjectPath CIM_CollectionOfMSEsInstanceName:: getObjectPath() const{ CmpiObjectPath objectPath(m_namespace, m_CIMClassNameP); return objectPath; } //adds the related CmpiObjectPath to an existing cmpiInstance void CIM_CollectionOfMSEsInstanceName::fillKeys(CmpiInstance& cmpiInstance) const{ } //NameSpace related methods unsigned int CIM_CollectionOfMSEsInstanceName:: isNameSpaceSet() const{ return isSet.m_namespace; } const char * CIM_CollectionOfMSEsInstanceName:: getNamespace() const { if(!isSet.m_namespace) throw CmpiErrorFormater::getErrorException( CmpiErrorFormater::NOT_SET, "NameSpace not set in CIM_CollectionOfMSEs instanceName"); return m_namespace; } void CIM_CollectionOfMSEsInstanceName:: setNamespace(const char* val, int makeCopy){ if (isSet.m_namespace) { delete m_namespace; } if (makeCopy&&val) { char* tmpval = new char[strlen(val)+1]; strcpy(tmpval,val); m_namespace = tmpval; } else { m_namespace = val; } isSet.m_namespace=1; } //set isSet variables to FALSE void CIM_CollectionOfMSEsInstanceName::init(){ m_CIMClassNameP="CIM_CollectionOfMSEs"; isSet.m_namespace=0; } //copies another instance properties in this void CIM_CollectionOfMSEsInstanceName::init (const CIM_CollectionOfMSEsInstanceName& original){ init(); m_CIMClassNameP=original.m_CIMClassNameP; if(original.isNameSpaceSet()){ setNamespace(original.getNamespace(),1); } } //reset the instanceName data void CIM_CollectionOfMSEsInstanceName::reset(){ if (isSet.m_namespace) delete(m_namespace); }; //********************************************************* //CIM_CollectionOfMSEsInstanceNameEnumerationElement //********************************************************* CIM_CollectionOfMSEsInstanceNameEnumerationElement:: CIM_CollectionOfMSEsInstanceNameEnumerationElement(){ m_elementP=0; m_nextP=0; }; CIM_CollectionOfMSEsInstanceNameEnumerationElement:: ~CIM_CollectionOfMSEsInstanceNameEnumerationElement(){ if (m_elementP!=0) delete(m_elementP); if (m_nextP!=0) delete(m_nextP); }; //********************************************************* //CIM_CollectionOfMSEsInstanceNameEnumeration //********************************************************* CIM_CollectionOfMSEsInstanceNameEnumeration:: CIM_CollectionOfMSEsInstanceNameEnumeration(){ firstElementP=0; currentElementP=0; endElementP=0; }; CIM_CollectionOfMSEsInstanceNameEnumeration:: CIM_CollectionOfMSEsInstanceNameEnumeration(const CmpiArray& arr){ firstElementP=0; currentElementP=0; endElementP=0; int size = arr.size(); for (int i=0; i < size; i++) { addElement(CIM_CollectionOfMSEsInstanceName(arr[i])); } } CIM_CollectionOfMSEsInstanceNameEnumeration:: CIM_CollectionOfMSEsInstanceNameEnumeration( const CIM_CollectionOfMSEsInstanceNameEnumeration& original){ firstElementP=0; currentElementP=0; endElementP=0; int size=original.getSize(); for(int i=0;i<size;i++) addElement(original.getElement(i)); }; CIM_CollectionOfMSEsInstanceNameEnumeration:: ~CIM_CollectionOfMSEsInstanceNameEnumeration(){ if (firstElementP!=0) delete(firstElementP); }; void CIM_CollectionOfMSEsInstanceNameEnumeration::reset(){ currentElementP=firstElementP; }; bool CIM_CollectionOfMSEsInstanceNameEnumeration::hasNext() const{ return (currentElementP!=0); }; int CIM_CollectionOfMSEsInstanceNameEnumeration::getSize() const{ int size=0; CIM_CollectionOfMSEsInstanceNameEnumerationElement* followingP=firstElementP; while(followingP!=0){ followingP=followingP->m_nextP; size++; } return size; }; const CIM_CollectionOfMSEsInstanceName& CIM_CollectionOfMSEsInstanceNameEnumeration::getElement(int pos) const{ CIM_CollectionOfMSEsInstanceNameEnumerationElement* followingP=firstElementP; int i=0; while((followingP!=0)&&(i<pos)){ followingP=followingP->m_nextP; i++; } return *(followingP->m_elementP); }; const CIM_CollectionOfMSEsInstanceName& CIM_CollectionOfMSEsInstanceNameEnumeration::getNext() { CIM_CollectionOfMSEsInstanceNameEnumerationElement* currentP= currentElementP; currentElementP=currentElementP->m_nextP; return *(currentP->m_elementP); }; void CIM_CollectionOfMSEsInstanceNameEnumeration::addElement (const CIM_CollectionOfMSEsInstanceName& elementP){ if(firstElementP==0){ firstElementP=new CIM_CollectionOfMSEsInstanceNameEnumerationElement(); firstElementP->m_elementP=new CIM_CollectionOfMSEsInstanceName(elementP); endElementP=firstElementP; currentElementP=firstElementP; }else{ endElementP->m_nextP=new CIM_CollectionOfMSEsInstanceNameEnumerationElement(); endElementP=endElementP->m_nextP; endElementP->m_elementP=new CIM_CollectionOfMSEsInstanceName(elementP); } }; CIM_CollectionOfMSEsInstanceNameEnumeration::operator CmpiArray() const{ int size=getSize(); CmpiArray arr=CmpiArray(size,CMPI_instance); for(int i=0;i<size;i++){ arr[i]=getElement(i).getObjectPath(); } return arr; }; } --- NEW FILE: makefile --- include ../setting.cmpi CPPFLAGS=-I. -I$(CIMOMINC) -I$(COMMONINC) -I$(CIMOMINC)/cpp -D_COMPILE_UNIX -DCMPI_STANDALONE CXXFLAGS=-Wall -g -fPIC -fno-implicit-templates LDFLAGS=-L. -L$(COMMONLIB) -L$(COMMONLIB_OUT) -shared -lcmpiCppImpl -lIBM_ProviderTooling OBJECTS=CIM_CollectionOfMSEsInstanceName.o \ CIM_CollectionOfMSEsInstance.o \ CIM_CollectionOfMSEsExternal.o all: clean testfiles prelink install #------------------------------------------------------------------------------# compile: $(OBJECTS) prelink: libCIM_CollectionOfMSEsSupport.so libCIM_CollectionOfMSEsSupport.so: $(OBJECTS) $(LINK.cpp) -o $@ $^ link: #nothing to here #------------------------------------------------------------------------------# preinstall: prelink install libCIM_CollectionOfMSEsSupport.so $(COMMONLIB_OUT) #------------------------------------------------------------------------------# install: link install libCIM_CollectionOfMSEsSupport.so $(COMMONLIB_OUT) # install -m 644 CIM_CollectionOfMSEs*.h $(COMMONINC) $(MAKE) -C mof -f $(MOFMAKEFILE) install #------------------------------------------------------------------------------# testfiles: @[ -d $(CIMOMLIB) ] || ( echo directory $(CIMOMLIB) does not exist && false) @[ -d $(CIMOMINC) ] || ( echo directory $(CIMOMINC) does not exist - please create manually && false) @[ -d $(CIMOMMOF) ] || ( echo directory $(CIMOMMOF) does not exist - please create manually && false) @[ -d $(COMMONINC) ] || ( echo directory $(COMMONINC) does not exist - please create manually && false) @[ -d $(COMMONLIB) ] || ( echo directory $(COMMONLIB) does not exist - please create manually && false) #------------------------------------------------------------------------------# clean: $(RM) *.so *.o *~ #------------------------------------------------------------------------------# uninstall: $(MAKE) -C mof -f $(MOFMAKEFILE) uninstall; # $(RM) $(COMMONINC)/CIM_CollectionOfMSEs*.h \ $(RM) $(COMMONLIB)/libCIM_CollectionOfMSEsSupport.so --- NEW FILE: CIM_CollectionOfMSEsExternal.h --- /** * CIM_CollectionOfMSEsExternal.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://www.opensource.org/licenses/cpl1.0.php * * author: Murillo Bernardes <ber...@br...> * * Contributors: * */ #ifndef CIM_CollectionOfMSEsExternal_h #define CIM_CollectionOfMSEsExternal_h #include "CIM_CollectionOfMSEsInstance.h" #include "CmpiBroker.h" namespace genProvider { class CIM_CollectionOfMSEsExternal { public: CIM_CollectionOfMSEsExternal( const CmpiBroker& brkr, const CmpiContext& ctx); virtual ~CIM_CollectionOfMSEsExternal(); virtual void enumInstanceNames( const char *nsp, CIM_CollectionOfMSEsInstanceNameEnumeration&); virtual void enumInstances( const char *nsp, const char* *properties, CIM_CollectionOfMSEsInstanceEnumeration&); virtual CIM_CollectionOfMSEsInstance getInstance( const char* *properties, const CIM_CollectionOfMSEsInstanceName&); virtual void setInstance( const char* *properties, const CIM_CollectionOfMSEsInstance&); virtual void createInstance( const CIM_CollectionOfMSEsInstance&); virtual void deleteInstance( const CIM_CollectionOfMSEsInstanceName&); private: CmpiBroker broker; CmpiContext context; }; } #endif --- NEW FILE: CIM_CollectionOfMSEsInstanceName.h --- /** * CIM_CollectionOfMSEsInstanceName.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://www.opensource.org/licenses/cpl1.0.php * * author: Murillo Bernardes <ber...@br...> * * Contributors: * */ #ifndef CIM_CollectionOfMSEsInstanceName_h #define CIM_CollectionOfMSEsInstanceName_h #include "cmpidt.h" #include "CmpiObjectPath.h" #include "CmpiInstance.h" #include "CmpiBooleanData.h" #include "CmpiCharData.h" #include "CmpiDateTime.h" #include "ArrayConverter.h" #include "CmpiErrorFormater.h" namespace genProvider { class CIM_CollectionOfMSEsInstanceName { public: CIM_CollectionOfMSEsInstanceName(); CIM_CollectionOfMSEsInstanceName (const CIM_CollectionOfMSEsInstanceName& original); CIM_CollectionOfMSEsInstanceName (const CmpiObjectPath& path); ~CIM_CollectionOfMSEsInstanceName(); CIM_CollectionOfMSEsInstanceName& operator= (const CIM_CollectionOfMSEsInstanceName& original); CmpiObjectPath getObjectPath() const; void fillKeys(CmpiInstance& cmpiInstance) const; unsigned int isNameSpaceSet() const; void setNamespace(const char * val, int makeCopy = 1); const char * getNamespace() const; private: void init(); void init(const CIM_CollectionOfMSEsInstanceName& original); void reset(); const char* m_CIMClassNameP; const char* m_namespace; struct isSetType{ unsigned int m_namespace:1; } isSet; }; struct CIM_CollectionOfMSEsInstanceNameEnumerationElement{ CIM_CollectionOfMSEsInstanceName* m_elementP; CIM_CollectionOfMSEsInstanceNameEnumerationElement* m_nextP; CIM_CollectionOfMSEsInstanceNameEnumerationElement(); ~CIM_CollectionOfMSEsInstanceNameEnumerationElement(); }; class CIM_CollectionOfMSEsInstanceNameEnumeration { private: CIM_CollectionOfMSEsInstanceNameEnumerationElement* firstElementP; CIM_CollectionOfMSEsInstanceNameEnumerationElement* currentElementP; CIM_CollectionOfMSEsInstanceNameEnumerationElement* endElementP; public: CIM_CollectionOfMSEsInstanceNameEnumeration(); CIM_CollectionOfMSEsInstanceNameEnumeration(const CmpiArray& arr); CIM_CollectionOfMSEsInstanceNameEnumeration( const CIM_CollectionOfMSEsInstanceNameEnumeration& original); ~CIM_CollectionOfMSEsInstanceNameEnumeration(); void reset(); bool hasNext() const; const CIM_CollectionOfMSEsInstanceName& getNext(); int getSize() const; const CIM_CollectionOfMSEsInstanceName& getElement(int pos) const; //no copy of the element is done void addElement(const CIM_CollectionOfMSEsInstanceName& elementP); operator CmpiArray() const; }; } #endif --- NEW FILE: CIM_CollectionOfMSEsInstance.h --- /** * CIM_CollectionOfMSEsInstance.h * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://www.opensource.org/licenses/cpl1.0.php * * author: Murillo Bernardes <ber...@br...> * * Contributors: * */ #ifndef CIM_CollectionOfMSEsInstance_h #define CIM_CollectionOfMSEsInstance_h #include "cmpidt.h" #include "CmpiObjectPath.h" #include "CmpiInstance.h" #include "CmpiBooleanData.h" #include "CmpiCharData.h" #include "CmpiDateTime.h" #include "CIM_CollectionOfMSEsInstanceName.h" namespace genProvider { class CIM_CollectionOfMSEsInstance { public: CIM_CollectionOfMSEsInstance(); CIM_CollectionOfMSEsInstance (const CIM_CollectionOfMSEsInstance& original); CIM_CollectionOfMSEsInstance (const CmpiInstance& inst, const char* instanceNamespace); ~CIM_CollectionOfMSEsInstance(); CIM_CollectionOfMSEsInstance& operator= (const CIM_CollectionOfMSEsInstance& original); CmpiInstance getCmpiInstance(const char** properties=0) const; unsigned int isInstanceNameSet() const; void setInstanceName( const CIM_CollectionOfMSEsInstanceName& val); const CIM_CollectionOfMSEsInstanceName& getInstanceName() const; unsigned int isCaptionSet() const; void setCaption(const char* val, int makeCopy = 1); const char* getCaption() const; unsigned int isCollectionIDSet() const; void setCollectionID(const char* val, int makeCopy = 1); const char* getCollectionID() const; unsigned int isDescriptionSet() const; void setDescription(const char* val, int makeCopy = 1); const char* getDescription() const; unsigned int isElementNameSet() const; void setElementName(const char* val, int makeCopy = 1); const char* getElementName() const; private: void init(); void init(const CIM_CollectionOfMSEsInstance& original); void reset(); CIM_CollectionOfMSEsInstanceName m_instanceName; const char* m_Caption; const char* m_CollectionID; const char* m_Description; const char* m_ElementName; struct isSetType{ unsigned int instanceName:1; unsigned int Caption:1; unsigned int CollectionID:1; unsigned int Description:1; unsigned int ElementName:1; } isSet; }; struct CIM_CollectionOfMSEsInstanceEnumerationElement{ CIM_CollectionOfMSEsInstance* m_elementP; CIM_CollectionOfMSEsInstanceEnumerationElement* m_nextP; CIM_CollectionOfMSEsInstanceEnumerationElement(); ~CIM_CollectionOfMSEsInstanceEnumerationElement(); }; class CIM_CollectionOfMSEsInstanceEnumeration { private: CIM_CollectionOfMSEsInstanceEnumerationElement* firstElementP; CIM_CollectionOfMSEsInstanceEnumerationElement* currentElementP; CIM_CollectionOfMSEsInstanceEnumerationElement* endElementP; public: CIM_CollectionOfMSEsInstanceEnumeration(); CIM_CollectionOfMSEsInstanceEnumeration( const CIM_CollectionOfMSEsInstanceEnumeration& original); ~CIM_CollectionOfMSEsInstanceEnumeration(); void reset(); bool hasNext() const; const CIM_CollectionOfMSEsInstance& getNext(); int getSize() const; const CIM_CollectionOfMSEsInstance& getElement(int pos) const; void addElement(const CIM_CollectionOfMSEsInstance& elementP); }; } #endif --- NEW FILE: CIM_CollectionOfMSEsExternal.cpp --- /** * CIM_CollectionOfMSEsExternal.cpp * * (C) Copyright IBM Corp. 2005 * * THIS FILE IS PROVIDED UNDER THE TERMS OF THE COMMON PUBLIC LICENSE * ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE * CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT. * * You can obtain a current copy of the Common Public License from * http://www.opensource.org/licenses/cpl1.0.php * * author: Murillo Bernardes <ber...@br...> * * Contributors: * */ #include "CIM_CollectionOfMSEsExternal.h" namespace genProvider{ CIM_CollectionOfMSEsExternal::CIM_CollectionOfMSEsExternal( const CmpiBroker& brkr, const CmpiContext& ctx ) : broker(brkr), context(ctx) {}; CIM_CollectionOfMSEsExternal:: ~CIM_CollectionOfMSEsExternal(){}; void CIM_CollectionOfMSEsExternal::enumInstanceNames( const char *nsp, CIM_CollectionOfMSEsInstanceNameEnumeration& instnames) { CmpiObjectPath op(nsp,"CIM_CollectionOfMSEs"); CmpiEnumeration en=broker.enumInstanceNames(context,op); while(en.hasNext()) { CmpiObjectPath opi = en.getNext(); CIM_CollectionOfMSEsInstanceName iname(opi); instnames.addElement(iname); } }; void CIM_CollectionOfMSEsExternal::enumInstances( const char *nsp, const char* *properties, CIM_CollectionOfMSEsInstanceEnumeration& instances) { CmpiObjectPath op(nsp,"CIM_CollectionOfMSEs"); CmpiEnumeration en=broker.enumInstances(context,op,properties); while(en.hasNext()) { CmpiInstance inst = en.getNext(); CIM_CollectionOfMSEsInstance instance(inst,nsp); instances.addElement(instance); } }; CIM_CollectionOfMSEsInstance CIM_CollectionOfMSEsExternal::getInstance( const char* *properties, const CIM_CollectionOfMSEsInstanceName& instanceName) { CmpiObjectPath op=instanceName.getObjectPath(); CmpiInstance inst=broker.getInstance(context,op,properties); return CIM_CollectionOfMSEsInstance(inst,instanceName.getNamespace()); } void CIM_CollectionOfMSEsExternal::setInstance( const char* *properties, const CIM_CollectionOfMSEsInstance& instance){ CmpiObjectPath op=instance.getInstanceName().getObjectPath(); CmpiInstance inst=instance.getCmpiInstance(); broker.setInstance(context,op,inst,properties); } void CIM_CollectionOfMSEsExternal::createInstance( const CIM_CollectionOfMSEsInstance& instance){ CmpiObjectPath op=instance.getInstanceName().getObjectPath(); CmpiInstance inst=instance.getCmpiInstance(); broker.createInstance(context,op,inst); } void CIM_CollectionOfMSEsExternal::deleteInstance( const CIM_CollectionOfMSEsInstanceName& instanceName){ CmpiObjectPath op=instanceName.getObjectPath(); broker.deleteInstance(context,op); } } |