void be_sequence::putter ( ostream& os, be_Tab& tab, const DDS_StdString& seqptr, // pointer to a sequence unsigned long uid ) { DDS_StdString uids = BE_Globals::ulong_to_string(uid); DDS_StdString length = (DDS_StdString)"len" + uids; DDS_StdString data = (DDS_StdString)"data" + uids; DDS_StdString index = (DDS_StdString)"i" + uids; // first, let's put the length os << tab << "DDS::ULong " << length << " = " << seqptr << "->length ();" << nl; os << tab << "DDS::Codec::Param lenPutArg = { DDS::_tc_ulong, &" << length << ", DDS::PARAM_IN };" << nl; os << tab << baseType->CppTypeWhenSequenceMember().ScopedName() << "* " << data << " = (" << baseType->CppTypeWhenSequenceMember().ScopedName() << "*)" << seqptr << "->get_buffer (FALSE);" << nl << nl; os << tab << "os.put (&lenPutArg, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl << nl; os << tab << "for (DDS::ULong " << index << " = 0; " << index << " < " << length << "; " << index << "++)" << nl; os << tab << "{" << nl; tab.indent (); baseType->put_for_sequence (os, tab, data, index, uid); tab.outdent (); os << tab << "}" << nl; }
void be_structure::put_core_fields ( ostream & os, be_Tab & tab, const DDS_StdString & sptr, FieldList & coreFields, unsigned long uid ) { DDS::Boolean wroteOne = FALSE; DDS_StdString uids = BE_Globals::ulong_to_string(uid); DDS_StdString _in_ = (DDS_StdString)"_in_" + uids; FieldList::iterator it; // first, let's declare the core args for putting for (it = coreFields.begin(); it != coreFields.end(); it++) { (*it)->declare_for_struct_put (os, tab, sptr, uid); } // // now, let's initilize our put args // os << tab << "DDS::Codec::Param " << _in_ << "[" << coreFields.size() << "] =" << nl; os << tab << "{" << nl; tab.indent (); for (it = coreFields.begin(); it != coreFields.end(); it++) { if (wroteOne) { os << "," << nl; } (*it)->make_put_param (os, tab, sptr, uid); wroteOne = TRUE; } tab.outdent (); os << nl << tab << "};" << nl; // and finally, let's put 'em os << tab << "os.put (" << _in_ << ", " << coreFields.size () << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl; }
void be_sequence::getter ( ostream& os, be_Tab& tab, const DDS_StdString& seqptr, // sequence pointer unsigned long uid ) { DDS_StdString uids = BE_Globals::ulong_to_string(uid); DDS_StdString length = (DDS_StdString)"len" + uids; DDS_StdString size = (DDS_StdString)"size" + uids; DDS_StdString data = (DDS_StdString)"data" + uids; DDS_StdString index = (DDS_StdString)"i" + uids; DDS_StdString maxArg; DDS_StdString swapArg = data; DDS_StdString incData = data + "++"; DDS_StdString swapCall; if (!IsBounded ()) { maxArg = length + ", "; } // // now, let's declare our get args // os << tab << "DDS::ULong " << length << ";" << nl; // // then get the length // os << tab << "DDS::Codec::Param lenGetArg = { DDS::_tc_ulong, &" << length << ", DDS::PARAM_OUT };" << nl; os << tab << baseType->CppTypeWhenSequenceMember().ScopedName() << "* " << data << ";" << nl << nl; os << tab << "is.get (&lenGetArg, 1" << XBE_Ev::arg (XBE_ENV_VARN) << ");" << nl; if (isInterfaceSeq) { os << tab << seqptr << "->length (" << length << ");" << nl; os << tab << data << " = " << seqptr << "->get_buffer (FALSE);" << nl << nl; } else { os << tab << data << " = " << ScopedName() << "::allocbuf (" << length << ");" << nl << nl; } os << tab << "for (DDS::ULong " << index << " = 0; " << index << " < " << length << "; " << index << "++)" << nl; os << tab << "{" << nl; tab.indent (); if (isInterfaceSeq) { os << tab << "if(" << data << "[" << index << "])" << nl; os << tab << "{" << nl; tab.indent (); os << tab << "DDS::release(" << data << "[" << index << "]);" << nl; os << tab << data << "[" << index << "] = 0;" << nl; tab.outdent (); os << tab << "}" << nl; } baseType->get_for_sequence (os, tab, data, index, uid); tab.outdent (); os << tab << "}" << nl << nl; if ( IsBounded() && !isInterfaceSeq ) { os << tab << seqptr << "->replace (" << length << "," << data << ",TRUE);" << nl; } if ( !IsBounded() && !isInterfaceSeq ) { os << tab << seqptr << "->replace (" << length << "," << length << "," << data << ",TRUE);" << nl; } }