Append

Description

Appends tiling data. If the length of the appended tiling data exceeds the maximum, the appending fails.

Prototype

template<typename T, typename std::enable_if<std::is_standard_layout<T>::value, int>::type = 0> ge::graphStatus Append(const T &data)

template<typename T, typename std::enable_if<std::is_standard_layout<T>::value, int>::type = 0> ge::graphStatus Append(const T *data, size_t append_num)

Parameters

Parameter

Input/Output

Description

T

Input

Type of appended tiling data.

data

Input

  • For the reference type: appended tiling data instance.
  • For the pointer type: start address of appended tiling data.

append_num

Input

Number of appended tiling data records. A total of append_num tiling data records of the T type are appended.

Returns

  • ge::GRAPH_SUCCESS on success.
  • ge::GRAPH_FAILED on failure.

Restrictions

The appended tiling data must comply with standard_layout, that is, memory tiling.

Example

auto td_buf = TilingData::CreateCap(100U);
auto td = reinterpret_cast<TilingData *>(td_buf.get());

// 1
struct AppendData{
  int a = 10;
  int b = 100;
};
AppendData ad;
auto ret = td->Append<AppendData>(ad); // ge::GRAPH_SUCCESS

// 2
size_t append_num = 10;
int32_t *td = new int32_t[append_num];
auto ret = td->Append<int32_t>(td, append_num); // ge::GRAPH_SUCCESS

// 3
size_t append_num = 50;
int32_t *td = new int32_t[append_num];
auto ret = td->Append<int32_t>(td, append_num); // ge::GRAPH_FAILED