2 // Open Service Platform
3 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FIo_FileLockImpl.h
19 * @brief This is the header file for the %_FileLockImpl class.
21 * This header file contains the declarations of the %FileLockImpl class.
24 #ifndef _FIO_INTERNAL_FILE_LOCK_IMPL_H_
25 #define _FIO_INTERNAL_FILE_LOCK_IMPL_H_
27 #include <FBaseObject.h>
28 #include <FBaseInternalTypes.h>
29 #include <FOspConfig.h>
30 #include <FIoFileLock.h>
32 namespace Tizen { namespace Io
37 class _OSP_EXPORT_ _FileLockImpl
38 : public Tizen::Base::Object
44 virtual ~_FileLockImpl(void);
46 static _FileLockImpl* GetInstance(FileLock& fileLock);
48 static const _FileLockImpl* GetInstance(const FileLock& fileLock);
51 * Checks whether the file lock is shared.
55 * @return @c true if the file lock is shared, @n
58 bool IsShared(void) const;
61 * Checks whether the file lock is exclusive.
65 * @return @c true if the file lock is exclusive, @n
68 bool IsExclusive(void) const;
71 * Checks whether the file lock is valid. @n
72 * The lock is valid unless the associated %File has been closed.
76 * @return @c true if the file lock is valid, @n
79 bool IsValid(void) const;
82 // Constructs the instance of this class.
86 // @return An error code
87 // @param[in] pFile An instance of %File
88 // @param[in] lockType The type of file lock to be created
89 // @param[in] offset The starting offset for the locked region
90 // @param[in] size The size of the locked region in bytes
91 // @param[in] pid process id of the proccess aquiring this lock
92 // @exception E_SUCCESS The method is successful.
93 // @exception E_OUT_OF_MEMORY The memory is insufficient.
94 // @exception E_SYSTEM A system error has occurred.
96 result Construct(const _FileImpl* pFileImpl, FileLockType lockType, int offset, int size, int pid);
98 static FileLock* CreateFileLockInstanceN(const _FileImpl* pFileImpl, FileLockType lockType, int offset, int size, int pid);
102 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
104 _FileLockImpl(const _FileLockImpl& rhs);
107 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
109 _FileLockImpl& operator =(const _FileLockImpl& rhs);
111 _FileImpl* __pFileImpl;
112 FileLockType __lockType;
117 friend class _FileImpl;
123 #endif // _FIO_INTERNAL_FILE_LOCK_IMPL_H_