Skip to content

Conversation

@konard
Copy link
Member

@konard konard commented Sep 12, 2025

Summary

  • Implemented CLinks C++20 concept defining core requirements for ILinks interface implementations
  • Used selective polymorphism approach as recommended in the issue comment referencing the AnyAny library
  • Includes only main ILinks methods without extensions: Count, Each, Create, Update, Delete
  • Added comprehensive tests verifying concept satisfaction for compliant and non-compliant implementations

Implementation Details

The CLinks concept requires:

Type Requirements

  • LinkAddressType: Type for link addresses
  • ReadHandlerType: Handler type for read operations (Each)
  • WriteHandlerType: Handler type for write operations (Create, Update, Delete)

Member Requirements

  • Constants: Static constants for effective interface communication
  • Count(restriction): Counts links matching restriction
  • Each(restriction, handler): Iterates through matching links
  • Create(substitution, handler): Creates new links
  • Update(restriction, substitution, handler): Updates existing links
  • Delete(restriction, handler): Deletes matching links

Files Added

cpp/Platform.Data/CLinks.h

  • Main concept definition with comprehensive documentation
  • Self-contained with minimal dependencies (concepts, vector, type_traits)
  • Added to Platform.Data.h include structure

cpp/Platform.Data.Tests/CLinksTests.cpp

  • Tests using existing ILinks test infrastructure
  • Verifies concept works with TestLinksForConcept implementation
  • Tests different address types (uint64_t, uint32_t, uint16_t)
  • Negative test for incomplete implementations

cpp/Platform.Data.Tests/CLinksSimpleTest.cpp

  • Standalone concept tests without complex dependencies
  • Static assertions for compile-time verification
  • Simple test implementations proving concept functionality

Test Plan

  • Concept compiles with C++20 standard
  • Static assertions pass for compliant implementations
  • Static assertions fail for incomplete implementations
  • Tests work with different address types
  • Integration with existing ILinks infrastructure works
  • Code follows project documentation style (bilingual comments)

Based on Issue Requirements

Resolves #85 by adding a CLinks concept based on the main methods of ILinks (without extensions), following the selective polymorphism approach suggested in the issue comments.

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #85
@konard konard self-assigned this Sep 12, 2025
- Created CLinks.h with C++20 concept defining core ILinks requirements
- Includes type requirements for LinkAddressType, ReadHandlerType, WriteHandlerType
- Requires Constants field and core methods: Count, Each, Create, Update, Delete
- Uses selective polymorphism approach as suggested in issue comment
- Added concept to Platform.Data.h include structure
- Created comprehensive tests including positive and negative test cases
- Tests verify concept works with different address types (uint64_t, uint32_t)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add a CLinks concept based on the main methods of ILinks (without extensions) Add CLinks concept based on main ILinks methods Sep 12, 2025
@konard konard marked this pull request as ready for review September 12, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a CLinks concept based on the main methods of ILinks (without extensions)

2 participants