sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FBaseRtLibrary.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                FBaseRtLibrary.h
20  * @brief               This is the header file for the dynamic linking library class.
21  *
22  * This header file contains the declarations of the %Library (DLL) class.
23  */
24
25 #ifndef _FBASE_RT_LIBRARY_H_
26 #define _FBASE_RT_LIBRARY_H_
27
28 #include <FBaseResult.h>
29 #include <FBaseString.h>
30
31 namespace Tizen { namespace Base { namespace Runtime
32 {
33 /**
34  * @class Library
35  * @brief This is the class for shared library.
36  *
37  * @since 2.0
38  *
39  * @final This class is not intended for extension.
40  *
41  * The %Library class loads the shared library with the given file path.
42  * It loads the library in current process' memory space, and application can use this library explicitly.
43  */
44 class _OSP_EXPORT_ Library
45         : public Tizen::Base::Object
46 {
47 public:
48         /**
49          *      This is the default constructor for this class.
50          *
51          *  @since 2.0
52          */
53         Library(void);
54
55         /**
56          *      This is the destructor for this class.
57          *
58          *  @since 2.0
59          */
60         virtual ~Library(void);
61
62         /**
63          * Initializes this instance of %Library with the specified library path. @n
64          * Loads the library in the memory space of the current process.
65          *
66          * @since 2.0
67          *
68          * @return     An error code
69          * @param[in]  libraryPath   The path of the library file
70          * @exception   E_SUCCESS             The method is successful.
71          * @exception   E_LIBRARY_NOT_FOUND   The library cannot be found.
72          * @exception   E_INVALID_ARG         The specified @c libraryPath is an empty string.
73          * @exception   E_OUT_OF_MEMORY       The memory is insufficient.
74          * @exception   E_SYSTEM              A system error has occurred.
75          *
76          */
77         result Construct(const Tizen::Base::String& libraryPath);
78
79         /**
80          * Gets the address of the specified symbol from the specified dynamic linking library.
81          *
82          * @since 2.0
83          *
84          * @return             The address of the specified symbol
85          * @param[in] symbol    The symbol name
86          * @exception   E_SUCCESS              The method is successful.
87          * @exception   E_SYMBOL_NOT_FOUND     The symbol cannot be found.
88          * @exception   E_INVALID_ARG          The specified @c symbol is an empty string.
89          * @exception   E_OUT_OF_MEMORY        The memory is insufficient.
90          * @exception   E_SYSTEM               A system error has occurred.
91          *
92          */
93         void* GetProcAddress(const Tizen::Base::String& symbol) const;
94
95 private:
96         Library(const Library& rhs);
97         Library& operator =(const Library& rhs);
98
99 private:
100         friend class _LibraryImpl;
101         class _LibraryImpl * __pLibraryImpl;
102 }; // Library
103
104
105 } } } // Tizen::Runtime
106
107
108 #endif // _FBASE_RT_LIBRARY_H_