2323#include  < time.h> 
2424
2525flxLogger::flxLogger ()
26-     : _timestampType{TimeStampNone}, _outputDeviceID{false }, _sampleNumberEnabled{false }, _currentSampleNumber{0 }
26+     : _timestampType{TimeStampNone}, _outputDeviceID{false }, _outputLocalName{ false },  _sampleNumberEnabled{false }, _currentSampleNumber{0 }
2727{
2828    setName (" Logger"  , " Data logging action"  );
2929
@@ -46,12 +46,19 @@ flxLogger::flxLogger()
4646    flxRegister (resetSampleNumber, " Reset Sample Counter"  , " Reset the sample number counter to the provided value"  );
4747
4848    //  Output the device ID to the log output?
49-     flxRegister (enableIDOutput, " Output ID"  , " Include the Device  ID in the log output"  );
49+     flxRegister (enableIDOutput, " Output ID"  , " Include the Board  ID in the log output"  );
5050
5151    //  and the parameter to support the ID?
52-     flxRegister (getDeviceID, " Device  ID"  );
52+     flxRegister (getDeviceID, " Board  ID"  );
5353    removeParameter (getDeviceID); //  added on enable of prop
5454
55+     //  Output the device Name/ to the log output?
56+     flxRegister (enableNameOutput, " Output Name"  , " Include the Board Name in the log output"  );
57+ 
58+     //  and the parameter to support the Name?
59+     flxRegister (getLocalName, " Board Name"  );
60+     removeParameter (getLocalName); //  added on enable of prop
61+ 
5562    _opsToLog.setName (" Logger Objects"  );
5663
5764    flux.add (this );
@@ -401,6 +408,59 @@ std::string flxLogger::get_device_id(void)
401408    return  sBuffer ;
402409}
403410
411+ 
412+ // ----------------------------------------------------------------------------
413+ //  Device name methods for output
414+ // ----------------------------------------------------------------------------
415+ bool  flxLogger::get_name_enable (void )
416+ {
417+     return  _outputLocalName;
418+ }
419+ 
420+ // ----------------------------------------------------------------------------
421+ void  flxLogger::set_name_enable (bool  newMode)
422+ {
423+     if  (newMode == _outputLocalName)
424+         return ;
425+ 
426+     //  Are we going from having an ID to not having an ID?
427+     if  (!newMode)
428+     {
429+         //  Remove ID parameter from our internal parameter list
430+         auto  iter = std::find (_paramsToLog.begin (), _paramsToLog.end (), &getLocalName);
431+ 
432+         if  (iter != _paramsToLog.end ())
433+             _paramsToLog.erase (iter);
434+     }
435+     else 
436+     {
437+         //  We want the name to be after sample number, timestamp and ID - if they are enabled.
438+         auto  iter = _paramsToLog.begin ();
439+         if  (iter != _paramsToLog.end ())
440+         {
441+             //  sample number?
442+             if  (*iter == &sampleNumber)
443+                 iter++;
444+ 
445+             if  (iter != _paramsToLog.end () && *iter == ×tamp)
446+                 iter++;
447+ 
448+             if  (iter != _paramsToLog.end () && *iter == &getDeviceID)
449+                 iter++;
450+         }
451+ 
452+         //  Add the ID parameter to our output list.
453+         _paramsToLog.insert (iter, &getLocalName);
454+     }
455+     _outputLocalName = newMode;
456+ }
457+ // ----------------------------------------------------------------------------
458+ std::string flxLogger::get_name (void )
459+ {
460+     return  flux.localName ();
461+ }
462+ 
463+ 
404464// ----------------------------------------------------------------------------
405465//  Log sample number property get/set
406466// ----------------------------------------------------------------------------
0 commit comments