f7c66ac8e03749222306cb7eaa41e6908b615eed
[platform/framework/web/livebox-cpp.git] / include / CModule.h
1 /*
2  * Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 class CModule
18 {
19 private:
20         static const char *m_sModulePath;
21         static struct dlist *m_pModuleList;
22
23         void *m_pHandle;
24         void *(*m_fNew)(void);
25         char *m_sPkgname;
26         struct dlist *m_pList;
27         int (*m_fNeedToCreate)(const char *cluster, const char *category);
28         int (*m_fInitialize)(const char *pkgname);
29         int (*m_fFinalize)(void);
30
31         CModule(char *pkgname) : m_pHandle(NULL), m_fNew(NULL), m_sPkgname(pkgname), m_pList(NULL), m_fNeedToCreate(NULL), m_fInitialize(NULL), m_fFinalize(NULL) {}
32         virtual ~CModule() {}
33
34 public:
35         static CModule *FindModule(const char *pkgname);
36
37         static CModule *Load(const char *pkgname);
38         int Unload(void);
39
40         int Create(const char *filename, const char *content, const char *cluster, const char *category);
41         int NeedToCreate(const char *cluster, const char *category);
42         int Destroy(CLiveBoxImpl *inst);
43
44         CLiveBoxImpl *FindLiveBox(const char *filename);
45
46         const char *PackageName(void) { return m_sPkgname; }
47 };
48
49 /* End of a file */