00001 00002 /* 00003 * 00004 * cmpiObject.cpp 00005 * 00006 * Copyright (c) 2002, International Business Machines 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 * 00017 * Contributor: Markus Mueller <sedgewick_de@yahoo.de> 00018 * 00019 * Description: Internal CMPI_Object support 00020 * CMPI_Object is the encapsualted type structure 00021 * 00022 */ 00023 00024 #include "cmpisrv.h" 00025 #include <string.h> 00026 00027 CMPI_Object::CMPI_Object(CMPI_Object *obj) 00028 : hdl(obj->hdl) 00029 , ftab(obj->ftab) 00030 , priv(0) 00031 { 00032 } 00033 00034 CMPI_Object::CMPI_Object(void* obj, void *fTab) 00035 { 00036 hdl=obj; 00037 ftab=fTab; 00038 priv = 0; 00039 } 00040 00041 CMPI_Object::CMPI_Object(OpenWBEM::CIMInstance* ci) { 00042 CMPI_ThreadContext::addObject(this); 00043 hdl=(void*)ci; 00044 ftab=CMPI_Instance_Ftab; 00045 priv = 0; 00046 } 00047 00048 CMPI_Object::CMPI_Object(OpenWBEM::CIMObjectPath* cop) { 00049 CMPI_ThreadContext::addObject(this); 00050 hdl=(void*)cop; 00051 ftab=CMPI_ObjectPath_Ftab; 00052 priv = 0; 00053 } 00054 00055 CMPI_Object::CMPI_Object(OpenWBEM::CIMDateTime* cdt) { 00056 CMPI_ThreadContext::addObject(this); 00057 hdl=(void*)cdt; 00058 ftab=CMPI_DateTime_Ftab; 00059 priv = 0; 00060 } 00061 00062 CMPI_Object::CMPI_Object(const OpenWBEM::String& str) { 00063 CMPI_ThreadContext::addObject(this); 00064 hdl=(void*)strdup(str.c_str()); 00065 ftab=CMPI_String_Ftab; 00066 priv = 0; 00067 } 00068 00069 CMPI_Object::CMPI_Object(char *str) { 00070 CMPI_ThreadContext::addObject(this); 00071 hdl=(void*)strdup((const char*)str); 00072 ftab=CMPI_String_Ftab; 00073 priv = 0; 00074 } 00075 00076 CMPI_Object::CMPI_Object(OpenWBEM::CIMParamValueArray *args) { 00077 CMPI_ThreadContext::addObject(this); 00078 hdl=(void*)args; 00079 ftab=CMPI_Args_Ftab; 00080 priv = 0; 00081 } 00082 00083 CMPI_Object::CMPI_Object(CMPIData *dta) { 00084 CMPI_ThreadContext::addObject(this); 00085 hdl=(void*)dta; 00086 ftab=CMPI_Array_Ftab; 00087 priv = 0; 00088 } 00089 00090 CMPI_Object::~CMPI_Object() { 00091 } 00092 00093 void CMPI_Object::unlinkAndDelete() { 00094 CMPI_ThreadContext::remObject(this); 00095 delete this; 00096 }