void cpp_output_one_param(ostream &file, Param *p, bool is_server,
bool is_copy = false);
+
+enum CPPTraversal {
+ trav_full, // Full, final output
+ trav_obj_def, // Object struct definition
+ trav_obj_stub, // Object pointer stub,
+ // so it can be used in structs.
+ trav_nsdecl, // _ns declaration
+ trav_forward, // Forward declaration of
+ // structs/interfaces in nsdecl
+
+ num_traversals,
+
+ // Values beyond this point are not part of the
+ // above sequential pass scheme; they are merely
+ // for dynamic dispatch.
+ trav_marshall,
+ trav_unmarshall,
+};
+
+// Per-symbol language-private data
+struct CPPData : public Releasable {
+ // The traversal indices are also passed as "arg1" to determine
+ // which pass to generate. Higher numbers are performed first.
+
+ int traversed[num_traversals];
+
+ CPPData() : Releasable(1)
+ {
+ memset(traversed, 0, sizeof(traversed));
+ }
+};
+
+static inline CPPData &cpp_symdata(Symbol *sym)
+{
+ if (!sym->lang_priv)
+ sym->lang_priv = new CPPData;
+
+ CPPData *ptr = dynamic_cast<CPPData *>(sym->lang_priv);
+ assert(ptr);
+ return *ptr;
+}
// Each IDL namespace is mapped to a C++ header file,
// represented by a CPPFile.
// The implementation is delayed to avoid circular dependency problems.
void output_casts(Interface *sym);
+
+ //// Marshalling methods
+
+ void output_marshall_pass(Struct *sym, int pass);
+ void output_marshall_method(Struct *sym);
+ void output_marshall_inline_method(Struct *sym);
+ void marshall_members(Struct *sym);
+
+ void output_marshall_array(Datum *d);
+ void output_marshall(Struct *sym, Datum *d);
+ void output_marshall(Interface *sym, Datum *d);
+ void output_marshall(Enum *sym, Datum *d);
+ void output_marshall(BitField *sym, Datum *d);
+ void output_marshall(BasicType *sym, Datum *d);
+ void output_marshall(CompiledBasicType &cbt, Datum *d);
+
+ void align_type(Symbol *sym);
+ void grow_buf();
// Output the downcast and implicit upcast methods for
// the given interface/superinterface pair.
int first_traversal;
- // The traversal indices are also passed as "arg1" to determine
- // which pass to generate. Higher numbers are performed first.
-
- enum {
- trav_full = 0, // Full, final output
- trav_obj_def = 1, // Object struct definition
- trav_obj_stub = 2, // Object pointer stub,
- // so it can be used in structs.
- trav_nsdecl = 3, // _ns declaration
- trav_forward = 4, // Forward declaration of
- // structs/interfaces in nsdecl
- };
-
bool pass_needed(Symbol *sym, int pass)
{
- return first_traversal > sym->traversed[pass];
+ return first_traversal > cpp_symdata(sym).traversed[pass];
}
void output_pass(Symbol *sym, int pass)
{
if (pass_needed(sym, pass)) {
- sym->traversed[pass] = traversal;
+ cpp_symdata(sym).traversed[pass] = traversal;
sym->output_lang(this, pass);
}
}
void output(Alias *sym, int pass = trav_full, void *arg2 = NULL);
void output(TypeDef *sym, int pass = trav_full, void *arg2 = NULL);
void output(Datum *sym, int pass = trav_full, void *arg2 = NULL);
+
+ void marshall(Struct *sym);
+ void marshall(Interface *sym);
+ void marshall(BitField *sym);
+ void marshall(Enum *sym);
+ void marshall(BasicType *sym);
+
+ void unmarshall(Struct *sym);
+ void unmarshall(Interface *sym);
+ void unmarshall(BitField *sym);
+ void unmarshall(Enum *sym);
+ void unmarshall(BasicType *sym);
};
class CPPBinding : public Language {