Skip to content

Commit

Permalink
better organization is possible for both user and dev facing code
Browse files Browse the repository at this point in the history
  • Loading branch information
agl-alexglopez committed Nov 14, 2024
1 parent d59007a commit b6cdc48
Show file tree
Hide file tree
Showing 42 changed files with 95 additions and 98 deletions.
58 changes: 29 additions & 29 deletions ccc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ add_library(types)
target_sources(types
PRIVATE
${PROJECT_SOURCE_DIR}/src/types.c
impl_types.h
impl/impl_types.h
PUBLIC
FILE_SET types_header
TYPE HEADERS
Expand All @@ -15,7 +15,7 @@ add_library(buffer)
target_sources(buffer
PRIVATE
${PROJECT_SOURCE_DIR}/src/buffer.c
impl_buffer.h
impl/impl_buffer.h
PUBLIC
FILE_SET public_headers
TYPE HEADERS
Expand All @@ -32,7 +32,7 @@ add_library(doubly_linked_list)
target_sources(doubly_linked_list
PRIVATE
${PROJECT_SOURCE_DIR}/src/doubly_linked_list.c
impl_doubly_linked_list.h
impl/impl_doubly_linked_list.h
PUBLIC
FILE_SET doubly_linked_list_header
TYPE HEADERS
Expand All @@ -49,7 +49,7 @@ add_library(singly_linked_list)
target_sources(singly_linked_list
PRIVATE
${PROJECT_SOURCE_DIR}/src/singly_linked_list.c
impl_singly_linked_list.h
impl/impl_singly_linked_list.h
PUBLIC
FILE_SET singly_linked_list_header
TYPE HEADERS
Expand All @@ -66,7 +66,7 @@ add_library(priority_queue)
target_sources(priority_queue
PRIVATE
${PROJECT_SOURCE_DIR}/src/priority_queue.c
impl_priority_queue.h
impl/impl_priority_queue.h
PUBLIC
FILE_SET priority_queue_header
TYPE HEADERS
Expand All @@ -83,7 +83,7 @@ add_library(flat_priority_queue)
target_sources(flat_priority_queue
PRIVATE
${PROJECT_SOURCE_DIR}/src/flat_priority_queue.c
impl_flat_priority_queue.h
impl/impl_flat_priority_queue.h
PUBLIC
FILE_SET buffer_header
TYPE HEADERS
Expand All @@ -102,7 +102,7 @@ add_library(flat_hash_map)
target_sources(flat_hash_map
PRIVATE
${PROJECT_SOURCE_DIR}/src/flat_hash_map.c
impl_flat_hash_map.h
impl/impl_flat_hash_map.h
PUBLIC
FILE_SET flat_hash_map_header
TYPE HEADERS
Expand All @@ -121,7 +121,7 @@ add_library(ordered_multimap)
target_sources(ordered_multimap
PRIVATE
${PROJECT_SOURCE_DIR}/src/ordered_multimap.c
impl_ordered_multimap.h
impl/impl_ordered_multimap.h
PUBLIC
FILE_SET ordered_multimap_header
TYPE HEADERS
Expand All @@ -138,7 +138,7 @@ add_library(ordered_map)
target_sources(ordered_map
PRIVATE
${PROJECT_SOURCE_DIR}/src/ordered_map.c
impl_ordered_map.h
impl/impl_ordered_map.h
PUBLIC
FILE_SET ordered_map_header
TYPE HEADERS
Expand All @@ -155,7 +155,7 @@ add_library(flat_ordered_map)
target_sources(flat_ordered_map
PRIVATE
${PROJECT_SOURCE_DIR}/src/flat_ordered_map.c
impl_flat_ordered_map.h
impl/impl_flat_ordered_map.h
PUBLIC
FILE_SET flat_ordered_map_header
TYPE HEADERS
Expand All @@ -174,7 +174,7 @@ add_library(realtime_ordered_map)
target_sources(realtime_ordered_map
PRIVATE
${PROJECT_SOURCE_DIR}/src/realtime_ordered_map.c
impl_realtime_ordered_map.h
impl/impl_realtime_ordered_map.h
PUBLIC
FILE_SET realtime_ordered_map_header
TYPE HEADERS
Expand All @@ -191,7 +191,7 @@ add_library(flat_realtime_ordered_map)
target_sources(flat_realtime_ordered_map
PRIVATE
${PROJECT_SOURCE_DIR}/src/flat_realtime_ordered_map.c
impl_flat_realtime_ordered_map.h
impl/impl_flat_realtime_ordered_map.h
PUBLIC
FILE_SET flat_realtime_ordered_map_header
TYPE HEADERS
Expand All @@ -210,7 +210,7 @@ add_library(flat_double_ended_queue)
target_sources(flat_double_ended_queue
PRIVATE
${PROJECT_SOURCE_DIR}/src/flat_double_ended_queue.c
impl_flat_double_ended_queue.h
impl/impl_flat_double_ended_queue.h
PUBLIC
FILE_SET flat_double_ended_queue_header
TYPE HEADERS
Expand All @@ -228,7 +228,7 @@ target_link_libraries(flat_double_ended_queue
add_library(traits INTERFACE)
target_sources(traits
PRIVATE
impl_traits.h
impl/impl_traits.h
INTERFACE
FILE_SET traits_header
TYPE HEADERS
Expand Down Expand Up @@ -276,21 +276,21 @@ target_sources(${PROJECT_NAME}
TYPE HEADERS
BASE_DIRS ${PROJECT_SOURCE_DIR}
FILES
impl_types.h
impl_flat_priority_queue.h
impl_tree.h
impl_priority_queue.h
impl_ordered_map.h
impl_flat_ordered_map.h
impl_ordered_multimap.h
impl_singly_linked_list.h
impl_doubly_linked_list.h
impl_realtime_ordered_map.h
impl_flat_realtime_ordered_map.h
impl_traits.h
impl_flat_double_ended_queue.h
impl_flat_hash_map.h
impl_buffer.h
impl/impl_types.h
impl/impl_flat_priority_queue.h
impl/impl_tree.h
impl/impl_priority_queue.h
impl/impl_ordered_map.h
impl/impl_flat_ordered_map.h
impl/impl_ordered_multimap.h
impl/impl_singly_linked_list.h
impl/impl_doubly_linked_list.h
impl/impl_realtime_ordered_map.h
impl/impl_flat_realtime_ordered_map.h
impl/impl_traits.h
impl/impl_flat_double_ended_queue.h
impl/impl_flat_hash_map.h
impl/impl_buffer.h
types.h
buffer.h
flat_hash_map.h
Expand Down
2 changes: 1 addition & 1 deletion ccc/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Then, the `ccc_` prefix can be dropped from all types and functions. */
#include <stddef.h>
/** @endcond */

#include "impl_buffer.h"
#include "impl/impl_buffer.h"
#include "types.h"

/** @brief A contiguous block of storage for elements of the same type.
Expand Down
2 changes: 1 addition & 1 deletion ccc/doubly_linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ All types and functions can then be written without the `ccc_` prefix. */
#include <stddef.h>
/** @endcond */

#include "impl_doubly_linked_list.h"
#include "impl/impl_doubly_linked_list.h"
#include "types.h"

/** @brief A container offering bidirectional, insert, removal, and iteration.
Expand Down
2 changes: 1 addition & 1 deletion ccc/flat_double_ended_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ All types and functions can then be written without the `ccc_` prefix. */
#include <stddef.h>
/** @endcond */

#include "impl_flat_double_ended_queue.h"
#include "impl/impl_flat_double_ended_queue.h"
#include "types.h"

/** @brief A contiguous buffer for O(1) push and pop from front and back.
Expand Down
2 changes: 1 addition & 1 deletion ccc/flat_hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ All types and functions can then be written without the `ccc_` prefix. */
#include <stddef.h>
/** @endcond */

#include "impl_flat_hash_map.h"
#include "impl/impl_flat_hash_map.h"
#include "types.h"

/** @brief A container for storing key-value structures defined by the user in
Expand Down
2 changes: 1 addition & 1 deletion ccc/flat_ordered_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ All types and functions can then be written without the `ccc_` prefix. */
#include <stddef.h>
/** @endcond */

#include "impl_flat_ordered_map.h"
#include "impl/impl_flat_ordered_map.h"
#include "types.h"

/** @brief A self-optimizing data structure offering amortized O(lg N) search,
Expand Down
2 changes: 1 addition & 1 deletion ccc/flat_priority_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All types and functions can then be written without the `ccc_` prefix. */
#include <stddef.h>
/** @endcond */

#include "impl_flat_priority_queue.h"
#include "impl/impl_flat_priority_queue.h"
#include "types.h"

/** @brief A container offering direct storage and sorting of user data by heap
Expand Down
2 changes: 1 addition & 1 deletion ccc/flat_realtime_ordered_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ All types and functions can then be written without the `ccc_` prefix. */
#include <stddef.h>
/** @endcond */

#include "impl_flat_realtime_ordered_map.h"
#include "impl/impl_flat_realtime_ordered_map.h"
#include "types.h"

/** @brief A flat realtime ordered map offers O(lg N) search and erase, and
Expand Down
2 changes: 1 addition & 1 deletion ccc/impl_buffer.h → ccc/impl/impl_buffer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CCC_IMPL_BUFFER_H
#define CCC_IMPL_BUFFER_H

#include "types.h"
#include "../types.h"

/** @cond */
#include <assert.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CCC_IMPL_DOUBLY_LINKED_LIST_H
#define CCC_IMPL_DOUBLY_LINKED_LIST_H

#include "types.h"
#include "../types.h"

/** @cond */
#include <assert.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CCC_IMPL_FLAT_DOUBLE_ENDED_QUEUE_H
#define CCC_IMPL_FLAT_DOUBLE_ENDED_QUEUE_H

#include "buffer.h"
#include "../buffer.h"

/** @cond */
#include <stddef.h>
Expand Down
4 changes: 2 additions & 2 deletions ccc/impl_flat_hash_map.h → ccc/impl/impl_flat_hash_map.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#ifndef CCC_IMPL_FLAT_HASH_MAP_H
#define CCC_IMPL_FLAT_HASH_MAP_H

#include "buffer.h"
#include "../buffer.h"
#include "../types.h"
#include "impl_types.h"
#include "types.h"

/** @cond */
#include <assert.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef CCC_IMPL_FLAT_ORDERED_MAP_H
#define CCC_IMPL_FLAT_ORDERED_MAP_H

#include "buffer.h"
#include "types.h"
#include "../buffer.h"
#include "../types.h"

/** @cond */
#include <stddef.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#ifndef CCC_IMPL_FLAT_PRIORITY_QUEUE_H
#define CCC_IMPL_FLAT_PRIORITY_QUEUE_H

#include "buffer.h"
#include "types.h"
#include "../buffer.h"
#include "../types.h"

/** @cond */
#include <assert.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef IMPL_FLAT_REALTIME_ORDERED_MAP_H
#define IMPL_FLAT_REALTIME_ORDERED_MAP_H

#include "buffer.h"
#include "types.h"
#include "../buffer.h"
#include "../types.h"

/** @cond */
#include <stddef.h>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CCC_IMPL_PRIORITY_QUEUE_H
#define CCC_IMPL_PRIORITY_QUEUE_H

#include "types.h"
#include "../types.h"

/** @cond */
#include <stddef.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef CCC_IMPL_REALTIME_ORDERED_MAP_H
#define CCC_IMPL_REALTIME_ORDERED_MAP_H

#include "../types.h"
#include "impl_types.h"
#include "types.h"

/** @cond */
#include <stddef.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CCC_IMPL_SINGLY_LINKED_LIST_H
#define CCC_IMPL_SINGLY_LINKED_LIST_H

#include "types.h"
#include "../types.h"

/** @cond */
#include <assert.h>
Expand Down
37 changes: 17 additions & 20 deletions ccc/impl_traits.h → ccc/impl/impl_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
#define CCC_IMPL_TRAITS_H

/* NOLINTBEGIN */
#include "buffer.h"
#include "doubly_linked_list.h"
#include "flat_double_ended_queue.h"
#include "flat_hash_map.h"
#include "flat_ordered_map.h"
#include "flat_priority_queue.h"
#include "flat_realtime_ordered_map.h"
#include "ordered_map.h"
#include "ordered_multimap.h"
#include "priority_queue.h"
#include "realtime_ordered_map.h"
#include "singly_linked_list.h"
#include "types.h"
#include "../buffer.h"
#include "../doubly_linked_list.h"
#include "../flat_double_ended_queue.h"
#include "../flat_hash_map.h"
#include "../flat_ordered_map.h"
#include "../flat_priority_queue.h"
#include "../flat_realtime_ordered_map.h"
#include "../ordered_map.h"
#include "../ordered_multimap.h"
#include "../priority_queue.h"
#include "../realtime_ordered_map.h"
#include "../singly_linked_list.h"
#include "../types.h"
/* NOLINTEND */

/*====================== Entry Interface
* =====================================*/
/*====================== Entry Interface ==============================*/

#define ccc_impl_insert(container_ptr, insert_args...) \
_Generic((container_ptr), \
Expand Down Expand Up @@ -283,8 +282,7 @@
ccc_romap_entry *: ccc_rom_insert_error, \
ccc_romap_entry const *: ccc_rom_insert_error)((container_entry_ptr))

/*====================== Misc Search Interface
* ================================*/
/*====================== Misc Search Interface ===========================*/

#define ccc_impl_get_key_val(container_ptr, key_ptr...) \
_Generic((container_ptr), \
Expand All @@ -311,7 +309,7 @@
ccc_realtime_ordered_map const *: ccc_rom_contains, \
ccc_ordered_multimap *: ccc_omm_contains)((container_ptr), key_ptr)

/*================ Sequential Containers Interface =====================*/
/*================ Sequential Containers Interface =====================*/

#define ccc_impl_push(container_ptr, container_handle_ptr...) \
_Generic((container_ptr), \
Expand Down Expand Up @@ -591,8 +589,7 @@
ccc_doubly_linked_list const *: ccc_dll_splice_range)( \
(container_ptr), splice_range_args)

/*=================== Standard Getters Interface
* ==============================*/
/*=================== Standard Getters Interface =======================*/

#define ccc_impl_size(container_ptr) \
_Generic((container_ptr), \
Expand Down
Loading

0 comments on commit b6cdc48

Please sign in to comment.