//--------------------------------------------------------------------------
// Code generated by the SmartSoft MDSD Toolchain
// The SmartSoft Toolchain has been developed by:
//  
// Service Robotics Research Center
// University of Applied Sciences Ulm
// Prittwitzstr. 10
// 89075 Ulm (Germany)
//
// Information about the SmartSoft MDSD Toolchain is available at:
// www.servicerobotik-ulm.de
//
// Please do not modify this file. It will be re-generated
// running the code generator.
//--------------------------------------------------------------------------
#include "DomainExternalSystems/CommExternalProgramACE.hh"
#include <ace/SString.h>
#include "DomainExternalSystems/CommExternalProgramArgumentACE.hh"

// serialization operator for element CommExternalProgram
ACE_CDR::Boolean operator<<(ACE_OutputCDR &cdr, const DomainExternalSystemsIDL::CommExternalProgram &data)
{
	ACE_CDR::Boolean good_bit = true;
	// serialize list-element name
	good_bit = good_bit && cdr << ACE_CString(data.name.c_str());
	// serialize list-element description
	good_bit = good_bit && cdr << ACE_CString(data.description.c_str());
	// serialize list-element isExecutable
	good_bit = good_bit && cdr.write_boolean(data.isExecutable);
	// serialize list-element arguments
	good_bit = good_bit && cdr << ACE_Utils::truncate_cast<ACE_CDR::ULong>(data.arguments.size());
	std::vector<DomainExternalSystemsIDL::CommExternalProgramArgument>::const_iterator data_argumentsIt;
	for(data_argumentsIt=data.arguments.begin(); data_argumentsIt!=data.arguments.end(); data_argumentsIt++) {
		good_bit = good_bit && cdr << *data_argumentsIt;
	}
	// serialize list-element resultArgs
	good_bit = good_bit && cdr << ACE_Utils::truncate_cast<ACE_CDR::ULong>(data.resultArgs.size());
	std::vector<DomainExternalSystemsIDL::CommExternalProgramArgument>::const_iterator data_resultArgsIt;
	for(data_resultArgsIt=data.resultArgs.begin(); data_resultArgsIt!=data.resultArgs.end(); data_resultArgsIt++) {
		good_bit = good_bit && cdr << *data_resultArgsIt;
	}
	
	return good_bit;
}

// de-serialization operator for element CommExternalProgram
ACE_CDR::Boolean operator>>(ACE_InputCDR &cdr, DomainExternalSystemsIDL::CommExternalProgram &data)
{
	ACE_CDR::Boolean good_bit = true;
	// deserialize string-type element name
	ACE_CString data_name_str;
	good_bit = good_bit && cdr >> data_name_str;
	data.name = data_name_str.c_str();
	// deserialize string-type element description
	ACE_CString data_description_str;
	good_bit = good_bit && cdr >> data_description_str;
	data.description = data_description_str.c_str();
	// deserialize type element isExecutable
	good_bit = good_bit && cdr.read_boolean(data.isExecutable);
	// deserialize list-type element arguments
	ACE_CDR::ULong data_argumentsNbr;
	good_bit = good_bit && cdr >> data_argumentsNbr;
	data.arguments.clear();
	DomainExternalSystemsIDL::CommExternalProgramArgument data_argumentsItem;
	for(ACE_CDR::ULong i=0; i<data_argumentsNbr; ++i) {
		good_bit = good_bit && cdr >> data_argumentsItem;
		data.arguments.push_back(data_argumentsItem);
	}
	// deserialize list-type element resultArgs
	ACE_CDR::ULong data_resultArgsNbr;
	good_bit = good_bit && cdr >> data_resultArgsNbr;
	data.resultArgs.clear();
	DomainExternalSystemsIDL::CommExternalProgramArgument data_resultArgsItem;
	for(ACE_CDR::ULong i=0; i<data_resultArgsNbr; ++i) {
		good_bit = good_bit && cdr >> data_resultArgsItem;
		data.resultArgs.push_back(data_resultArgsItem);
	}
	
	return good_bit;
}

// serialization operator for CommunicationObject CommExternalProgram
ACE_CDR::Boolean operator<<(ACE_OutputCDR &cdr, const DomainExternalSystems::CommExternalProgram &obj)
{
	return cdr << obj.get();
}

// de-serialization operator for CommunicationObject CommExternalProgram
ACE_CDR::Boolean operator>>(ACE_InputCDR &cdr, DomainExternalSystems::CommExternalProgram &obj)
{
	return cdr >> obj.set();
}
