Beispiel #1
0
Number Number::operator+ (const Number& other)
{
	return Number(getInt() + other.getInt());
}
Beispiel #2
0
bool Number::operator== (const Number& other) const
{
	return getInt() == other.getInt();
}
Beispiel #3
0
//------------------------------------------------------------------------------
// serialize
//------------------------------------------------------------------------------
std::ostream& Component::serialize(std::ostream& sout, const int i, const bool slotsOnly) const
{
    int j = 0;
    if ( !slotsOnly ) {
        //indent(sout,i);
        sout << "( " << getFormName() << std::endl;
        j = 4;
    }

    // List of components
    const PairStream* subcomponents = getComponents();
    if (subcomponents != 0) {
        indent(sout,i+j);
        sout << "components: {" << std::endl;
        subcomponents->serialize(sout,i+j+4,slotsOnly);
        indent(sout,i+j);
        sout << "}" << std::endl;
        subcomponents->unref();
        subcomponents = 0;
    }

    // Selected component
    if (selection != 0) {
        indent(sout,i+j);
        sout << "select: ";
        String* str = dynamic_cast<String*>(selection);
        if (str != 0) {
            sout << *str;
        }
        else {
            Number* num = dynamic_cast<Number*>(selection);
            if (num != 0) sout << num->getInt();
        }
        sout << std::endl;
    }

    // Event logger
    if (elog0 != 0) {
        indent(sout,i+j);
        sout << "logger: " << std::endl;
        elog0->serialize(sout,i+j,slotsOnly);
    }

    // enableTimingStats
    if (isTimingStatsEnabled()) {
        indent(sout,i+j);
        sout << "enableTimingStats: " << isTimingStatsEnabled() << std::endl;
    }

    // printTimingStats
    if (isTimingStatsPrintEnabled()) {
        indent(sout,i+j);
        sout << "printTimingStats: " << isTimingStatsPrintEnabled() << std::endl;
    }

    // Freeze
    if (isFrozen()) {
        indent(sout,i+j);
        sout << "freeze: " << isFrozen() << std::endl;
    }

    {
      unsigned short bits = getMessageEnableBits();

      // Message enable bits (only if anything other than just ERROR is set)
      if (bits != MSG_ERROR) {

         // Standard 
         if ( (bits & MSG_WARNING) != 0 ) {
            indent(sout,i+j);
            sout << "enableMessageType:  WARNING" << std::endl;
         }
         if ( (bits & MSG_INFO) != 0 ) {
            indent(sout,i+j);
            sout << "enableMessageType:  INFO" << std::endl;
         }
         if ( (bits & MSG_DEBUG) != 0 ) {
            indent(sout,i+j);
            sout << "enableMessageType:  DEBUG" << std::endl;
         }
         if ( (bits & MSG_DATA) != 0 ) {
            indent(sout,i+j);
            sout << "enableMessageType:  DATA" << std::endl;
         }
         if ( (bits & MSG_USER) != 0 ) {
            indent(sout,i+j);
            sout << "enableMessageType:  USER" << std::endl;
         }

         // Non-standard
         if ( (bits & ~MSG_STD_ALL) != 0 ) {
            indent(sout,i+j);
            sout << "enableMessageType: " << std::hex << (bits & ~MSG_STD_ALL) << std::dec << std::endl;
         }
      }
    }

    {
      unsigned short bits = getMessageDisableBits();

      // Message disable bits (only if any are set)
      if (bits != 0) {

         // Standard
         if ( (bits & MSG_WARNING) != 0 ) {
            indent(sout,i+j);
            sout << "disableMessageType:  WARNING" << std::endl;
         }
         if ( (bits & MSG_INFO) != 0 ) {
            indent(sout,i+j);
            sout << "disableMessageType:  INFO" << std::endl;
         }
         if ( (bits & MSG_DEBUG) != 0 ) {
            indent(sout,i+j);
            sout << "disableMessageType:  DEBUG" << std::endl;
         }
         if ( (bits & MSG_DATA) != 0 ) {
            indent(sout,i+j);
            sout << "disableMessageType:  DATA" << std::endl;
         }
         if ( (bits & MSG_USER) != 0 ) {
            indent(sout,i+j);
            sout << "disableMessageType:  USER" << std::endl;
         }

         // Non-standard
         if ( (bits & ~MSG_STD_ALL) != 0 ) {
            indent(sout,i+j);
            sout << "disableMessageType: " << std::hex << (bits & ~MSG_STD_ALL) << std::dec << std::endl;
         }
      }
    }

    if ( !slotsOnly ) {
        indent(sout,i);
        sout << ")" << std::endl;
    }

    return sout;
}