00001 00002 /* 00003 * 00004 * CmpiProviderBase.h 00005 * 00006 * (C) Copyright IBM Corp. 2003 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 C++ Provider Base class 00019 * This class must be instatiated once per C++ CMPI style provider. 00020 * It maintains the broker and oneTime variables on a per provider 00021 * basis and allows CmpiImpl to be used as a DLL. 00022 * Use the CMProviderBase macro instantiate this class and the 00023 * static variables. 00024 * 00025 */ 00026 00027 #ifndef _CmpiProviderBase_h_ 00028 #define _CmpiProviderBase_h_ 00029 00030 #include "OW_config.h" 00031 00032 #include "cmpidt.h" 00033 00034 class CmpiProviderBase; 00035 00036 class CmpiProviderBase { 00037 static CmpiProviderBase *base; 00038 CMPIBroker *broker; 00039 int oneTime; 00040 public: 00041 static CMPIBroker *getBroker() { 00042 return base->broker; 00043 } 00044 static void setBroker(CMPIBroker *mb) { 00045 base->broker=mb; 00046 } 00047 static int testAndSetOneTime(int t) { 00048 if (base->oneTime&t) return 0; 00049 base->oneTime|=t; 00050 return 1; 00051 } 00052 CmpiProviderBase() { 00053 base=this; 00054 broker=NULL; 00055 oneTime=0; 00056 } 00057 }; 00058 00059 #endif 00060 00061