View Issue Details

IDProjectCategoryView StatusLast Update
0023569CommunityOCCT:Foundation Classespublic2013-04-29 15:21
ReporterRoman Lygin Assigned ToRoman Lygin  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.5.4 
Target Version6.6.0Fixed in Version6.6.0 
Summary0023569: Adding NCollection_StdAllocator
DescriptionNCollection_StdAllocator is a C++ standard compliant allocator that wraps Open CASCADE's NCollection_BaseAllocator and its subclasses.

The allocator can be used with standard containers (std::vector, std::map, boost::unordered_set, etc) to take advantage, for instance, of NCollection_IncAllocator (which implements pool allocator) or just central OCC memory allocator interface (Standard::Allocate(), ::Free()) via NCollection_BaseAllocator.

More details will be provided in a dedicated blog post.
Steps To ReproduceSee enclosed test case.
TagsNo tags attached.
Test case numberbug fclasses(002) bug23569_1, bug23569_2

Attached Files

  • NCollection_StdAllocator_Test.zip (717 bytes)

Relationships

parent of 0023726 closedkgv Open CASCADE Wrong usage of NCollection_StdAllocator<void> in QANColStdAllocator2 

Activities

Roman Lygin

2012-11-22 10:36

developer  

NCollection_StdAllocator_Test.zip (717 bytes)

Roman Lygin

2012-11-22 10:52

developer   ~0022343

Pushed into git repository as branch CR23569

abv

2012-11-22 11:16

manager   ~0022346

No remarks; please create test case using attached QtTest-based sample, and test

Roman Lygin

2012-11-22 11:29

developer   ~0022347

Blog post - http://opencascade.blogspot.com/2012/11/standard-allocator-part-2.html

abv

2012-11-22 13:15

manager   ~0022353

By the way, would not it be convenient to give this allocator some distinct name, more resembling STL conventions than pure OCCT style? just a thought...

Roman Lygin

2012-11-22 14:26

developer   ~0022355

Hi Andrey,
Any specific examples you have in mind ? I chose NCollection_StdAllocator to reflect its NCollection wrapping nature and 'StdAllocator' to reflect its purpose and sort of proximity to std::allocator.

Anyway, please feel free to rename as you feel appropriate/consistent with any other possible conventions.

kgv

2012-11-22 15:29

developer   ~0022358

Dear Roman,

could you please re-format the patch according OCCT coding rules (at least 2-spaces indentation)?

>+ //! Returns the largest value for which method allocate might succeed.
>+ size_type max_size() const throw()
>+ {
>+ size_type aMax = static_cast<size_type>( -1 ) / sizeof( value_type );
>+ return (aMax > 0 ? aMax : 1);
>+ }
this code looks confusing taking into account "typedef size_t size_type".
I see this code is like in MSVC STL implementation but probably better to follow gcc developers in this case?
> size_type max_size() const throw() { return size_t(-1) / sizeof(_Tp); }

Roman Lygin

2012-11-22 19:04

developer   ~0022365

Kirill,
Thanks for a code review. Your comments have been addressed:
- 4 spaces replaced with 2
- in max_size() a check was removed.
Assigned back to Mikhail.

mkv

2012-11-30 12:42

tester   ~0022478

Dear BugMaster,
Branch CR23569 (and products from GIT master) was compiled on Linux and Windows platforms and tested.

Regressions:
Not detected

Improvements:
Not detected

Testing cases:
bugs fclasses(002) bug23569_1, bug23569_2 - OK.

Related Changesets

occt: master ed9161a4

2012-11-30 12:06:46

Roman Lygin

Details Diff
0023569: Adding NCollection_StdAllocator

Adding NCollection_StdAllocator
Adding NCollection_StdAllocator (correcting previous commit)
- addressed code review comment by kgv with using 2 (vs 4) spaces and amending max_size()

Add new draw-commands
Adding test case for this bug
Affected Issues
0023569
mod - src/NCollection/FILES Diff File
add - src/NCollection/NCollection_StdAllocator.hxx Diff File
mod - src/QANCollection/FILES Diff File
mod - src/QANCollection/QANCollection.cdl Diff File
mod - src/QANCollection/QANCollection.cxx Diff File
add - src/QANCollection/QANCollection4.cxx Diff File
add - tests/bugs/fclasses/bug23569_1 Diff File
add - tests/bugs/fclasses/bug23569_2 Diff File

Issue History

Date Modified Username Field Change
2012-11-22 10:36 Roman Lygin New Issue
2012-11-22 10:36 Roman Lygin Assigned To => abv
2012-11-22 10:36 Roman Lygin File Added: NCollection_StdAllocator_Test.zip
2012-11-22 10:52 Roman Lygin Note Added: 0022343
2012-11-22 10:52 Roman Lygin Status new => resolved
2012-11-22 11:16 abv Note Added: 0022346
2012-11-22 11:16 abv Assigned To abv => bugmaster
2012-11-22 11:16 abv Status resolved => reviewed
2012-11-22 11:29 Roman Lygin Note Added: 0022347
2012-11-22 13:15 abv Note Added: 0022353
2012-11-22 13:41 mkv Assigned To bugmaster => mkv
2012-11-22 14:26 Roman Lygin Note Added: 0022355
2012-11-22 15:29 kgv Note Added: 0022358
2012-11-22 18:13 kgv Assigned To mkv => Roman Lygin
2012-11-22 18:13 kgv Status reviewed => assigned
2012-11-22 19:04 Roman Lygin Note Added: 0022365
2012-11-22 19:04 Roman Lygin Assigned To Roman Lygin => mkv
2012-11-22 19:04 Roman Lygin Status assigned => resolved
2012-11-23 11:58 abv Status resolved => reviewed
2012-11-30 12:42 mkv Note Added: 0022478
2012-11-30 12:44 mkv Test case number => bug fclasses(002) bug23569_1, bug23569_2
2012-11-30 12:44 mkv Assigned To mkv => bugmaster
2012-11-30 12:44 mkv Status reviewed => tested
2012-11-30 13:56 bugmaster Target Version => 6.6.0
2012-12-04 13:21 Roman Lygin Changeset attached => occt master ed9161a4
2012-12-04 13:21 Roman Lygin Assigned To bugmaster => Roman Lygin
2012-12-04 13:21 Roman Lygin Status tested => verified
2012-12-04 13:21 Roman Lygin Resolution open => fixed
2012-12-10 17:16 Roman Lygin Changeset attached => occt master ed9161a4
2013-01-26 22:55 kgv Relationship added parent of 0023726
2013-04-23 13:36 aiv Status verified => closed
2013-04-29 15:21 aiv Fixed in Version => 6.6.0