00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- 00002 * 00003 * XPLC - Cross-Platform Lightweight Components 00004 * Copyright (C) 2000-2003, Pierre Phaneuf 00005 * Copyright (C) 2002, Net Integration Technologies, Inc. 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public License 00009 * as published by the Free Software Foundation; either version 2.1 of 00010 * the License, or (at your option) any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, but 00013 * WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 * 00022 * As a special exception, you may use this file as part of a free 00023 * software library without restriction. Specifically, if other files 00024 * instantiate templates or use macros or inline functions from this 00025 * file, or you compile this file and link it with other files to 00026 * produce an executable, this file does not by itself cause the 00027 * resulting executable to be covered by the GNU Lesser General Public 00028 * License. This exception does not however invalidate any other 00029 * reasons why the executable file might be covered by the GNU Lesser 00030 * General Public License. 00031 */ 00032 00033 #ifndef __XPLC_XPLC_H__ 00034 #define __XPLC_XPLC_H__ 00035 00041 #include <xplc/core.h> 00042 #include <xplc/utils.h> 00043 #include <xplc/ptr.h> 00044 00051 class XPLC { 00052 private: 00053 xplc_ptr<IServiceManager> servmgr; 00054 public: 00055 XPLC(): servmgr(XPLC_getServiceManager()) {} 00060 XPLC(IServiceManager* _servmgr): servmgr(do_addRef(_servmgr)) {} 00061 00065 void addModuleDirectory(const char* directory); 00066 00071 IObject* get(const UUID& uuid) { 00072 return servmgr->getObject(uuid); 00073 } 00078 template<class Interface> 00079 Interface* get(const UUID& uuid) { 00080 return mutate<Interface>(servmgr->getObject(uuid)); 00081 } 00082 00088 IObject* create(const UUID& cid); 00093 template<class Interface> 00094 Interface* create(const UUID& cid) { 00095 return mutate<Interface>(create(cid)); 00096 } 00097 00103 IObject* create(const char*); 00108 template<class Interface> 00109 Interface* create(const char* aMoniker) { 00110 return mutate<Interface>(create(aMoniker)); 00111 } 00112 }; 00113 00114 #endif /* __XPLC_XPLC_H__ */