xref: /aosp_15_r20/external/tensorflow/tensorflow/c/tf_tstring.h (revision b6fb3261f9314811a0f4371741dbb8839866f948)
1 /* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
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 #ifndef TENSORFLOW_C_TF_TSTRING_H_
16 #define TENSORFLOW_C_TF_TSTRING_H_
17 
18 #include "tensorflow/c/tf_tensor.h"
19 #include "tensorflow/core/platform/ctstring.h"
20 
21 #ifdef SWIG
22 #define TF_CAPI_EXPORT
23 #else
24 #if defined(_WIN32)
25 #ifdef TF_COMPILE_LIBRARY
26 #define TF_CAPI_EXPORT __declspec(dllexport)
27 #else
28 #define TF_CAPI_EXPORT __declspec(dllimport)
29 #endif  // TF_COMPILE_LIBRARY
30 #else
31 #define TF_CAPI_EXPORT __attribute__((visibility("default")))
32 #endif  // _WIN32
33 #endif  // SWIG
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 TF_CAPI_EXPORT extern void TF_StringInit(TF_TString *t);
40 
41 TF_CAPI_EXPORT extern void TF_StringCopy(TF_TString *dst, const char *src,
42                                          size_t size);
43 
44 TF_CAPI_EXPORT extern void TF_StringAssignView(TF_TString *dst, const char *src,
45                                                size_t size);
46 
47 TF_CAPI_EXPORT extern const char *TF_StringGetDataPointer(
48     const TF_TString *tstr);
49 
50 TF_CAPI_EXPORT extern TF_TString_Type TF_StringGetType(const TF_TString *str);
51 
52 TF_CAPI_EXPORT extern size_t TF_StringGetSize(const TF_TString *tstr);
53 
54 TF_CAPI_EXPORT extern size_t TF_StringGetCapacity(const TF_TString *str);
55 
56 TF_CAPI_EXPORT extern void TF_StringDealloc(TF_TString *tstr);
57 
58 #ifdef __cplusplus
59 } /* end extern "C" */
60 #endif
61 
62 #endif  // THIRD_PARTY_TENSORFLOW_C_TF_TSTRING_H_
63