2 // Copyright (c) 2013 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file FIo_FileLockImpl.h
18 * @brief This is the header file for the %_FileLockImpl class.
20 * This header file contains the declarations of the %FileLockImpl class.
23 #ifndef _FIO_INTERNAL_FILE_LOCK_IMPL_H_
24 #define _FIO_INTERNAL_FILE_LOCK_IMPL_H_
26 #include <FBaseObject.h>
27 #include <FBaseInternalTypes.h>
28 #include <FOspConfig.h>
29 #include <FIoFileLock.h>
31 namespace Tizen { namespace Io
36 class _OSP_EXPORT_ _FileLockImpl
37 : public Tizen::Base::Object
43 virtual ~_FileLockImpl(void);
45 static _FileLockImpl* GetInstance(FileLock& fileLock);
47 static const _FileLockImpl* GetInstance(const FileLock& fileLock);
50 * Checks whether the file lock is shared.
54 * @return @c true if the file lock is shared, @n
57 bool IsShared(void) const;
60 * Checks whether the file lock is exclusive.
64 * @return @c true if the file lock is exclusive, @n
67 bool IsExclusive(void) const;
70 * Checks whether the file lock is valid. @n
71 * The lock is valid unless the associated %File has been closed.
75 * @return @c true if the file lock is valid, @n
78 bool IsValid(void) const;
81 // Constructs the instance of this class.
85 // @return An error code
86 // @param[in] pFile An instance of %File
87 // @param[in] lockType The type of file lock to be created
88 // @param[in] offset The starting offset for the locked region
89 // @param[in] size The size of the locked region in bytes
90 // @param[in] pid process id of the proccess aquiring this lock
91 // @exception E_SUCCESS The method is successful.
92 // @exception E_OUT_OF_MEMORY The memory is insufficient.
93 // @exception E_SYSTEM A system error has occurred.
95 result Construct(const _FileImpl* pFileImpl, FileLockType lockType, int offset, int size, int pid);
97 static FileLock* CreateFileLockInstanceN(const _FileImpl* pFileImpl, FileLockType lockType, int offset, int size, int pid);
101 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
103 _FileLockImpl(const _FileLockImpl& rhs);
106 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
108 _FileLockImpl& operator =(const _FileLockImpl& rhs);
110 _FileImpl* __pFileImpl;
111 FileLockType __lockType;
116 friend class _FileImpl;
122 #endif // _FIO_INTERNAL_FILE_LOCK_IMPL_H_