X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Fpublic-api%2Fcommon%2Fdali-vector.h;h=98fae3873cd9af9dc552c50d2cd619f303633f8f;hb=25c7ca5bc0a79e7aae41afec7796b8f9b0886e61;hp=2b7b78618e38688618e8f37898dd5a09ddcde50f;hpb=646f736e77b085c86e982c0d1d4b895c2a431330;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/public-api/common/dali-vector.h b/dali/public-api/common/dali-vector.h index 2b7b786..98fae38 100755 --- a/dali/public-api/common/dali-vector.h +++ b/dali/public-api/common/dali-vector.h @@ -1,8 +1,8 @@ -#ifndef __DALI_VECTOR_H__ -#define __DALI_VECTOR_H__ +#ifndef DALI_VECTOR_H +#define DALI_VECTOR_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2019 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. @@ -210,7 +210,7 @@ protected: // for Derived classes private: - // not copiable as it does not know the size of elements + // not copyable as it does not know the size of elements VectorBase( const VectorBase& ); ///< Undefined @SINCE_1_0.0 VectorBase& operator=( const VectorBase& ); ///< Undefined @SINCE_1_0.0 @@ -220,6 +220,7 @@ protected: // Data }; +/// @cond internal /** * @brief Vector algorithm variant for trivial types. * @@ -321,9 +322,9 @@ protected: // API for deriving classes * @param[in] address Address to erase from * @param[in] elementSize Size to erase */ - void Erase( char* address, SizeType elementSize ) + void Erase( uint8_t* address, SizeType elementSize ) { - VectorBase::Erase( address, elementSize ); + VectorBase::Erase( reinterpret_cast< char* >( address ), elementSize ); } /** @@ -335,9 +336,9 @@ protected: // API for deriving classes * @param[in] elementSize Size of one of the elements to be erased * @return Address pointing to the next element of the last one */ - char* Erase( char* first, char* last, SizeType elementSize ) + uint8_t* Erase( uint8_t* first, uint8_t* last, SizeType elementSize ) { - return VectorBase::Erase( first, last, elementSize ); + return reinterpret_cast< uint8_t* >( VectorBase::Erase( reinterpret_cast< char* >( first ), reinterpret_cast< char *>( last ), elementSize ) ); } /** @@ -349,7 +350,7 @@ protected: // API for deriving classes * @param[in] to Address to the last element to be inserted * @param[in] elementSize Size of one of the elements to be inserted */ - void Insert( char* at, char* from, char* to, SizeType elementSize ) + void Insert( uint8_t* at, uint8_t* from, uint8_t* to, SizeType elementSize ) { const SizeType size = to - from; const SizeType count = Count(); @@ -358,27 +359,29 @@ protected: // API for deriving classes if( newCount > Capacity() ) { // Calculate the at offset as the pointer is invalid after the Reserve() call. - std::size_t offset = at - reinterpret_cast( mData ); + std::size_t offset = at - reinterpret_cast( mData ); // need more space Reserve( NextPowerOfTwo( static_cast( newCount ) ), elementSize ); // reserve enough space to store at least the next power of two elements of the new required size. // Set the new at pointer. - at = reinterpret_cast( mData ) + offset; + at = reinterpret_cast( mData ) + offset; } // set new count first as otherwise the debug assert will hit us SetCount( newCount ); // Move current items to a new position inside the vector. - CopyMemory( at + size, - at, - ( reinterpret_cast( mData ) + count * elementSize ) - at ); + CopyMemory( reinterpret_cast< char* >( at + size ), + reinterpret_cast< const char* >( at ), + ( reinterpret_cast( mData ) + count * elementSize ) - at ); // Copy the given items. - CopyMemory( at, from, size ); + CopyMemory( reinterpret_cast< char* >( at ), reinterpret_cast< const char* >( from ), size ); } }; +/// @endcond +/// @cond internal /** * @brief Vector algorithm variant for complex types. * @@ -396,6 +399,7 @@ private: ~VectorAlgorithms() { } }; +/// @endcond /** * @brief Vector class with minimum space allocation when it's empty. @@ -585,8 +589,8 @@ public: // API { DALI_ASSERT_VECTOR( ( at <= End() ) && ( at >= Begin() ) && "Iterator not inside vector" ); const SizeType size = sizeof( ItemType ); - char* address = const_cast( reinterpret_cast( &element ) ); - VectorAlgorithms::Insert( reinterpret_cast< char* >( at ), + uint8_t* address = const_cast( reinterpret_cast( &element ) ); + VectorAlgorithms::Insert( reinterpret_cast< uint8_t* >( at ), address, address + size, size ); @@ -621,9 +625,9 @@ public: // API return; } - VectorAlgorithms::Insert( reinterpret_cast< char* >( at ), - reinterpret_cast< char* >( from ), - reinterpret_cast< char* >( to ), + VectorAlgorithms::Insert( reinterpret_cast< uint8_t* >( at ), + reinterpret_cast< uint8_t* >( from ), + reinterpret_cast< uint8_t* >( to ), sizeof( ItemType ) ); } @@ -694,7 +698,7 @@ public: // API DALI_ASSERT_VECTOR( (iterator < End()) && (iterator >= Begin()) && "Iterator not inside vector" ); if( iterator < ( End() - 1u ) ) { - VectorAlgorithms::Erase( reinterpret_cast< char* >( iterator ), sizeof( ItemType ) ); + VectorAlgorithms::Erase( reinterpret_cast< uint8_t* >( iterator ), sizeof( ItemType ) ); } else { @@ -735,8 +739,8 @@ public: // API } else { - nextElement = reinterpret_cast( VectorAlgorithms::Erase( reinterpret_cast< char* >( first ), - reinterpret_cast< char* >( last ), + nextElement = reinterpret_cast( VectorAlgorithms::Erase( reinterpret_cast< uint8_t* >( first ), + reinterpret_cast< uint8_t* >( last ), sizeof( ItemType ) ) ); } @@ -802,4 +806,4 @@ public: // API */ } // namespace Dali -#endif /* __DALI_VECTOR_H__ */ +#endif // DALI_VECTOR_H