Skip to content

Commit

Permalink
RDF 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthäus G. Chajdas authored and Matthäus G. Chajdas committed Sep 23, 2022
1 parent a86bfd7 commit f32c2fb
Show file tree
Hide file tree
Showing 19 changed files with 53 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
cmake_minimum_required(VERSION 3.13..3.21)
project(rdf LANGUAGES CXX)

Expand Down
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ The `amdrdf` library provides the following forwards/backwards compatibility gua
* New major versions *may* add, remove or change entry points. Files created by a newer major version *may* not be compatible with older *major* versions. Files created by an older major version will be supported for *at least* the next higher major version.
* A minor version can deprecate a function, but that function can be only removed in the next major release.

Use `RDF_INTERFACE_VERSION` and `RDF_MAKE_VERSION` to check for the library version.
Use `RDF_INTERFACE_VERSION` and `RDF_MAKE_VERSION` to check for the library version.

## Changelog

Interface-level changes only:

* **1.0**: Initial release
* **1.1**: Improve naming consistency: Add `rdfStreamFromUserStream`, mark `rdfStreamCreateFromUserStream` as deprecated

2 changes: 1 addition & 1 deletion imported/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
add_subdirectory(zstd)

# This allows clients of RDF to have their own copy of catch2/cli11/json, and
Expand Down
2 changes: 1 addition & 1 deletion imported/catch2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
project(Catch2)
add_library(catch2 INTERFACE)
target_include_directories(catch2 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
2 changes: 1 addition & 1 deletion imported/cli11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
project(CLI11 VERSION 1.9.1)
add_library(cli11 INTERFACE)
target_include_directories(cli11 INTERFACE ${CMAKE_CURRENT_LIST_DIR})
2 changes: 1 addition & 1 deletion imported/json/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
project(json VERSION 3.9.1)
add_library(json INTERFACE)
target_include_directories(json INTERFACE ${CMAKE_CURRENT_LIST_DIR})
2 changes: 1 addition & 1 deletion imported/zstd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
project(zstd VERSION 1.4.5)
add_library(zstd STATIC src/zstd.c)
target_include_directories(zstd PUBLIC ${CMAKE_CURRENT_LIST_DIR}/inc)
Expand Down
2 changes: 1 addition & 1 deletion rdf/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
if (RDF_STATIC)
add_library(amdrdf STATIC)
else()
Expand Down
22 changes: 20 additions & 2 deletions rdf/inc/amdrdf.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#pragma once

#include <cstddef>
Expand All @@ -24,7 +24,7 @@
((static_cast<std::uint32_t>(major) << 22) | \
(static_cast<std::uint32_t>(minor) << 12))

#define RDF_INTERFACE_VERSION RDF_MAKE_VERSION(1, 0)
#define RDF_INTERFACE_VERSION RDF_MAKE_VERSION(1, 1)

extern "C" {
struct rdfChunkFile;
Expand Down Expand Up @@ -151,7 +151,18 @@ int RDF_EXPORT rdfStreamFromReadOnlyMemory(const std::int64_t size,
const void* buffer,
rdfStream** stream);
int RDF_EXPORT rdfStreamCreateMemoryStream(rdfStream** stream);

/**
* @deprecated Use `rdfStreamFromUserStream` instead
*
* This entry point will be removed in the next major version
*/
int RDF_EXPORT rdfStreamCreateFromUserStream(const rdfUserStream* userStream, rdfStream** stream);

/**
* @since 1.1
*/
int RDF_EXPORT rdfStreamFromUserStream(const rdfUserStream* userStream, rdfStream** stream);
int RDF_EXPORT rdfStreamClose(rdfStream** stream);

int RDF_EXPORT rdfStreamRead(rdfStream*,
Expand Down Expand Up @@ -325,6 +336,13 @@ class Stream final
return result;
}

static Stream FromUserStream(const rdfUserStream* userStream)
{
Stream result;
RDF_CHECK_CALL(rdfStreamFromUserStream(userStream, &result.stream_));
return result;
}

~Stream()
{
if (stream_) {
Expand Down
10 changes: 8 additions & 2 deletions rdf/src/amdrdf.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#include "amdrdf.h"

#include <zstd/zstd.h>
Expand Down Expand Up @@ -1308,11 +1308,17 @@ int RDF_EXPORT rdfStreamCreateMemoryStream(rdfStream** handle)
RDF_C_API_END
}

//////////////////////////////////////////////////////////////////////////////
int RDF_EXPORT rdfStreamCreateFromUserStream(const rdfUserStream* userStream, rdfStream** handle)
{
return rdfStreamFromUserStream(userStream, handle);
}

//////////////////////////////////////////////////////////////////////////////
/**
Create a memory stream based on user provided callbacks.
*/
int RDF_EXPORT rdfStreamCreateFromUserStream(const rdfUserStream* userStream, rdfStream** handle)
int RDF_EXPORT rdfStreamFromUserStream(const rdfUserStream* userStream, rdfStream** handle)
{
RDF_C_API_BEGIN

Expand Down
2 changes: 1 addition & 1 deletion rdf/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
add_executable(rdf.Test)
target_sources(rdf.Test PRIVATE
inc/test_rdf.h
Expand Down
2 changes: 1 addition & 1 deletion rdf/test/src/IO_test.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#include <catch2/catch.hpp>

#include "amdrdf.h"
Expand Down
2 changes: 1 addition & 1 deletion rdf/test/src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
2 changes: 1 addition & 1 deletion rdfg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
add_executable(rdfg)
target_sources(rdfg PRIVATE
src/rdfg.cpp)
Expand Down
2 changes: 1 addition & 1 deletion rdfg/src/rdfg.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#include <cli11/CLI11.hpp>
#include <json/json.hpp>

Expand Down
2 changes: 1 addition & 1 deletion rdfi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
add_executable(rdfi)
target_sources(rdfi PRIVATE
src/rdfi.cpp)
Expand Down
2 changes: 1 addition & 1 deletion rdfi/src/rdfi.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#include <cli11/CLI11.hpp>
#include <json/json.hpp>

Expand Down
2 changes: 1 addition & 1 deletion rdfm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. ###
### Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. ###
add_executable(rdfm)
target_sources(rdfm PRIVATE
src/rdfm.cpp)
Expand Down
2 changes: 1 addition & 1 deletion rdfm/src/rdfm.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved. */
/* Copyright (c) 2021-2022 Advanced Micro Devices, Inc. All rights reserved. */
#include <cli11/CLI11.hpp>
#include <json/json.hpp>

Expand Down

0 comments on commit f32c2fb

Please sign in to comment.