00001 // -*- c++ -*- 00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00003 00004 // Oscl Registry Serv Impl 00005 00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00007 00019 #ifndef OSCL_REGISTRY_SERV_IMPL_H_INCLUDED 00020 #define OSCL_REGISTRY_SERV_IMPL_H_INCLUDED 00021 00022 #include "oscl_base.h" 00023 #include "osclconfig_proc.h" 00024 00025 #include "oscl_registry_types.h" 00026 00031 #include "oscl_string.h" 00032 #include "oscl_vector.h" 00033 #include "oscl_mem.h" 00034 00038 class OsclComponentRegistryElement 00039 { 00040 public: 00041 OsclComponentRegistryElement(OSCL_String&, OsclComponentFactory); 00042 OsclComponentRegistryElement(const OsclComponentRegistryElement&); 00043 OsclComponentRegistryElement& operator=(const OsclComponentRegistryElement& src); 00044 ~OsclComponentRegistryElement(); 00045 00046 bool Match(OSCL_String& aStr, bool aExact); 00047 00048 OSCL_String* iId;//use a pointer here instead of a container for efficiency 00049 //since this element is used in an oscl vector. 00050 OsclComponentFactory iFactory; 00051 uint32 iComponentId; 00052 }; 00053 00054 00058 class OsclComponentRegistryData 00059 { 00060 public: 00061 OsclComponentRegistryElement* Find(OSCL_String&, bool aExact); 00062 Oscl_Vector<OsclComponentRegistryElement, OsclMemAllocator> iVec; 00063 }; 00064 00068 #include "oscl_mutex.h" 00069 class OsclComponentRegistry 00070 { 00071 public: 00072 OsclComponentRegistry(); 00073 ~OsclComponentRegistry(); 00074 int32 Register(uint32& aId, OSCL_String&, OsclComponentFactory); 00075 int32 Unregister(OSCL_String&); 00076 int32 Unregister(uint32); 00077 OsclComponentFactory FindExact(OSCL_String&); 00078 void FindHierarchical(OSCL_String& , Oscl_Vector<OsclRegistryAccessElement, OsclMemAllocator>&); 00079 void OpenSession(); 00080 void CloseSession(); 00081 00082 OsclComponentRegistryData iData; 00083 OsclMutex iMutex; 00084 00085 uint32 iComponentIdCounter; 00086 00087 uint32 iNumSessions; 00088 }; 00089 00090 00091 #endif //OSCL_REGISTRY_IMPL_H_INCLUDED 00092