[3.0] Change FBase_String.h to FBaseUtil_AtomicOperations.h
authordahyeong.kim <dahyeong.kim@samsung.com>
Wed, 31 Jul 2013 07:14:34 +0000 (16:14 +0900)
committerdahyeong.kim <dahyeong.kim@samsung.com>
Wed, 31 Jul 2013 12:11:35 +0000 (21:11 +0900)
Change-Id: I6a3b11ac3b9d8a989a5752e3e6479071bc1be071
Signed-off-by: dahyeong.kim <dahyeong.kim@samsung.com>
src/base/FBaseString.cpp
src/base/inc/FBaseUtil_AtomicOperations.h [moved from src/base/inc/FBase_String.h with 60% similarity]

index 0e40454..bf69291 100644 (file)
@@ -36,7 +36,7 @@
 #include <FBaseResult.h>
 #include <FBaseSysLog.h>
 #include <unique_ptr.h>
-#include "FBase_String.h"
+#include "FBaseUtil_AtomicOperations.h"
 #include "FBaseUtil_IcuConverter.h"
 
 namespace Tizen { namespace Base
@@ -154,7 +154,7 @@ String::String(const String& value)
 {
        if (*(value.__pRefCount) != UNSHAREABLE)
        {
-               _String::AtomicInc(value.__pRefCount);
+               Utility::_AtomicOperations::AtomicInc(value.__pRefCount);
                __pRefCount = value.__pRefCount;
                __pValue = value.__pValue;
                __capacity = value.__capacity;
@@ -183,7 +183,7 @@ String::~String(void)
        }
        else
        {
-               _String::AtomicDec(__pRefCount);
+               Utility::_AtomicOperations::AtomicDec(__pRefCount);
                __pRefCount = null;
        }
 }
@@ -387,7 +387,7 @@ String::Append(const wchar_t* p)
                SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed");
 
                wcsncpy(__pValue, pValue, __length);
-               _String::AtomicDec(__pRefCount);
+               Utility::_AtomicOperations::AtomicDec(__pRefCount);
                __pRefCount = pRefCntTemp.release();
        }
 
@@ -1035,7 +1035,7 @@ String::SetCapacity(int capacity)
                {
                        std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
                        SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed");
-                       _String::AtomicDec(__pRefCount);
+                       Utility::_AtomicOperations::AtomicDec(__pRefCount);
                        __pRefCount = pRefCntTemp.release();
                }
        }
@@ -1484,7 +1484,7 @@ String::ExpandCapacity(int minCapacity)
                        std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
                        SysTryReturn(NID_BASE, pRefCntTemp != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed",
                                GetErrorMessage(E_OUT_OF_MEMORY));
-                       _String::AtomicDec(__pRefCount);
+                       Utility::_AtomicOperations::AtomicDec(__pRefCount);
                        __pRefCount = pRefCntTemp.release();
                }
        }
@@ -1519,7 +1519,7 @@ String::AboutToModify(int capacity, bool isUnshareable)
                wcsncpy(__pValue, pValue, __length);
                __pValue[__length] = '\0';
 
-               _String::AtomicDec(__pRefCount);
+               Utility::_AtomicOperations::AtomicDec(__pRefCount);
                __pRefCount = pRefCntTemp.release();
        }
 
similarity index 60%
rename from src/base/inc/FBase_String.h
rename to src/base/inc/FBaseUtil_AtomicOperations.h
index 3012767..d2dbc77 100644 (file)
@@ -1,5 +1,5 @@
 //
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+// Copyright (c) 2013 Samsung Electronics Co., Ltd.
 //
 // Licensed under the Apache License, Version 2.0 (the License);
 // you may not use this file except in compliance with the License.
 //
 
 /**
- * @file               FBase_String.h
+ * @file               FBaseUtil_AtomicOperations.h
  * @brief              This is the header file for handling atomic operations.
  */
-#ifndef _FBASE_INTERNAL_STRING_H_
-#define _FBASE_INTERNAL_STRING_H_
+#ifndef _FBASE_UTIL_ATOMIC_OPERATIONS_H_
+#define _FBASE_UTIL_ATOMIC_OPERATIONS_H_
 
-namespace Tizen { namespace Base
+namespace Tizen { namespace Base { namespace Utility
 {
-namespace _String
+namespace _AtomicOperations
 {
 
 /**
- * Atomically add the value to the variable that pRefCount points to.
+ * Atomically add the @c value to the variable that @c pRefCount points to.
  *
- * @since 2.1
+ * @since      2.1
+ * @remarks    This method supposes 4 byte alignment in ARM architecture.
  */
 inline int
 AtomicAdd(volatile int* pRefCount, int value)
@@ -53,9 +54,10 @@ AtomicAdd(volatile int* pRefCount, int value)
 }
 
 /**
- * Atomically increase the variable that pRefCount points to by 1
+ * Atomically increase the variable that @c pRefCount points to by 1
  *
- * @since 2.1
+ * @since      2.1
+ * @remarks    This method supposes 4 byte alignment in ARM architecture.
  */
 inline int
 AtomicInc(volatile int* pRefCount)
@@ -64,15 +66,16 @@ AtomicInc(volatile int* pRefCount)
 }
 
 /**
- * Atomically decrease the variable that pRefCount points to by 1
+ * Atomically decrease the variable that @c pRefCount points to by 1
  *
- * @since 2.1
+ * @since      2.1
+ * @remarks    This method supposes 4 byte alignment in ARM architecture.
  */
 inline int
 AtomicDec(volatile int* pRefCount)
 {
        return AtomicAdd(pRefCount, -1);
 }
-} // _String
-}}  // Tizen::Base
-#endif  // _FBASE_INTERNAL_STRING_H_
\ No newline at end of file
+
+}}}} // Tizen::Base::Utility::_AtomicOperations
+#endif  // _FBASE_UTIL_ATOMIC_OPERATIONS_H_