Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cbor binding #627

Merged
merged 12 commits into from
Jun 24, 2024
Merged

cbor binding #627

merged 12 commits into from
Jun 24, 2024

Conversation

TingDaoK
Copy link
Contributor

@TingDaoK TingDaoK commented Jun 12, 2024

Issue #, if available:

Description of changes:

  • Bare minimal binding for cbor

  • follow up:

    • Overload to support std::string for text and bytes?
    • Array and map support from stdlib?
    • Time stamp support? std::chrono::system_clock::time_point?
  • We will need those follow up for sure, but debatable about where they should live, maybe in C++ SDK? Or maybe in crt-ccp, we should hold for the follow-ups until C++ SDK picks up the integration job

Won't merge until the C code merge to main and the follow up has been addressed

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TingDaoK TingDaoK marked this pull request as ready for review June 13, 2024 22:48
@TingDaoK TingDaoK changed the title cbor binding cbor binding -- main Jun 13, 2024
IndefMapStart = AWS_CBOR_TYPE_INDEF_MAP_START,
};

class AWS_CRT_CPP_API CborEncoder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add final if destructor is not virtual

CMakeLists.txt Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
*****************************************************/
CborEncoder::CborEncoder(Crt::Allocator *allocator) noexcept
{
m_encoder = aws_cbor_encoder_new(allocator);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no possible way that aws_cbor_encoder_new() or aws_cbor_decoder_new() could ever return NULL in the future, right? right?

if so, we won't want to use normal C++ constructors, because they can't fail without the use of exceptions, which we turn off

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we will error let the new function fail for the encoder and decoder, besides of allocation failure

include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
include/aws/crt/cbor/Cbor.h Outdated Show resolved Hide resolved
@TingDaoK TingDaoK requested a review from graebm June 24, 2024 16:36
Copy link
Contributor

@graebm graebm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix & ship

include/aws/crt/cbor/Cbor.h Show resolved Hide resolved
@TingDaoK TingDaoK changed the title cbor binding -- main cbor binding Jun 24, 2024
@TingDaoK TingDaoK merged commit 55f2a48 into main Jun 24, 2024
59 checks passed
@TingDaoK TingDaoK deleted the cbor branch June 24, 2024 18:54
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.

3 participants