OpenDDS  Snapshot(2023/04/07-19:43)
Public Member Functions | Public Attributes | List of all members
Function Struct Reference

#include <dds_generator.h>

Collaboration diagram for Function:
Collaboration graph
[legend]

Public Member Functions

 Function (const std::string &name, const std::string returntype, const char *template_args=0)
 
void addArg (const char *name, const std::string &type)
 
void endArgs ()
 
 ~Function ()
 

Public Attributes

bool has_arg_
 
std::string preamble_
 
bool extra_newline_
 

Detailed Description

Definition at line 243 of file dds_generator.h.

Constructor & Destructor Documentation

◆ Function()

Function::Function ( const std::string &  name,
const std::string  returntype,
const char *  template_args = 0 
)
inline

Definition at line 248 of file dds_generator.h.

References be_global, and ACE_String_Base< char >::c_str().

250  : has_arg_(false)
251  , extra_newline_(true)
252  {
253  using std::string;
254  if (template_args) {
255  const string tmpl = string("template<") + template_args + "> ";
256  be_global->header_ << tmpl;
257  be_global->impl_ << tmpl;
258  }
259  ACE_CString ace_exporter = be_global->export_macro();
260  bool use_exp = ace_exporter != "";
261  string exporter = use_exp ? (string(" ") + ace_exporter.c_str()) : "";
262  be_global->header_ << ace_exporter << (use_exp ? "\n" : "")
263  << returntype << " " << name << "(";
264  be_global->impl_ << returntype << " " << name << "(";
265  }
const char * c_str(void) const
const char *const name
Definition: debug.cpp:60
bool has_arg_
BE_GlobalData * be_global
Definition: be_global.cpp:43
bool extra_newline_

◆ ~Function()

Function::~Function ( )
inline

Definition at line 285 of file dds_generator.h.

References be_global.

286  {
287  be_global->impl_ << "}\n";
288  if (extra_newline_) {
289  be_global->impl_ << "\n";
290  }
291  }
BE_GlobalData * be_global
Definition: be_global.cpp:43
bool extra_newline_

Member Function Documentation

◆ addArg()

void Function::addArg ( const char *  name,
const std::string &  type 
)
inline

Definition at line 267 of file dds_generator.h.

References be_global, and name.

Referenced by marshal_generator::gen_enum(), value_reader_generator::gen_enum(), value_writer_generator::gen_enum(), marshal_generator::gen_field_getValueFromSerialized(), marshal_generator::gen_struct(), value_reader_generator::gen_struct(), value_writer_generator::gen_struct(), metaclass_generator::gen_struct(), marshal_generator::gen_typedef(), metaclass_generator::gen_typedef(), marshal_generator::gen_union(), value_writer_generator::gen_union(), value_reader_generator::gen_union(), and metaclass_generator::gen_union().

268  {
269  std::string sig = (has_arg_ ? ", " : "") + type + (name[0] ? " " : "")
270  + (name[0] ? name : "");
271  be_global->header_ << sig;
272  be_global->impl_ << sig;
273  if (name[0]) {
274  preamble_ += " ACE_UNUSED_ARG(" + std::string(name) + ");\n";
275  }
276  has_arg_ = true;
277  }
std::string preamble_
const char *const name
Definition: debug.cpp:60
bool has_arg_
BE_GlobalData * be_global
Definition: be_global.cpp:43

◆ endArgs()

void Function::endArgs ( )
inline

Member Data Documentation

◆ extra_newline_

bool Function::extra_newline_

Definition at line 246 of file dds_generator.h.

◆ has_arg_

bool Function::has_arg_

Definition at line 244 of file dds_generator.h.

◆ preamble_

std::string Function::preamble_

Definition at line 245 of file dds_generator.h.


The documentation for this struct was generated from the following file: