bool read=true,
bool write=true,
bool swap=false);
- void generate_struct_definition (std::ofstream& out, t_struct* tstruct, bool setters=true);
+ void generate_struct_definition (std::ofstream& out, std::ofstream& force_cpp_out, t_struct* tstruct, bool setters=true);
void generate_copy_constructor (std::ofstream& out, t_struct* tstruct);
void generate_assignment_operator (std::ofstream& out, t_struct* tstruct);
void generate_struct_fingerprint (std::ofstream& out, t_struct* tstruct, bool is_definition);
void t_cpp_generator::generate_cpp_struct(t_struct* tstruct, bool is_exception) {
generate_struct_declaration(f_types_, tstruct, is_exception,
false, true, true, true);
- generate_struct_definition(f_types_impl_, tstruct);
+ generate_struct_definition(f_types_impl_, f_types_impl_, tstruct);
generate_struct_fingerprint(f_types_impl_, tstruct, true);
generate_local_reflection(f_types_, tstruct, false);
generate_local_reflection(f_types_impl_, tstruct, true);
}
void t_cpp_generator::generate_struct_definition(ofstream& out,
+ ofstream& force_cpp_out,
t_struct* tstruct,
bool setters) {
// Get members
// Destructor
if (tstruct->annotations_.find("final") == tstruct->annotations_.end()) {
- out <<
+ force_cpp_out <<
endl <<
indent() << tstruct->get_name() << "::~" << tstruct->get_name() << "() throw() {" << endl;
indent_up();
indent_down();
- out << indent() << "}" << endl << endl;
+ force_cpp_out << indent() << "}" << endl << endl;
}
// Create a setter function for each field
// TODO(dreiss): Why is this stuff not in generate_function_helpers?
ts->set_name(tservice->get_name() + "_" + (*f_iter)->get_name() + "_args");
generate_struct_declaration(f_header_, ts, false);
- generate_struct_definition(out, ts, false);
+ generate_struct_definition(out, f_service_, ts, false);
generate_struct_reader(out, ts);
generate_struct_writer(out, ts);
ts->set_name(tservice->get_name() + "_" + (*f_iter)->get_name() + "_pargs");
generate_struct_declaration(f_header_, ts, false, true, false, true);
- generate_struct_definition(out, ts, false);
+ generate_struct_definition(out, f_service_, ts, false);
generate_struct_writer(out, ts, true);
ts->set_name(name_orig);
}
generate_struct_declaration(f_header_, &result, false);
- generate_struct_definition(out, &result, false);
+ generate_struct_definition(out, f_service_, &result, false);
generate_struct_reader(out, &result);
generate_struct_result_writer(out, &result);
result.set_name(tservice->get_name() + "_" + tfunction->get_name() + "_presult");
generate_struct_declaration(f_header_, &result, false, true, true, gen_cob_style_);
- generate_struct_definition(out, &result, false);
+ generate_struct_definition(out, f_service_, &result, false);
generate_struct_reader(out, &result, true);
if (gen_cob_style_) {
generate_struct_writer(out, &result, true);
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+int main(int, char**) {
+ return 0;
+}
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * This file is a part of a link test that makes sure generated
+ * templated service headers can be included from multiple
+ * implementation files.
+ */
+
+#include "gen-cpp/ParentService.h"
--- /dev/null
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*
+ * This file is a part of a link test that makes sure generated
+ * templated service headers can be included from multiple
+ * implementation files.
+ */
+
+#include "gen-cpp/ParentService.h"