Example #1
0
//------------------------------------------------------------------------------
// serialize
//------------------------------------------------------------------------------
std::ostream& TargetData::serialize(std::ostream& sout, const int i, const bool slotsOnly) const
{
    int j = 0;
    if ( !slotsOnly ) {
        sout << "( " << getFactoryName() << std::endl;
        j = 4;
    }

    BaseClass::serialize(sout,i+j,true);

    indent(sout,i+j);
    sout << "enabled: " << (isEnabled() ? "true" : "false")  << std::endl;

    indent(sout,i+j);
    sout << "completed: " << (isCompleted() ? "true" : "false")  << std::endl;

    {
        const Basic::String* s = getWpnType();
        if (s != 0) {
            indent(sout,i+j);
            sout << "weaponType: " << s  << std::endl;
        }
    }

    indent(sout,i+j);
    sout << "quantity: " << getQuantity()  << std::endl;

    indent(sout,i+j);
    sout << "manualAssign: " <<  (getManualAssign() ? "true" : "false")  << std::endl;

    {
        unsigned int st = getStickType();
        if (st == MIDPOINT) {
            indent(sout,i+j);
            sout << "stickType: " << "MIDPOINT" << std::endl;
        }
        else if (st == LEADING_EDGE) {
            indent(sout,i+j);
            sout << "stickType: " << "LEADING_EDGE" << std::endl;
        }
    }

    indent(sout,i+j);
    sout << "stickDistance:  ( Feet " << getStickDistance()  << " )"  << std::endl;

    indent(sout,i+j);
    sout << "interval: ( MilliSeconds " << getInterval()  << " )"     << std::endl;

    indent(sout,i+j);
    sout << "maxMissDistance: ( Feet " << getMaxMissDistance()  << " )"  << std::endl;

    indent(sout,i+j);
    sout << "armDelay: ( Seconds " << getArmDelay()  << " )"     << std::endl;

    indent(sout,i+j);
    sout << "angle: ( Degrees  " << getAngle()  << " )"        << std::endl;

    indent(sout,i+j);
    sout << "azimuth: ( Degrees " << getAzimuth()  << " )"      << std::endl;

    indent(sout,i+j);
    sout << "velocity: " << getVelocity()     << std::endl;

    if ( !slotsOnly ) {
        indent(sout,i);
        sout << ")" << std::endl;
    }
    return sout;
}
 bool PercussionChoice::fromXElementImpl( std::ostream& message, xml::XElement& xelement )
 {
     if( xelement.getName() == "glass" )
     {
         myChoice = Choice::glass;
         return getGlass()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "metal" )
     {
         myChoice = Choice::metal;
         return getMetal()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "wood" )
     {
         myChoice = Choice::wood;
         return getWood()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "pitched" )
     {
         myChoice = Choice::pitched;
         return getPitched()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "membrane" )
     {
         myChoice = Choice::membrane;
         return getMembrane()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "effect" )
     {
         myChoice = Choice::effect;
         return getEffect()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "timpani" )
     {
         myChoice = Choice::timpani;
         return getTimpani()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "beater" )
     {
         myChoice = Choice::beater;
         return getBeater()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "stick" )
     {
         myChoice = Choice::stick;
         return getStick()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "stick-type" )
     {
         myChoice = Choice::stickType;
         return getStickType()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "stick-material" )
     {
         myChoice = Choice::stickMaterial;
         return getStickMaterial()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "stick-location" )
     {
         myChoice = Choice::stickLocation;
         return getStickLocation()->fromXElement( message, xelement );
     }
     
     if( xelement.getName() == "other-percussion" )
     {
         myChoice = Choice::otherPercussion;
         return getOtherPercussion()->fromXElement( message, xelement );
     }
     
     MX_BAD_ELEMENT_FAILURE( PercussionChoice );
 }