Skip to content

Commit

Permalink
feat!: remove _ten field from the output of to_json (#316)
Browse files Browse the repository at this point in the history
  • Loading branch information
halajohn authored Nov 23, 2024
1 parent a805290 commit 80742c3
Show file tree
Hide file tree
Showing 279 changed files with 4,080 additions and 7,053 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"request": "launch",
"program": "${workspaceFolder}/out/linux/x64/tests/standalone/ten_runtime_smoke_test",
"args": [
"--gtest_filter=ExtensionTest.GraphPolygonInOneAppReturnAll"
"--gtest_filter=AudioFrameTest.FromJson"
],
"cwd": "${workspaceFolder}/out/linux/x64/tests/standalone/",
"env": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace ten {

class extension_t;
class ten_env_tester_t;
class cmd_result_internal_accessor_t;

class cmd_result_t : public msg_t {
private:
Expand Down Expand Up @@ -74,6 +75,7 @@ class cmd_result_t : public msg_t {
friend extension_t;
friend ten_env_tester_t;
friend ten_env_t;
friend cmd_result_internal_accessor_t;

static std::unique_ptr<cmd_result_t> create(ten_shared_ptr_t *cmd,
error_t *err = nullptr) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// Copyright © 2024 Agora
// This file is part of TEN Framework, an open source project.
// Licensed under the Apache License, Version 2.0, with certain conditions.
// Refer to the "LICENSE" file in the root directory for more information.
//
#pragma once

#include "ten_runtime/binding/cpp/internal/msg/cmd_result.h"

namespace ten {

class cmd_result_internal_accessor_t {
public:
explicit cmd_result_internal_accessor_t() = default;
~cmd_result_internal_accessor_t() = default;

// @{
cmd_result_internal_accessor_t(const cmd_result_internal_accessor_t &) =
delete;
cmd_result_internal_accessor_t(cmd_result_internal_accessor_t &&) = delete;
cmd_result_internal_accessor_t &operator=(
const cmd_result_internal_accessor_t &) = delete;
cmd_result_internal_accessor_t &operator=(cmd_result_internal_accessor_t &&) =
delete;
// @}

static std::unique_ptr<cmd_result_t> create(ten_shared_ptr_t *cmd,
error_t *err = nullptr) {
return ten::cmd_result_t::create(cmd, err);
}
};

} // namespace ten
3 changes: 0 additions & 3 deletions core/include_internal/ten_runtime/common/loc.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ TEN_RUNTIME_PRIVATE_API void ten_loc_init_from_loc(ten_loc_t *self,
TEN_RUNTIME_PRIVATE_API void ten_loc_init_from_value(ten_loc_t *self,
ten_value_t *value);

TEN_RUNTIME_PRIVATE_API void ten_loc_init_from_json(ten_loc_t *self,
ten_json_t *json);

TEN_RUNTIME_PRIVATE_API void ten_loc_deinit(ten_loc_t *self);

TEN_RUNTIME_PRIVATE_API void ten_loc_set(ten_loc_t *self, const char *app_uri,
Expand Down
10 changes: 0 additions & 10 deletions core/include_internal/ten_runtime/msg/audio_frame/audio_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ TEN_RUNTIME_PRIVATE_API void ten_raw_audio_frame_destroy(
TEN_RUNTIME_PRIVATE_API ten_msg_t *ten_raw_audio_frame_as_msg_clone(
ten_msg_t *self, ten_list_t *excluded_field_ids);

TEN_RUNTIME_PRIVATE_API ten_json_t *ten_raw_audio_frame_as_msg_to_json(
ten_msg_t *self, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_audio_frame_check_type_and_name(
ten_msg_t *self, const char *type_str, const char *name_str,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API int32_t
ten_raw_audio_frame_get_samples_per_channel(ten_audio_frame_t *self);

Expand Down Expand Up @@ -127,9 +120,6 @@ TEN_RUNTIME_PRIVATE_API bool ten_raw_audio_frame_set_data_fmt(
TEN_RUNTIME_PRIVATE_API bool ten_raw_audio_frame_set_timestamp(
ten_audio_frame_t *self, int64_t timestamp);

TEN_RUNTIME_PRIVATE_API bool ten_raw_audio_frame_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_value_t *ten_raw_audio_frame_peek_ten_property(
ten_msg_t *self, ten_list_t *paths, ten_error_t *err);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ typedef struct ten_cmd_close_app_t {
ten_cmd_t cmd_hdr;
} ten_cmd_close_app_t;

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_close_app_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_close_app_as_msg_destroy(
ten_msg_t *self);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ typedef struct ten_cmd_t ten_cmd_t;
TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_custom_set_ten_property(
ten_msg_t *self, ten_list_t *paths, ten_value_t *value, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_custom_check_type_and_name(
ten_msg_t *self, const char *type_str, const char *name_str,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_custom_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_custom_as_msg_destroy(ten_msg_t *self);

TEN_RUNTIME_PRIVATE_API ten_msg_t *ten_raw_cmd_custom_as_msg_clone(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,6 @@ ten_cmd_start_graph_get_requested_extension_names(ten_shared_ptr_t *self);
TEN_RUNTIME_PRIVATE_API void ten_cmd_start_graph_fill_loc_info(
ten_shared_ptr_t *self, const char *app_uri, const char *graph_id);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_start_graph_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_start_graph_init_from_json(
ten_cmd_start_graph_t *self, ten_json_t *json, ten_error_t *err);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ TEN_RUNTIME_PRIVATE_API ten_string_t *ten_cmd_stop_graph_get_graph_id(
TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_stop_graph_as_msg_destroy(
ten_msg_t *self);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_stop_graph_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_cmd_stop_graph_t *ten_raw_cmd_stop_graph_create(
void);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ typedef struct ten_cmd_timeout_t {
TEN_RUNTIME_PRIVATE_API void ten_cmd_timeout_set_timer_id(
ten_shared_ptr_t *self, uint32_t timer_id);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_timeout_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_shared_ptr_t *ten_cmd_timeout_create(
uint32_t timer_id);

Expand All @@ -34,9 +31,6 @@ TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_timeout_set_timer_id(
TEN_RUNTIME_PRIVATE_API uint32_t
ten_raw_cmd_timeout_get_timer_id(ten_cmd_timeout_t *self);

TEN_RUNTIME_PRIVATE_API ten_json_t *ten_raw_cmd_timeout_as_msg_to_json(
ten_msg_t *self, ten_error_t *err);

TEN_RUNTIME_API uint32_t ten_cmd_timeout_get_timer_id(ten_shared_ptr_t *self);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_timeout_loop_all_fields(
Expand Down
10 changes: 0 additions & 10 deletions core/include_internal/ten_runtime/msg/cmd_base/cmd/timer/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ typedef struct ten_cmd_timer_t {
TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_timer_set_ten_property(
ten_msg_t *self, ten_list_t *paths, ten_value_t *value, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_timer_check_type_and_name(
ten_msg_t *self, const char *type_str, const char *name_str,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_timer_set_timer_id(
ten_cmd_timer_t *self, uint32_t timer_id);

Expand Down Expand Up @@ -67,14 +63,8 @@ TEN_RUNTIME_PRIVATE_API int32_t ten_cmd_timer_get_times(ten_shared_ptr_t *self);
TEN_RUNTIME_API bool ten_cmd_timer_set_times(ten_shared_ptr_t *self,
int32_t times);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_timer_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_timer_as_msg_destroy(ten_msg_t *self);

TEN_RUNTIME_PRIVATE_API ten_json_t *ten_raw_cmd_timer_as_msg_to_json(
ten_msg_t *self, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_cmd_timer_t *ten_raw_cmd_timer_create(void);

TEN_RUNTIME_API ten_shared_ptr_t *ten_cmd_timer_create(void);
Expand Down
6 changes: 0 additions & 6 deletions core/include_internal/ten_runtime/msg/cmd_base/cmd_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,6 @@ TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_base_save_cmd_id_to_parent_cmd_id(
TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_base_set_seq_id(ten_cmd_base_t *self,
const char *seq_id);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_base_get_field_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_base_put_field_to_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_cmd_base_cmd_id_is_empty(
ten_shared_ptr_t *self);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,9 @@ TEN_RUNTIME_PRIVATE_API void ten_cmd_result_set_original_cmd_type(
TEN_RUNTIME_PRIVATE_API TEN_MSG_TYPE
ten_cmd_result_get_original_cmd_type(ten_shared_ptr_t *self);

TEN_RUNTIME_PRIVATE_API bool ten_raw_cmd_result_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_msg_t *ten_raw_cmd_result_as_msg_clone(
ten_msg_t *self, TEN_UNUSED ten_list_t *excluded_field_ids);

TEN_RUNTIME_PRIVATE_API ten_json_t *ten_raw_cmd_result_as_msg_to_json(
ten_msg_t *self, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API void ten_raw_cmd_result_destroy(ten_cmd_result_t *self);

TEN_RUNTIME_PRIVATE_API TEN_STATUS_CODE
Expand Down
10 changes: 0 additions & 10 deletions core/include_internal/ten_runtime/msg/data/data.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,8 @@ TEN_RUNTIME_PRIVATE_API void ten_raw_data_buf_copy(
TEN_RUNTIME_PRIVATE_API ten_msg_t *ten_raw_data_as_msg_clone(
ten_msg_t *self, ten_list_t *excluded_field_ids);

TEN_RUNTIME_PRIVATE_API bool ten_raw_data_as_msg_init_from_json(
ten_msg_t *self, ten_json_t *json, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_json_t *ten_raw_data_as_msg_to_json(
ten_msg_t *self, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_data_loop_all_fields(
ten_msg_t *self, ten_raw_msg_process_one_field_func_t cb, void *user_data,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API void ten_raw_data_destroy(ten_data_t *self);

TEN_RUNTIME_PRIVATE_API bool ten_raw_data_check_type_and_name(
ten_msg_t *self, const char *type_str, const char *name_str,
ten_error_t *err);
8 changes: 8 additions & 0 deletions core/include_internal/ten_runtime/msg/msg.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,18 @@ TEN_RUNTIME_PRIVATE_API bool ten_raw_msg_get_one_field_from_json(
ten_msg_t *self, ten_msg_field_process_data_t *field, void *user_data,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool
ten_raw_msg_get_one_field_from_json_include_internal_field(
ten_msg_t *self, ten_msg_field_process_data_t *field, void *user_data,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_msg_put_one_field_to_json(
ten_msg_t *self, ten_msg_field_process_data_t *field, void *user_data,
ten_error_t *err);

TEN_RUNTIME_PRIVATE_API ten_json_t *ten_msg_to_json_include_internal_field(
ten_shared_ptr_t *self, ten_error_t *err);

TEN_RUNTIME_PRIVATE_API bool ten_raw_msg_process_field(
ten_msg_t *self, ten_raw_msg_process_one_field_func_t cb, void *user_data,
ten_error_t *err);
Expand Down
Loading

0 comments on commit 80742c3

Please sign in to comment.