Changeset 13681 for trunk/FACT++


Ignore:
Timestamp:
05/12/12 18:44:54 (12 years ago)
Author:
tbretz
Message:
Some little improvements and fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/dimctrl.cc

    r13671 r13681  
    6565        fData = Tools::Split(opt);
    6666
     67        if (opt.size()>0)
     68            Debug("Start '"+opt+"' received.");
     69
     70        if (fDebug)
     71            Debug("Received data: "+string(fDimStart.getString()));
     72
    6773        if (opt.size()==0)
    6874        {
     
    7379
    7480            return;
    75         }
    76 
    77         Debug("Start '"+opt+"' received.");
    78         if (fDebug)
    79         {
    80             string d(fDimStart.getString());
    81             if (d.length()>opt.length())
    82                 Debug("Received data: "+string(fDimStart.getString()).substr(opt.length()+1));
    8381        }
    8482
     
    142140    }
    143141
     142    string Line(const string &txt, char fill)
     143    {
     144        const int n = (55-txt.length())/2;
     145
     146        ostringstream out;
     147        out << setfill(fill);
     148        out << setw(n) << fill << ' ';
     149        out << txt;
     150        out << ' ' << setw(n) << fill;
     151
     152        if (2*n+txt.length()+2 != 57)
     153            out << fill;
     154
     155        return out.str();
     156    }
     157
    144158    int Write(const Time &time, const std::string &txt, int qos=kMessage)
    145159    {
     
    150164            if (fDebug)
    151165            {
    152                 ostringstream out;
     166                string msg;
    153167                if (fLabel<0)
    154168                {
    155169                    if (fLabel==-1)
    156                         out << "========================== Begin ========================";
     170                        msg = Line("Begin ["+fScript+"]", '=');
    157171                    else
    158                         out << "=========================== End =========================";
     172                        msg = Line("End ["+fScript+"]", '=');
    159173                }
    160174                else
    161                     out << "------------------------ Label " << setfill('0') << setw(3) << fLabel << " ----------------------";
    162 
    163                 MessageDimTX::Write(time, out.str(), 90);
     175                {
     176                    ostringstream out;
     177                    out << "Label " << fLabel << " [" << fScript << "]";
     178                    msg = Line(out.str(), '-');
     179                }
     180
     181                MessageDimTX::Write(time, msg, 90);
    164182            }
    165183
     
    167185            switch (fLabel)
    168186            {
    169             case -2: return fSrvState.Update("End of script execution");
    170             case -1: return fSrvState.Update("Start of script execution");
    171             default: return fSrvState.Update("New label");
     187            case -2: return fSrvState.Update(fScript+" [end]");
     188            case -1: return fSrvState.Update(fScript+" [load]");
     189            case  0: return fSrvState.Update(fScript+" [start]");
    172190            }
     191
     192            ostringstream msg;
     193            msg << fScript << " [label=" << fLabel << "]";
     194            return fSrvState.Update(msg.str());
    173195        }
    174196
Note: See TracChangeset for help on using the changeset viewer.