<PREFIX>_<NAME>_t *handle = data;
rpc_port_unit_map_h map;
char index[12];
- int ret;
int i;
if (parcel == nullptr || handle == nullptr) {
}
rpc_port_parcel_read(parcel, &map->parcelable, map);
-
- ret = rpc_port_unit_map_read_int(map, "size", &handle->size);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read size. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
+ rpc_port_unit_map_read_int(map, "size", &handle->size);
handle->value = calloc(handle->size, sizeof(<ELEMENT_TYPE_SIZE>));
if (handle->value == nullptr) {
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
return ret;
*/
constexpr const char CB_STRUCTURE_ARRAY_USER_DEFINED_UNIT_MAP_READ[] =
R"__c_cb(
-ret = rpc_port_unit_map_read_<TYPE_NAME>(map, index, &handle->value[i]);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map, index, &handle->value[i]);
)__c_cb";
constexpr const char CB_STRUCTURE_ARRAY_ENUM_UNIT_MAP_READ[] =
R"__c_cb(
-ret = rpc_port_unit_map_read_int(map, index, (int *)&handle->value[i]);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read int. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
+rpc_port_unit_map_read_int(map, index, (int *)&handle->value[i]);
)__c_cb";
constexpr const char CB_STRUCTURE_ARRAY_BUNDLE_UNIT_MAP_READ[] =
R"__c_cb(
-ret = rpc_port_unit_map_read_bundle(map, index, &handle->value[i]);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read bundle. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
+rpc_port_unit_map_read_bundle(map, index, &handle->value[i]);
)__c_cb";
constexpr const char CB_STRUCTURE_ARRAY_STRING_UNIT_MAP_READ[] =
R"__c_cb(
-ret = rpc_port_unit_map_read_string(map, index, &handle->value[i]);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read string. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
+rpc_port_unit_map_read_string(map, index, &handle->value[i]);
)__c_cb";
/**
*/
constexpr const char CB_STRUCTURE_ARRAY_BASE_UNIT_MAP_READ[] =
R"__c_cb(
-ret = rpc_port_unit_map_read_<TYPE_NAME>(map, index, &handle->value[i]);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map, index, &handle->value[i]);
)__c_cb";
/**
rpc_port_unit_h unit = user_data;
unsigned char *raw;
int size = 0;
- int ret;
-
- ret = rpc_port_parcel_read_string(parcel, &unit->name);
- if (ret != RPC_PORT_ERROR_NONE) {
- set_last_result(ret);
- return;
- }
-
- ret = rpc_port_parcel_read_string(parcel, &unit->type);
- if (ret != RPC_PORT_ERROR_NONE) {
- set_last_result(ret);
- return;
- }
- ret = rpc_port_parcel_read_array_count(parcel, &size);
- if (ret != RPC_PORT_ERROR_NONE) {
- set_last_result(ret);
- return;
- }
+ rpc_port_parcel_read_string(parcel, &unit->name);
+ rpc_port_parcel_read_string(parcel, &unit->type);
+ rpc_port_parcel_read_array_count(parcel, &size);
raw = malloc(size);
if (raw == nullptr) {
return;
}
- ret = rpc_port_parcel_burst_read(parcel, (void *)raw, size);
- if (ret != RPC_PORT_ERROR_NONE) {
- free(raw);
- set_last_result(ret);;
- return;
- }
-
- ret = rpc_port_parcel_burst_write(unit->parcel, raw, size);
+ rpc_port_parcel_burst_read(parcel, (void *)raw, size);
+ rpc_port_parcel_burst_write(unit->parcel, raw, size);
free(raw);
- set_last_result(ret);
+ set_last_result(RPC_PORT_ERROR_NONE);
}
static void rpc_port_unit_destroy(gpointer user_data)
*/
constexpr const char CB_UNIT_MAP_USER_DEFINED_READ[] =
R"__c_cb(
-static int rpc_port_unit_map_read_<TYPE_NAME>(rpc_port_unit_map_h unit_map,
+static void rpc_port_unit_map_read_<TYPE_NAME>(rpc_port_unit_map_h unit_map,
const char *name, <PARAM_TYPE_OUT>value)
{
rpc_port_unit_h unit;
<PARAM_TYPE_IN>handle;
int ret;
- if (unit_map == nullptr || name == nullptr || value == nullptr)
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ if (value == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ ret = <PARAM_TYPE_CTOR>((<PARAM_TYPE_OUT>)&handle);
+ if (ret != RPC_PORT_ERROR_NONE) {
+ *value = nullptr;
+ return;
+ }
+
+ *value = handle;
+ if (unit_map == nullptr || name == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
unit = g_hash_table_lookup(unit_map->table, name);
if (unit == nullptr) {
_E("g_hash_table_lookup() is failed. name: %s", name);
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
if (strncmp(unit->type, "<FULL_TYPE_NAME>", strlen("<FULL_TYPE_NAME>")) != 0) {
_E("type(%s) is not <FULL_TYPE_NAME>", unit->type);
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
- ret = <PARAM_TYPE_CTOR>((<PARAM_TYPE_OUT>)&handle);
- if (ret != RPC_PORT_ERROR_NONE)
- return ret;
-
- *value = handle;
rpc_port_parcel_read(unit->parcel, &handle->parcelable, handle);
-
- return get_last_result();
}
)__c_cb";
constexpr const char CB_UNIT_MAP_DELEGATE_READ[] =
R"__c_cb(
-static int rpc_port_unit_map_read_delegate(rpc_port_unit_map_h unit_map,
+static void rpc_port_unit_map_read_delegate(rpc_port_unit_map_h unit_map,
const char *name, rpc_port_delegate_h *value)
{
rpc_port_unit_h unit;
rpc_port_delegate_h delegate;
- if (unit_map == nullptr || name == nullptr || value == nullptr)
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ if (value == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ delegate = rpc_port_delegate_create();
+ *value = delegate;
+
+ if (delegate == nullptr)
+ return;
+
+ if (unit_map == nullptr || name == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
unit = g_hash_table_lookup(unit_map->table, name);
if (unit == nullptr) {
_E("g_hash_table_lookup() is failed. name: %s", name);
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
if (strcmp(unit->type, "delegate") != 0) {
_E("type(%s) is not delegate", unit->type);
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
- delegate = rpc_port_delegate_create();
- if (delegate == NULL)
- return RPC_PORT_ERROR_OUT_OF_MEMORY;
-
- *value = delegate;
rpc_port_parcel_read(unit->parcel, &delegate->parcelable, delegate);
-
- return get_last_result();
}
)__c_cb";
constexpr const char CB_UNIT_MAP_BUNDLE_READ[] =
R"__c_cb(
-static int rpc_port_unit_map_read_bundle(rpc_port_unit_map_h unit_map,
+static void rpc_port_unit_map_read_bundle(rpc_port_unit_map_h unit_map,
const char *name, bundle **value)
{
rpc_port_unit_h unit;
- if (unit_map == nullptr || name == nullptr || value == nullptr)
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ if (value == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ if (unit_map == nullptr || name == nullptr) {
+ *value = bundle_create();
+ _E("Invalid parameter");
+ return;
+ }
unit = g_hash_table_lookup(unit_map->table, name);
if (unit == nullptr) {
_E("g_hash_table_lookup() is failed. name: %s", name);
*value = bundle_create();
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
if (strcmp(unit->type, "bundle") != 0) {
_E("type(%s) is not bundle", unit->type);
*value = bundle_create();
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
- return rpc_port_parcel_read_bundle(unit->parcel, value);
+ rpc_port_parcel_read_bundle(unit->parcel, value);
}
)__c_cb";
constexpr const char CB_UNIT_MAP_STRING_READ[] =
R"__c_cb(
-static int rpc_port_unit_map_read_string(rpc_port_unit_map_h unit_map,
+static void rpc_port_unit_map_read_string(rpc_port_unit_map_h unit_map,
const char *name, char **value)
{
rpc_port_unit_h unit;
- if (unit_map == nullptr || name == nullptr || value == nullptr)
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ if (value == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ if (unit_map == nullptr || name == nullptr) {
+ *value = strdup("");
+ _E("Invalid parameter");
+ return;
+ }
unit = g_hash_table_lookup(unit_map->table, name);
if (unit == nullptr) {
_E("g_hash_table_lookup() is failed. name: %s", name);
*value = strdup("");
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
if (strcmp(unit->type, "string") != 0) {
_E("type(%s) is not string", unit->type);
*value = strdup("");
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
- return rpc_port_parcel_read_string(unit->parcel, value);
+ rpc_port_parcel_read_string(unit->parcel, value);
}
)__c_cb";
*/
constexpr const char CB_UNIT_MAP_BASE_READ[] =
R"__c_cb(
-static int rpc_port_unit_map_read_<TYPE_NAME>(rpc_port_unit_map_h unit_map,
+static void rpc_port_unit_map_read_<TYPE_NAME>(rpc_port_unit_map_h unit_map,
const char *name, <PARAM_TYPE>value)
{
rpc_port_unit_h unit;
- if (unit_map == nullptr || name == nullptr || value == nullptr)
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ if (value == nullptr) {
+ _E("Invalid parameter");
+ return;
+ }
+
+ if (unit_map == nullptr || name == nullptr) {
+ *value = 0;
+ _E("Invalid parameter");
+ return;
+ }
unit = g_hash_table_lookup(unit_map->table, name);
if (unit == nullptr) {
_E("g_hash_table_lookup() is failed. name: %s", name);
*value = 0;
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
if (strcmp(unit->type, "<TYPE_NAME>") != 0) {
_E("type(%s) is not <TYPE_NAME>", unit->type);
*value = 0;
- return RPC_PORT_ERROR_INVALID_PARAMETER;
+ return;
}
- return rpc_port_parcel_read_<PARCEL_TYPE>(unit->parcel, value);
+ rpc_port_parcel_read_<PARCEL_TYPE>(unit->parcel, value);
}
)__c_cb";
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
return ret;
return ret;
}
- ret = rpc_port_unit_map_read_remote_exception(map, "clone", h);
+ rpc_port_unit_map_read_remote_exception(map, "clone", h);
rpc_port_unit_map_destroy(map);
return RPC_PORT_ERROR_NONE;
__<PREFIX>_remote_exception = nullptr;
}
- ret = rpc_port_unit_map_read_remote_exception(map, "clone", &__<PREFIX>_remote_exception);
+ rpc_port_unit_map_read_remote_exception(map, "clone", &__<PREFIX>_remote_exception);
rpc_port_unit_map_destroy(map);
return ret;
<DATA_TYPE>value = nullptr;
rpc_port_unit_map_h map;
char index[12];
- int ret;
int len = 0;
int i;
rpc_port_parcel_read(parcel, &map->parcelable, map);
- ret = rpc_port_unit_map_read_int(parcel, "length", &len);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read length. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
+ rpc_port_unit_map_read_int(parcel, "length", &len);
for (i = 0; i < len; ++i) {
snprintf(index, sizeof(index), "%d", i);
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
return ret;
constexpr const char CB_STRUCTURE_LIST_USER_DEFINED_UNIT_MAP_READ[] =
R"__c_cb(
value = nullptr;
-ret = rpc_port_unit_map_read_<TYPE_NAME>(map, index, &value);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
-
+rpc_port_unit_map_read_<TYPE_NAME>(map, index, &value);
handle->list = g_list_append(handle->list, value);
)__c_cb";
return;
}
-ret = rpc_port_unit_map_read_int(map, index, (int*)&value);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read int. error(%d)", ret);
- free(value);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
-
+rpc_port_unit_map_read_int(map, index, (int*)&value);
handle->list = g_list_append(handle->list, value);
)__c_cb";
constexpr const char CB_STRUCTURE_LIST_BUNDLE_UNIT_MAP_READ[] =
R"__c_cb(
value = nullptr;
-ret = rpc_port_unit_map_read_bundle(map, index, &value);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read bundle. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
-
+rpc_port_unit_map_read_bundle(map, index, &value);
handle->list = g_list_append(handle->list, value);
)__c_cb";
constexpr const char CB_STRUCTURE_LIST_STRING_UNIT_MAP_READ[] =
R"__c_cb(
value = nullptr;
-ret = rpc_port_unit_map_read_string(map, index, &value);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read string. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
-
+rpc_port_unit_map_read_string(map, index, &value);
handle->list = g_list_append(handle->list, value);
)__c_cb";
return;
}
-ret = rpc_port_unit_map_read_<TYPE_NAME>(map, index, value);
-if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret);
- free(value);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
-}
-
+rpc_port_unit_map_read_<TYPE_NAME>(map, index, value);
handle->list = g_list_append(handle->list, value);
)__c_cb";
rpc_port_parcel_read(parcel, &map->parcelable, map);
- ret = rpc_port_unit_map_read_int(map, "size", &size);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read size. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
+ rpc_port_unit_map_read_int(map, "size", &size);
for (i = 0; i < size; ++i) {
snprintf(name, sizeof(name), "key-%d", i);
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
return ret;
rpc_port_parcel_read(parcel, &map->parcelable, map);
- ret = rpc_port_unit_map_read_int(map, "size", &size);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read size. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
+ rpc_port_unit_map_read_int(map, "size", &size);
for (i = 0; i < size; ++i) {
snprintf(name, sizeof(name), "key-%d", i);
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
return ret;
constexpr const char CB_INTERFACE_METHOD_USER_DEFINED_UNIT_MAP_READ[] =
R"__c_cb(
<ARG> = nullptr;
-ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_EMUM_UNIT_MAP_READ[] =
R"__c_cb(
-res_ = rpc_port_unit_map_read_int(map_, "<ARG_NAME>", (int *)&<ARG>);
-if (res_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", res_);
- rpc_port_unit_map_destroy(map_);
- break;
-}
+rpc_port_unit_map_read_int(map_, "<ARG_NAME>", (int *)&<ARG>);
)__c_cb";
/**
constexpr const char CB_INTERFACE_METHOD_BUNDLE_UNIT_MAP_READ[] =
R"__c_cb(
<ARG> = nullptr;
-ret_ = rpc_port_unit_map_read_bundle(map_, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read bundle. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_bundle(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
constexpr const char CB_INTERFACE_METHOD_STRING_UNIT_MAP_READ[] =
R"__c_cb(
<ARG> = nullptr;
-ret_ = rpc_port_unit_map_read_string(map_, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read string. error(%d)", ret_);
- goto out;
-}
+= rpc_port_unit_map_read_string(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_BASE_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
{
<PREFIX>_<NAME>_<DELEGATE_NAME>_h h = data;
rpc_port_unit_map_h map;
- int ret;
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
}
rpc_port_parcel_read(parcel, &map->parcelable, map);
+ rpc_port_unit_map_read_int(map, "id", &h->id);
+ rpc_port_unit_map_read_int(map, "seq_id", &h->seq_id);
+ rpc_port_unit_map_read_bool(map, "once", &h->once);
- ret = rpc_port_unit_map_read_int(map, "id", &h->id);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read id. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
-
- ret = rpc_port_unit_map_read_int(map, "seq_id", &h->seq_id);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read seq_id. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
-
- ret = rpc_port_unit_map_read_bool(map, "once", &h->once);
rpc_port_unit_map_destroy(map);
_I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false");
- set_last_result(ret);
+ set_last_result(RPC_PORT_ERROR_NONE);
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_create(<PREFIX>_<NAME>_<DELEGATE_NAME>_h *h)
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>_<DELEGATE_NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>_<DELEGATE_NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
return ret;
<PREFIX>_<NAME>_<DELEGATE_NAME>_h handle;
GList *iter;
bool once;
- int ret_;
+
<DELEGATE_ARGS_DECL>
<DELEGATE_UNIT_MAP_READ>
}
}
-out:
<DELEGATE_ARGS_FREE>
return;
}
*/
constexpr const char CB_INTERFACE_DELEGATE_USER_DEFINED_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_DELEGATE_BUNDLE_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_bundle(map, "<ARG>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read bundle. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_bundle(map, "<ARG>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_DELEGATE_STRING_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_string(map, "<ARG>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read string. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_string(map, "<ARG>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_DELEGATE_ENUM_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_int(map, "<ARG_NAME>", (int *)&<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_int(map, "<ARG_NAME>", (int *)&<ARG>);
)__c_cb";
*/
constexpr const char CB_INTERFACE_DELEGATE_BASE_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
static void __<PREFIX>_<NAME>_process_received_event(GList **delegates, rpc_port_unit_map_h map)
{
rpc_port_delegate_h delegate;
- int ret;
- ret = rpc_port_unit_map_read_delegate(map, "delegate", &delegate);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read delegate. error(%d)", ret);
- return;
- }
+ rpc_port_unit_map_read_delegate(map, "delegate", &delegate);
_W("id(%d), seq_id(%d)", delegate->id, delegate->seq_id);
*/
constexpr const char CB_INTERFACE_METHOD_USER_DEFINED_UNIT_MAP_READ[] =
R"__c_cb(
-res_ = rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
-if (res_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", res_);
- rpc_port_unit_map_destroy(map_);
- break;
-}
+ rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_BUNDLE_UNIT_MAP_READ[] =
R"__c_cb(
-res_ = rpc_port_unit_map_read_bundle(map_, "<ARG_NAME>", &<ARG>);
-if (res_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read bundle. error(%d)", res_);
- rpc_port_unit_map_destroy(map_);
- break;
-}
+rpc_port_unit_map_read_bundle(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_STRING_UNIT_MAP_READ[] =
R"__c_cb(
-res_ = rpc_port_unit_map_read_string(map_, "<ARG_NAME>", &<ARG>);
-if (res_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read string. error(%d)", res_);
- rpc_port_unit_map_destroy(map_);
- break;
-}
+rpc_port_unit_map_read_string(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_EMUM_UNIT_MAP_READ[] =
R"__c_cb(
-res_ = rpc_port_unit_map_read_int(map_, "<ARG_NAME>", (int *)&<ARG>);
-if (res_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", res_);
- rpc_port_unit_map_destroy(map_);
- break;
-}
+rpc_port_unit_map_read_int(map_, "<ARG_NAME>", (int *)&<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_BASE_UNIT_MAP_READ[] =
R"__c_cb(
-res_ = rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
-if (res_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", res_);
- rpc_port_unit_map_destroy(map_);
- break;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map_, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
{
<PREFIX>_<NAME>_<DELEGATE_NAME>_h h = user_data;
rpc_port_unit_map_h map;
- int ret;
if (parcel == nullptr || h == nullptr) {
_E("Invalid parameter");
rpc_port_parcel_read(parcel, &map->parcelable, map);
- ret = rpc_port_unit_map_read_int(map, "id", &h->id);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read id. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
+ rpc_port_unit_map_read_int(map, "id", &h->id);
+ rpc_port_unit_map_read_int(map, "seq_id", &h->seq_id);
+ rpc_port_unit_map_read_bool(map, "once", &h->once);
- ret = rpc_port_unit_map_read_int(map, "seq_id", &h->seq_id);
- if (ret != RPC_PORT_ERROR_NONE) {
- _E("Failed to read seq_id. error(%d)", ret);
- rpc_port_unit_map_destroy(map);
- set_last_result(ret);
- return;
- }
-
- ret = rpc_port_unit_map_read_bool(map, "once", &h->once);
rpc_port_unit_map_destroy(map);
_I("id(%d), seq_id(%d), once(%s)", h->id, h->seq_id, h->once ? "true" : "false");
- set_last_result(ret);
+ set_last_result(RPC_PORT_ERROR_NONE);
}
int <PREFIX>_<NAME>_<DELEGATE_NAME>_create(<PREFIX>_<NAME>_<DELEGATE_NAME>_h *h)
return ret;
}
- ret = rpc_port_unit_map_read_<NAME>_<DELEGATE_NAME>(map, "clone", clone);
+ rpc_port_unit_map_read_<NAME>_<DELEGATE_NAME>(map, "clone", clone);
rpc_port_unit_map_destroy(map);
(*clone)->port = h->port;
*/
constexpr const char CB_INTERFACE_METHOD_EMUM_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_int(map, "<ARG_NAME>", (int *)&<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read enum. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_int(map, "<ARG_NAME>", (int *)&<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_USER_DEFINED_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_BUNDLE_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_bundle(map, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read bundle. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_bundle(map, "<ARG_NAME>", &<ARG>);
)__c_cb";
/**
*/
constexpr const char CB_INTERFACE_METHOD_STRING_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_string(map, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read string. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_string(map, "<ARG_NAME>", &<ARG>);
)__c_cb";
/*
*/
constexpr const char CB_INTERFACE_METHOD_DELEGATE_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_delegate(map, "<ARG>", (rpc_port_delegate_h *)&<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read delegate. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_delegate(map, "<ARG>", (rpc_port_delegate_h *)&<ARG>);
if (context_->lem_cb.is_LEM) {
<ARG>->lem_instance = strdup(context_->instance);
*/
constexpr const char CB_INTERFACE_METHOD_BASE_UNIT_MAP_READ[] =
R"__c_cb(
-ret_ = rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
-if (ret_ != RPC_PORT_ERROR_NONE) {
- _E("Failed to read <TYPE_NAME>. error(%d)", ret_);
- goto out;
-}
+rpc_port_unit_map_read_<TYPE_NAME>(map, "<ARG_NAME>", &<ARG>);
)__c_cb";
return ret;
}
+std::string CsGeneratorBase::GenUnitMapParamInit(const Interface& iface,
+ const BaseType& base_type,
+ const std::string& type_str) {
+ std::string ret;
+
+ if (base_type.GetUserDefinedType() == BaseType::UserType::DELEGATE) {
+ ret = "value = new CallbackBase(1, false);";
+ } else if (type_str == "string") {
+ ret = "value = new string(\"\");";
+ } else {
+ ret = "value = new " + type_str + "();";
+ }
+
+ return ret;
+}
+
std::string CsGeneratorBase::GetEnumTypeString(const BaseType& base_type) {
std::string ret = base_type.GetFullName(true);
auto pos = ret.find('.');
code +=
ReplaceAll(CB_UNITMAP_READ_READ_BASE)
.Change("<PARAM_TYPE>", GenUnitMapParamType(base_type, type_str))
+ .Change("<PARAM_INIT>",
+ GenUnitMapParamInit(iface, base_type, type_str))
.Change("<UINT_READ>",
GenUnitMaUintRead(iface, base_type, type_str));
code +=
std::string GenListWrite(const BaseType& type, const std::string& type_str);
std::string GenListRead(const BaseType& type, const std::string& type_str);
std::string GetLengthName(const BaseType& type);
+ std::string GenUnitMapParamInit(const Interface& iface,
+ const BaseType& base_type,
+ const std::string& type_str);
private:
std::map<std::string, std::string> type_map_;
R"__cs_cb(
internal void Read(string name, string type, out <PARAM_TYPE> value)
{
+ <PARAM_INIT>
if (map.ContainsKey(name) == false)
{
- throw new InvalidOperationException("Not exist key " + name);
+ Tizen.Log.Error("RPC_PORT", "Not exist key " + name);
+ return;
}
Unit unit = map[name];
if (unit.type != type)
{
- throw new InvalidOperationException("type is not " + type + " : " + unit.type);
+ Tizen.Log.Error("RPC_PORT", "type is not " + type + " : " + unit.type);
+ return;
}
<UINT_READ>
}