Difference between revisions of "Spec:o3tl/utilities/heap ptr"
From Apache OpenOffice Wiki
(→Abstract: formatting) |
(→References: removing empty lines) |
||
Line 29: | Line 29: | ||
|- | |- | ||
| width="300" bgcolor="#dddddd" | '''Reference Document''' || bgcolor="#dddddd" | '''Location (URL)''' | | width="300" bgcolor="#dddddd" | '''Reference Document''' || bgcolor="#dddddd" | '''Location (URL)''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
| '''Product Requirement, RFE, Issue ID''' | | '''Product Requirement, RFE, Issue ID''' | ||
| IssueZilla [http://www.openoffice.org/issues/show_bug.cgi?id=76768 76768] | | IssueZilla [http://www.openoffice.org/issues/show_bug.cgi?id=76768 76768] | ||
− | |||
− | |||
− | |||
|- | |- | ||
| '''[[Test case specification]]''' | | '''[[Test case specification]]''' | ||
| Unit Tests in module '''o3tl/qa/test-heap_ptr.cxx''' | | Unit Tests in module '''o3tl/qa/test-heap_ptr.cxx''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
| '''Coding Standards this class helps to match''' | | '''Coding Standards this class helps to match''' |
Revision as of 08:17, 11 July 2007
o3tl::heap_ptr<> - a Const-Transitive Smart Pointer Class
Specification Status | |
Author | Nikolai Pretzell |
Last Change | 2007-05-15 |
Status | Preliminary |
Abstract
heap_ptr<>
is a const-transitive, non-copyable, C++ smart pointer class.
- smart pointer: A class that holds a pointer to memory allocated on the heap. The destructor automatically deletes (deallocates) the memory.
- const-transitive: In
const heap_ptr<int> pX( new int(25) );
not only pX is const, but also the integer value it points to. This is useful for member variables of classes, because if the class administrates the heap memory, it is normally part of its state. - non-copyable: When copying pointers to heap-memory, there either must be a reference counting or the pointer must not be copyable to make sure, delete is called at the right time for the heap memory.
References
Reference Document | Location (URL) |
Product Requirement, RFE, Issue ID | IssueZilla 76768 |
Test case specification | Unit Tests in module o3tl/qa/test-heap_ptr.cxx |
Coding Standards this class helps to match | http://wiki.services.openoffice.org/wiki/Cpp_Coding_Standards/GEN#RAII |
Contacts
Role | Name | E-Mail Address |
Developer | Nikolai Pretzell | np@openoffice.org |
Quality Assurance | Thorsten Behrens | thb@openoffice.org |
Documentation | Nikolai Pretzell | np@openoffice.org |
User Experience | n/a | n/a |
Acronyms and Abbreviations
Acronym / Abbreviation | Definition |
Detailed Specification
TBD
Migration
- Member data on the heap
- This class should be the default for class members that are pointers to heap memory and are not shared with other instances, but administrated only by one object. Plain pointers, std::auto_ptr<> and non const-transitive pointers should be replaced, when refactoring.
- RAII in function bodies
- It can be used in new code, when using RAII for heap memory within a function body.
Configuration
n/a
File Format
n/a
Open Issues
-