Skip to content

Commit 5d2a65e

Browse files
authored
refactor(include): migrate public headers to include/kcenon/container/ convention
Migrate 24 public headers from core/ to include/kcenon/container/ to match the ecosystem convention used by all other kcenon systems. Forwarding headers in core/ maintain backward compatibility. Closes #439
1 parent d783cbf commit 5d2a65e

49 files changed

Lines changed: 7498 additions & 7411 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CMakeLists.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ set_target_properties(container_system PROPERTIES
279279

280280
# Public include directories (for consumers of this library)
281281
target_include_directories(container_system PUBLIC
282+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
282283
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
283284
$<INSTALL_INTERFACE:include>
284285
)
@@ -560,10 +561,12 @@ set(CONTAINER_SYSTEM_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/container_
560561
# Canonical Include Path Configuration
561562
# =============================================================================
562563
# The canonical include path for container_system is:
563-
# #include <container.h>
564+
# #include <kcenon/container/container.h> (preferred)
565+
# #include <container.h> (legacy, via forwarding headers)
564566
#
565567
# The following directories are installed:
566-
# - core/ (core container implementation)
568+
# - include/kcenon/container/ (canonical public headers)
569+
# - core/ (forwarding headers for backward compatibility)
567570
# - internal/ (internal implementation details)
568571
# - integration/ (integration adapters)
569572
# =============================================================================
@@ -581,6 +584,17 @@ install(TARGETS container_system
581584
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
582585
)
583586

587+
# Canonical public headers (kcenon ecosystem convention)
588+
install(DIRECTORY
589+
${CMAKE_CURRENT_SOURCE_DIR}/include/kcenon
590+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
591+
COMPONENT Development
592+
FILES_MATCHING
593+
PATTERN "*.h"
594+
PATTERN "*.hpp"
595+
)
596+
597+
# Backward-compatible forwarding headers and internal implementation
584598
install(DIRECTORY
585599
${CMAKE_CURRENT_SOURCE_DIR}/core
586600
${CMAKE_CURRENT_SOURCE_DIR}/internal
@@ -669,6 +683,7 @@ if(CONTAINER_BUILD_MODULES)
669683

670684
# Include directories for module target
671685
target_include_directories(container_system_modules PUBLIC
686+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
672687
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
673688
$<INSTALL_INTERFACE:include>
674689
)

core/concepts.h

Lines changed: 2 additions & 244 deletions
Original file line numberDiff line numberDiff line change
@@ -1,245 +1,3 @@
1-
/*****************************************************************************
2-
BSD 3-Clause License
3-
4-
Copyright (c) 2024, kcenon
5-
All rights reserved.
6-
*****************************************************************************/
7-
8-
/**
9-
* @file concepts.h
10-
* @brief C++20 concepts for container_system type validation.
11-
*
12-
* This header provides concepts for validating types used throughout
13-
* the container_system library. These concepts enable compile-time
14-
* validation with clear error messages, replacing SFINAE-based constraints.
15-
*
16-
* Requirements:
17-
* - C++20 compiler with concepts support
18-
* - GCC 10+, Clang 10+, MSVC 2022+
19-
*
20-
* Integration with common_system:
21-
* - Imports core concepts from kcenon::common::concepts
22-
* - Extends with container_system-specific concepts
23-
*
24-
* @see kcenon/common/concepts/concepts.h for common_system concepts
25-
*/
26-
271
#pragma once
28-
29-
#include <concepts>
30-
#include <type_traits>
31-
#include <string>
32-
#include <string_view>
33-
#include <vector>
34-
#include <memory>
35-
#include <variant>
36-
#include <cstdint>
37-
38-
namespace kcenon::container {
39-
40-
// Forward declarations
41-
class thread_safe_container;
42-
class value;
43-
struct array_variant;
44-
45-
namespace concepts {
46-
47-
/**
48-
* @concept Arithmetic
49-
* @brief A type that is arithmetic (integral or floating-point).
50-
*
51-
* Example usage:
52-
* @code
53-
* template<Arithmetic T>
54-
* value make_numeric_value(std::string_view name, T val);
55-
* @endcode
56-
*/
57-
template<typename T>
58-
concept Arithmetic = std::is_arithmetic_v<T>;
59-
60-
/**
61-
* @concept IntegralType
62-
* @brief A type that is an integral type.
63-
*/
64-
template<typename T>
65-
concept IntegralType = std::integral<T>;
66-
67-
/**
68-
* @concept FloatingPointType
69-
* @brief A type that is a floating-point type.
70-
*/
71-
template<typename T>
72-
concept FloatingPointType = std::floating_point<T>;
73-
74-
/**
75-
* @concept SignedIntegral
76-
* @brief A signed integral type.
77-
*/
78-
template<typename T>
79-
concept SignedIntegral = std::signed_integral<T>;
80-
81-
/**
82-
* @concept UnsignedIntegral
83-
* @brief An unsigned integral type.
84-
*/
85-
template<typename T>
86-
concept UnsignedIntegral = std::unsigned_integral<T>;
87-
88-
/**
89-
* @concept TriviallyCopyable
90-
* @brief A type that can be safely copied with memcpy.
91-
*
92-
* Use this concept for types that require SIMD-optimized operations
93-
* or deterministic memory layout.
94-
*
95-
* Example usage:
96-
* @code
97-
* template<TriviallyCopyable T>
98-
* class simd_batch { ... }; // Renamed from typed_container (Issue #328)
99-
* @endcode
100-
*/
101-
template<typename T>
102-
concept TriviallyCopyable = std::is_trivially_copyable_v<T>;
103-
104-
/**
105-
* @concept ValueVariantType
106-
* @brief A type that is valid for storage in ValueVariant.
107-
*
108-
* Valid types include:
109-
* - std::monostate (null)
110-
* - bool
111-
* - int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t
112-
* - float, double
113-
* - std::string
114-
* - std::vector<uint8_t> (bytes)
115-
* - std::shared_ptr<thread_safe_container>
116-
* - array_variant
117-
*
118-
* Example usage:
119-
* @code
120-
* template<ValueVariantType T>
121-
* void set_typed(std::string_view key, T&& val);
122-
* @endcode
123-
*/
124-
template<typename T>
125-
concept ValueVariantType =
126-
std::same_as<std::decay_t<T>, std::monostate> ||
127-
std::same_as<std::decay_t<T>, bool> ||
128-
std::same_as<std::decay_t<T>, int16_t> ||
129-
std::same_as<std::decay_t<T>, uint16_t> ||
130-
std::same_as<std::decay_t<T>, int32_t> ||
131-
std::same_as<std::decay_t<T>, uint32_t> ||
132-
std::same_as<std::decay_t<T>, int64_t> ||
133-
std::same_as<std::decay_t<T>, uint64_t> ||
134-
std::same_as<std::decay_t<T>, float> ||
135-
std::same_as<std::decay_t<T>, double> ||
136-
std::same_as<std::decay_t<T>, std::string> ||
137-
std::same_as<std::decay_t<T>, std::vector<uint8_t>> ||
138-
std::same_as<std::decay_t<T>, std::shared_ptr<thread_safe_container>> ||
139-
std::same_as<std::decay_t<T>, array_variant>;
140-
141-
/**
142-
* @concept NumericValueType
143-
* @brief A numeric type suitable for value storage.
144-
*
145-
* Excludes bool (which has its own handling) and includes
146-
* all signed/unsigned integers and floating-point types.
147-
*/
148-
template<typename T>
149-
concept NumericValueType =
150-
Arithmetic<T> && !std::same_as<std::decay_t<T>, bool>;
151-
152-
/**
153-
* @concept StringLike
154-
* @brief A type that can be converted to or used as a string.
155-
*/
156-
template<typename T>
157-
concept StringLike =
158-
std::same_as<std::decay_t<T>, std::string> ||
159-
std::same_as<std::decay_t<T>, std::string_view> ||
160-
std::same_as<std::decay_t<T>, const char*> ||
161-
std::convertible_to<T, std::string_view>;
162-
163-
/**
164-
* @concept ByteContainer
165-
* @brief A type that represents byte data.
166-
*/
167-
template<typename T>
168-
concept ByteContainer =
169-
std::same_as<std::decay_t<T>, std::vector<uint8_t>>;
170-
171-
/**
172-
* @concept ValueVisitor
173-
* @brief A callable type that can visit value variants.
174-
*
175-
* Example usage:
176-
* @code
177-
* template<ValueVisitor V>
178-
* auto visit(V&& visitor) const;
179-
* @endcode
180-
*/
181-
template<typename V>
182-
concept ValueVisitor = std::move_constructible<V>;
183-
184-
/**
185-
* @concept KeyValueCallback
186-
* @brief A callable for key-value pair iteration.
187-
*
188-
* Example usage:
189-
* @code
190-
* template<KeyValueCallback Func>
191-
* void for_each(Func&& func) const;
192-
* @endcode
193-
*/
194-
template<typename F>
195-
concept KeyValueCallback = std::invocable<F, const std::string&, const value&>;
196-
197-
/**
198-
* @concept MutableKeyValueCallback
199-
* @brief A callable for mutable key-value pair iteration.
200-
*/
201-
template<typename F>
202-
concept MutableKeyValueCallback = std::invocable<F, const std::string&, value&>;
203-
204-
/**
205-
* @concept ValueMapCallback
206-
* @brief A callable that operates on the entire value map.
207-
*/
208-
template<typename F, typename Map>
209-
concept ValueMapCallback = std::invocable<F, Map&>;
210-
211-
/**
212-
* @concept ConstValueMapCallback
213-
* @brief A callable that operates on a const value map.
214-
*/
215-
template<typename F, typename Map>
216-
concept ConstValueMapCallback = std::invocable<F, const Map&>;
217-
218-
/**
219-
* @concept Serializable
220-
* @brief A type that provides serialization methods.
221-
*/
222-
template<typename T>
223-
concept Serializable = requires(const T& t) {
224-
{ t.serialize() } -> std::convertible_to<std::vector<uint8_t>>;
225-
};
226-
227-
/**
228-
* @concept JsonSerializable
229-
* @brief A type that can be serialized to JSON.
230-
*/
231-
template<typename T>
232-
concept JsonSerializable = requires(const T& t) {
233-
{ t.to_json() } -> std::convertible_to<std::string>;
234-
};
235-
236-
/**
237-
* @concept ContainerValue
238-
* @brief A type representing a nested container value.
239-
*/
240-
template<typename T>
241-
concept ContainerValue =
242-
std::same_as<std::decay_t<T>, std::shared_ptr<thread_safe_container>>;
243-
244-
} // namespace concepts
245-
} // namespace kcenon::container
2+
// Forwarding header — canonical location: include/kcenon/container/concepts.h
3+
#include <kcenon/container/concepts.h>

0 commit comments

Comments
 (0)