| 207 | |
| 208 | template <class T> |
| 209 | static std::vector<T> get_data_vals(const google::protobuf::RepeatedField<T>& data, |
| 210 | const size_t& shape_size) |
| 211 | { |
| 212 | std::vector<T> data_vals(shape_size); |
| 213 | // check if shape has enough data values given existing fields |
| 214 | if(data.size() == 1) |
| 215 | { |
| 216 | std::fill(data_vals.begin(), data_vals.end(), data[0]); |
| 217 | } |
| 218 | else |
| 219 | copy(data.begin(), data.end(), data_vals.begin()); |
| 220 | return data_vals; |
| 221 | } |
| 222 | |
| 223 | template <class T> |
| 224 | static literal create_literal(shape::type_t shape_type, |