Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 1 | // Copyright (c) 2021, ARM Limited. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | #include <iostream> |
| 16 | #include <tosa_serialization_handler.h> |
| 17 | |
| 18 | using namespace tosa; |
| 19 | |
| 20 | void usage() |
| 21 | { |
| 22 | std::cerr << "Usage: <src> <dest>" << std::endl; |
| 23 | std::cerr << " <src>: source TOSA serialize filename" << std::endl; |
| 24 | std::cerr << " <dest>: destination TOSA serialized filename" << std::endl; |
| 25 | } |
| 26 | |
| 27 | int main(int argc, char** argv) |
| 28 | { |
| 29 | TosaSerializationHandler handler; |
| 30 | if (argc != 3) |
| 31 | { |
| 32 | usage(); |
| 33 | return 1; |
| 34 | } |
| 35 | |
| 36 | tosa_err_t err = handler.LoadFileTosaFlatbuffer(argv[1]); |
| 37 | if (err != TOSA_OK) |
| 38 | { |
| 39 | std::cout << "error reading file " << argv[1] << " code " << err << std::endl; |
| 40 | return 1; |
| 41 | } |
| 42 | |
| 43 | err = handler.SaveFileTosaFlatbuffer(argv[2]); |
| 44 | if (err != TOSA_OK) |
| 45 | { |
| 46 | std::cout << "error writing file " << argv[2] << " code " << err << std::endl; |
| 47 | return 1; |
| 48 | } |
| 49 | return 0; |
| 50 | } |