Changeset 10575 for trunk/FACT++/src


Ignore:
Timestamp:
05/04/11 16:01:52 (14 years ago)
Author:
tbretz
Message:
Added descriptions for commands and services.
File:
1 edited

Legend:

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

    r10570 r10575  
    481481#endif
    482482
    483                 //Give a name to this machine's specific states
    484                 AddStateName(kSM_NightlyOpen,      "NightlyFileOpen",  "Add description here");
    485                 AddStateName(kSM_WaitingRun,     "WaitForRun",     "Add description here");
    486                 AddStateName(kSM_Logging,        "Logging",        "Add description here");
    487                 AddStateName(kSM_BadNightlyConfig, "ErrNightlyFolder", "Add description here");
    488                 AddStateName(kSM_BadRunConfig,   "ErrRunFolder",   "Add description here");
    489 
    490         /*Add the possible transitions for this machine*/
    491         AddTransition(kSM_NightlyOpen, fTransStart, kSM_Ready, kSM_BadNightlyConfig)
     483                //Give a name to this machine's specific states
     484                AddStateName(kSM_NightlyOpen,      "NightlyFileOpen",  "The summary files for the night are open.");
     485                AddStateName(kSM_WaitingRun,       "WaitForRun",       "The summary files for the night are open and we wait for a run to be started.");
     486                AddStateName(kSM_Logging,          "Logging",          "The summary files for the night and the files for a single run are open.");
     487                AddStateName(kSM_BadNightlyConfig, "ErrNightlyFolder", "The folder for the nighly summary files is invalid.");
     488                AddStateName(kSM_BadRunConfig,     "ErrRunFolder",     "The folder for the run files is invalid.");
     489
     490                /*Add the possible transitions for this machine*/
     491                AddTransition(kSM_NightlyOpen, fTransStart, kSM_Ready, kSM_BadNightlyConfig)
    492492                    (boost::bind(&DataLogger::StartPlease, this))
    493                     ("start the Nightly logging. Nightly file location must be specified already");
    494 
    495                 AddTransition(kSM_Ready, fTransStop, kSM_NightlyOpen, kSM_WaitingRun, kSM_Logging)
    496                    (boost::bind(&DataLogger::GoToReadyPlease, this))
    497                    ("stop the data logging");
    498 
    499         AddTransition(kSM_Logging, fTransStartRun, kSM_WaitingRun, kSM_BadRunConfig)
    500                    (boost::bind(&DataLogger::StartRunPlease, this))
    501                    ("start the run logging. run file location must be specified already.");
    502 
    503         AddTransition(kSM_WaitingRun, fTransStopRun, kSM_Logging)
    504                    (boost::bind(&DataLogger::StopRunPlease, this))
    505                    ("");
    506 
    507         AddTransition(kSM_Ready, fTransReset, kSM_Error, kSM_BadNightlyConfig, kSM_BadRunConfig, kSM_Error)
    508                    (boost::bind(&DataLogger::GoToReadyPlease, this))
    509                    ("transition to exit error states. dunno if required or not, would close the Nightly file if already openned.");
    510 
    511         AddTransition(kSM_WaitingRun, fTransWait, kSM_NightlyOpen)
    512                    (boost::bind(&DataLogger::NightlyToWaitRunPlease, this));
    513 
    514         /*Add the possible configurations for this machine*/       
    515         AddConfiguration(fConfigDay, "C", kSM_Ready, kSM_BadNightlyConfig)
    516                    (boost::bind(&DataLogger::ConfigureNightlyFileName, this, _1))
    517                    ("configure the Nightly file location. cannot be done before the file is actually opened");
    518 
    519         AddConfiguration(fConfigRun, "C", kSM_Ready, kSM_BadNightlyConfig, kSM_NightlyOpen, kSM_WaitingRun, kSM_BadRunConfig)
    520                    (boost::bind(&DataLogger::ConfigureRunFileName, this, _1))
    521                    ("configure the run file location. cannot be done before the file is actually opened, and not in a dailly related error.");
    522                 AddConfiguration(fConfigRunNumber, "I", kSM_Ready, kSM_BadNightlyConfig, kSM_NightlyOpen, kSM_WaitingRun, kSM_BadRunConfig)
    523                                    (boost::bind(&DataLogger::ConfigureRunNumber, this, _1))
    524                                    ("configure the run number. cannot be done in logging state");
    525                 //Provide a logging command
    526                 //I get the feeling that I should be going through the EventImp
    527         //instead of DimCommand directly, mainly because the commandHandler
    528         //is already done in StateMachineImp.cc
    529         //Thus I'll simply add a configuration, which I will treat as the logging command
    530         AddConfiguration(fConfigLog, "C", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_BadRunConfig)
    531                    (boost::bind(&DataLogger::LogMessagePlease, this, _1));
     493                    ("Start the nightly logging. Nightly file location must be specified already");
     494
     495                AddTransition(kSM_Ready, fTransStop, kSM_NightlyOpen, kSM_WaitingRun, kSM_Logging)
     496                    (boost::bind(&DataLogger::GoToReadyPlease, this))
     497                    ("Stop all data logging, close all files.");
     498
     499                AddTransition(kSM_Logging, fTransStartRun, kSM_WaitingRun, kSM_BadRunConfig)
     500                    (boost::bind(&DataLogger::StartRunPlease, this))
     501                    ("Start the run logging. Run file location must be specified already.");
     502
     503                AddTransition(kSM_WaitingRun, fTransStopRun, kSM_Logging)
     504                    (boost::bind(&DataLogger::StopRunPlease, this))
     505                    ("Wait for a run to be started, open run-files as soon as a run number arrives.");
     506
     507                AddTransition(kSM_Ready, fTransReset, kSM_Error, kSM_BadNightlyConfig, kSM_BadRunConfig, kSM_Error)
     508                    (boost::bind(&DataLogger::GoToReadyPlease, this))
     509                    ("Transition to exit error states. Closes the nightly file if already opened.");
     510
     511                AddTransition(kSM_WaitingRun, fTransWait, kSM_NightlyOpen)
     512                    (boost::bind(&DataLogger::NightlyToWaitRunPlease, this));
     513
     514                /*Add the possible configurations for this machine*/
     515                AddConfiguration(fConfigDay, "C", kSM_Ready, kSM_BadNightlyConfig)
     516                    (boost::bind(&DataLogger::ConfigureNightlyFileName, this, _1))
     517                    ("Configure the folder for the nightly files."
     518                     "|Path[string]:Absolute or relative path name where the nightly files should be stored.");
     519
     520                AddConfiguration(fConfigRun, "C", kSM_Ready, kSM_BadNightlyConfig, kSM_NightlyOpen, kSM_WaitingRun, kSM_BadRunConfig)
     521                    (boost::bind(&DataLogger::ConfigureRunFileName, this, _1))
     522                    ("Configure the folder for the run files."
     523                     "|Path[string]:Absolute or relative path name where the run files should be stored.");
     524
     525                AddConfiguration(fConfigRunNumber, "I", kSM_Ready, kSM_BadNightlyConfig, kSM_NightlyOpen, kSM_WaitingRun, kSM_BadRunConfig)
     526                    (boost::bind(&DataLogger::ConfigureRunNumber, this, _1))
     527                    ("configure the run number. cannot be done in logging state");
     528
     529                //Provide a logging command
     530                //I get the feeling that I should be going through the EventImp
     531                //instead of DimCommand directly, mainly because the commandHandler
     532                //is already done in StateMachineImp.cc
     533                //Thus I'll simply add a configuration, which I will treat as the logging command
     534                AddConfiguration(fConfigLog, "C", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_BadRunConfig)
     535                    (boost::bind(&DataLogger::LogMessagePlease, this, _1))
     536                    ("Log a single message to the log-files."
     537                     "|Message[string]:Message to be logged.");
    532538               
    533539                //Provide a print command
    534                 AddConfiguration(fPrintCommand, "", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_BadNightlyConfig, kSM_BadRunConfig)
    535                                   (boost::bind(&DataLogger::PrintStatePlease, this, _1));
    536                
     540                AddConfiguration(fPrintCommand, kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_BadNightlyConfig, kSM_BadRunConfig)
     541                    (boost::bind(&DataLogger::PrintStatePlease, this, _1))
     542                    ("Print information about the internal status of the data logger.");
     543
    537544                fServiceList.SetHandler(this);
    538545                CheckForServicesUpdate();
    539                
     546
    540547                //start the monitoring service
    541548                fContinueMonitoring = true;
     
    546553                fToDim.code = 0;
    547554                fToDim.fileName[0] = '\0';
    548                 fOpenedNightlyFiles = new DimDescribedService((GetName() + "/FILENAME_NIGHTLY").c_str(), "I:1;C", &fToDim, sizeof(int)+1, "Add description here");//"i:1;C", static_cast<void*>(fDimBuffer), 256);
    549                 fOpenedRunFiles = new DimDescribedService((GetName() + "/FILENAME_RUN").c_str(), "I:1;C", &fToDim, sizeof(int)+1, "Add description here");
    550                 fNumSubAndFitsData.numSubscriptions = 0;
     555
     556                fOpenedNightlyFiles = new DimDescribedService((GetName() + "/FILENAME_NIGHTLY").c_str(), "I:1;C", &fToDim, sizeof(int)+1,
     557                                                              "Path and base name which is used to compile the filenames for the nightly files."
     558                                                              "|Type[int]:type of open files (1=log, 2=rep, 4=fits)"
     559                                                              "|Name[string]:path and base file name");
     560
     561                fOpenedRunFiles = new DimDescribedService((GetName() + "/FILENAME_RUN").c_str(), "I:1;C", &fToDim, sizeof(int)+1,
     562                                                              "Path and base name which is used to compile the filenames for the run files."
     563                                                              "|Type[int]:type of open files (1=log, 2=rep, 4=fits)"
     564                                                              "|Name[string]:path and base file name");
     565
     566                fNumSubAndFitsData.numSubscriptions = 0;
    551567                fNumSubAndFitsData.numOpenFits = 0;
    552                 fNumSubAndFits = new DimDescribedService((GetName() + "/NUM_SUBS").c_str(), "I:2", &fNumSubAndFitsData, sizeof(NumSubAndFitsType), "Add description here");
    553                 //black/white list
     568                fNumSubAndFits = new DimDescribedService((GetName() + "/NUM_SUBS").c_str(), "I:2", &fNumSubAndFitsData, sizeof(NumSubAndFitsType),
     569                                                         "Shows number of services to which the data logger is currently subscribed and the total number of open files."
     570                                                         "|Scubscriptions[int]:number of dim services to which the data logger is currently subscribed."
     571                                                         "|NumOpenFiles[int]:number of files currently open by the data logger");
     572
     573                //black/white list
    554574                fIsBlackList = true;
    555575                fGreyList.clear();
     
    560580                fOpenedFilesIsOn = true;
    561581                fNumSubAndFitsIsOn = true;
    562                 //provide services control commands
     582
     583                //provide services control commands
    563584                AddConfiguration(fDebugOnOff, "B:1", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready)
    564                                 (boost::bind(&DataLogger::SetDebugOnOff, this, _1));
    565                 AddConfiguration(fStatsPeriod, "F", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready)
    566                                 (boost::bind(&DataLogger::SetStatsPeriod, this, _1));
     585                    (boost::bind(&DataLogger::SetDebugOnOff, this, _1))
     586                    ("Switch debug mode on off. Debug mode prints ifnormation about every service written to a file."
     587                     "|Enable[bool]:Enable of disable debuig mode (yes/no).");
     588
     589                AddConfiguration(fStatsPeriod, "F", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready)
     590                    (boost::bind(&DataLogger::SetStatsPeriod, this, _1))
     591                    ("Interval in which the data-logger statitistics service (STATS) is updated."
     592                     "Interval[s]:Floating point value in seconds.");
     593
    567594                AddConfiguration(fStartStopOpenedFiles, "B:1", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready)
    568                                 (boost::bind(&DataLogger::SetOpenedFilesOnOff ,this, _1));
     595                    (boost::bind(&DataLogger::SetOpenedFilesOnOff ,this, _1))
     596                    ("Can be used to switch the service off which distributes information about the open files.");
     597
    569598                AddConfiguration(fStartStopNumSubsAndFits, "B:1", kSM_NightlyOpen, kSM_Logging, kSM_WaitingRun, kSM_Ready)
    570                                 (boost::bind(&DataLogger::SetNumSubsAndFitsOnOff, this, _1));
     599                    (boost::bind(&DataLogger::SetNumSubsAndFitsOnOff, this, _1))
     600                    ("Can be used to switch the service off which distributes information about the number of subscriptions and open files.");
     601
    571602                fDestructing = false;
    572603                if(fDebugIsOn)
    573604                {
    574                         Debug("DataLogger Init Done.");
    575                 }
     605                    Debug("DataLogger Init Done.");
     606                }
    576607}
    577608// --------------------------------------------------------------------------
Note: See TracChangeset for help on using the changeset viewer.