]>
git.proxmox.com Git - ceph.git/blob - ceph/src/jaegertracing/thrift/compiler/cpp/src/thrift/parse/t_function.h
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
24 #include "thrift/parse/t_type.h"
25 #include "thrift/parse/t_struct.h"
26 #include "thrift/parse/t_doc.h"
29 * Representation of a function. Key parts are return type, function name,
30 * optional modifiers, and an argument list, which is implemented as a thrift
34 class t_function
: public t_doc
{
36 t_function(t_type
* returntype
, std::string name
, t_struct
* arglist
, bool oneway
= false)
37 : returntype_(returntype
),
40 xceptions_(new t_struct(nullptr)),
43 if (oneway_
&& (!returntype_
->is_void())) {
44 pwarning(1, "Oneway methods should return void.\n");
48 t_function(t_type
* returntype
,
53 : returntype_(returntype
),
56 xceptions_(xceptions
),
57 own_xceptions_(false),
59 if (oneway_
&& !xceptions_
->get_members().empty()) {
60 throw std::string("Oneway methods can't throw exceptions.");
62 if (oneway_
&& (!returntype_
->is_void())) {
63 pwarning(1, "Oneway methods should return void.\n");
67 ~t_function() override
{
72 t_type
* get_returntype() const { return returntype_
; }
74 const std::string
& get_name() const { return name_
; }
76 t_struct
* get_arglist() const { return arglist_
; }
78 t_struct
* get_xceptions() const { return xceptions_
; }
80 bool is_oneway() const { return oneway_
; }
82 std::map
<std::string
, std::string
> annotations_
;