00001 00002 /* 00003 * 00004 * cmpisrv.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 * Contributors: 00017 * 00018 * Description: CMPI internal services header 00019 * 00020 */ 00021 00022 00023 #ifndef _CMPITHREADCONTEXT_H_ 00024 #define _CMPITHREADCONTEXT_H_ 00025 #include "OW_config.h" 00026 00027 #include <stdlib.h> 00028 #include <pthread.h> 00029 #include <iostream> 00030 00031 #include "cmpidt.h" 00032 #include "cmpift.h" 00033 #include "cmpisrv.h" 00034 00035 void initializeTheKey(); 00036 00037 class CMPI_ThreadContext { 00038 static pthread_key_t theKey; 00039 CMPI_ThreadContext* m_prev; 00040 CMPI_Object *CIMfirst,*CIMlast; 00041 00042 CMPIBroker * broker; 00043 CMPIContext * context; 00044 00045 void add(CMPI_Object *o); 00046 void remove(CMPI_Object *o); 00047 void setThreadContext(); 00048 void setContext(); 00049 00050 public: 00051 static void addObject(CMPI_Object*); 00052 static void remObject(CMPI_Object*); 00053 00054 static CMPI_ThreadContext* getThreadContext(); 00055 static CMPIBroker* getBroker(); 00056 static CMPIContext* getContext(); 00057 CMPI_ThreadContext(); 00058 CMPI_ThreadContext(CMPIBroker*,CMPIContext*); 00059 ~CMPI_ThreadContext(); 00060 00061 friend void initializeTheKey() 00062 { 00063 pthread_key_create(&CMPI_ThreadContext::theKey,NULL); 00064 } 00065 00066 }; 00067 00068 #endif