-#ifndef __DALI_OWNER_CONTAINER_H__
-#define __DALI_OWNER_CONTAINER_H__
+#ifndef DALI_OWNER_CONTAINER_H
+#define DALI_OWNER_CONTAINER_H
/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class OwnerContainer : public Dali::Vector< T >
{
public:
-
- typedef typename Dali::Vector< T >::SizeType SizeType;
- typedef typename Vector< T >::Iterator Iterator;
- typedef typename Vector< T >::ConstIterator ConstIterator;
+ using SizeType = typename Dali::Vector<T>::SizeType;
+ using Iterator = typename Vector<T>::Iterator;
+ using ConstIterator = typename Vector<T>::ConstIterator;
/**
* Create a pointer-container.
VectorBase::Release();
}
+ // Not copyable or movable
+ OwnerContainer( const OwnerContainer& ) = delete; ///< Deleted copy constructor
+ OwnerContainer( OwnerContainer&& ) = delete; ///< Deleted move constructor
+ OwnerContainer& operator=( const OwnerContainer& ) = delete; ///< Deleted copy assignment operator
+ OwnerContainer& operator=( OwnerContainer&& ) = delete; ///< Deleted move assignment operator
+
/**
* Test whether the container is empty.
* @return True if the container is empty
}
/**
+ * Erase an object from OwnerContainer
+ * @param object to remove
+ */
+ inline void EraseObject( T object )
+ {
+ DALI_ASSERT_DEBUG( object && "NULL object not allowed" );
+
+ Iterator iter = Vector< T >::Begin();
+ const ConstIterator endIter = Vector< T >::End();
+ for ( ; iter != endIter; ++iter )
+ {
+ if ( *iter == object )
+ {
+ Erase( iter );
+ return;
+ }
+ }
+ }
+
+ /**
* Release the ownership of an object, without deleting it.
* @param[in] position A dereferencable iterator to an element in mContainer.
* @post iterators are invalidated by this method.
private:
- // Undefined copy constructor.
- OwnerContainer( const OwnerContainer& );
- // Undefined assignment operator.
- OwnerContainer& operator=( const OwnerContainer& );
-
/**
* @brief delete the contents of the pointer
* Function provided to allow classes to provide a custom destructor through template specialisation
} // namespace Dali
-#endif //__DALI_OWNER_CONTAINER_H__
+#endif //DALI_OWNER_CONTAINER_H