Design Principles for Collection and Enumerator Interfaces
2007-08-04 10:36
681 查看
Design Principles for Collection and Enumerator Interfaces
There are different design principles behind each type of interface:
A collection interface provides random access to a single item in the collection via the Item method, it lets clients discover how many items are in the collection via the Count property, and often allows clients to add and remove items.
An enumerator interface provides serial access to multiple items in a collection, it doesn't allow the client to discover how many items are in the collection (until the enumerator stops returning items), and it doesn't provide any way of adding or removing items.
Each type of interface plays a different role in providing access to the elements in a collection.
ATL provides the following classes to help you implement collections and enumerators.
There are different design principles behind each type of interface:
A collection interface provides random access to a single item in the collection via the Item method, it lets clients discover how many items are in the collection via the Count property, and often allows clients to add and remove items.
An enumerator interface provides serial access to multiple items in a collection, it doesn't allow the client to discover how many items are in the collection (until the enumerator stops returning items), and it doesn't provide any way of adding or removing items.
Each type of interface plays a different role in providing access to the elements in a collection.
ATL provides the following classes to help you implement collections and enumerators.
Class | Description |
---|---|
ICollectionOnSTLImpl | Collection interface implementation |
IEnumOnSTLImpl | Enumerator interface implementation (assumes data stored in an STL-compatible container) |
CComEnumImpl | Enumerator interface implementation (assumes data stored in an array) |
CComEnumOnSTL | Enumerator object implementation (uses IEnumOnSTLImpl) |
CComEnum | Enumerator object implementation (uses CComEnumImpl) |
_Copy | Copy policy class |
_CopyInterface | Copy policy class |
CAdapt | Adapter class (hides operator & allowing CComPtr, CComQIPtr, and CComBSTR to be stored in STL containers) |
相关文章推荐
- The Design of Sites: Patterns, Principles, and Processes for Crafting a Customer-Centered Web Experi
- The Design of Sites: Patterns, Principles, and Processes for Crafting a Customer-Centered Web Experi
- Designing Web Interfaces: Principles and Patterns for Rich Interactions
- The Design of Sites: Patterns, Principles, and Processes for Crafting a Customer-Centered Web Experience
- HCI Beyond the GUI: Design for Haptic, Speech, Olfactory, and Other Nontraditional Interfaces
- Massive Collection Of Design Patterns, Frameworks, Components, And Language Features For Delphi
- The design and analysis of high frequency phased array coils for MRI
- the design principles and code analysis of hibernate lazy loading
- EECS 150 : Components and Design Techniques for Digital Systems Spring 2003 VidFx
- Domain Object Layer Design and Sample Code for LiteMDA
- BigQueue:The Architecture and Design of a Publish & Subscribe Messaging System Tailored for Big Data
- UI设计:Android Wear - Design Principles for Android Wear(设计准则)
- 论文翻译:Development and Evaluation of Emerging Design Patterns for Ubiquitous Computing
- Code Design for Dependable Systems: Theory and Practical Applications
- Design and Model Analysis of the E-Commerce Development Platform for 3-Tiered Web Applications
- Parsimony Principles for Software Components and Metalanguages
- Effective Java 17 Design and document for inheritance or else prohibit it
- A Summary of Principles for User-Interface Design.
- 设计: ListView 接口,and the missing read-only interfaces in java collection framework