DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::oks::Comment Class Reference

The comment about file modification. A comment can be added when user saves file using OKS tools. More...

#include <file.hpp>

Public Member Functions

const std::string & get_created_by () const
 
const std::string & get_author () const
 
const std::string & get_created_on () const
 
const std::string & get_text () const
 
void validate (const std::string &creation_time)
 
void validate ()
 

Private Member Functions

 Comment () noexcept
 
 Comment (const std::string &text, const std::string &author)
 
 Comment (const oks::Comment &src) noexcept
 

Private Attributes

std::string p_created_by
 
std::string p_author
 
std::string p_created_on
 
std::string p_text
 

Friends

class OksFile
 

Detailed Description

The comment about file modification. A comment can be added when user saves file using OKS tools.

Definition at line 270 of file file.hpp.

Constructor & Destructor Documentation

◆ Comment() [1/3]

dunedaq::oks::Comment::Comment ( )
inlineprivatenoexcept

The constructor creates comment read from file. Only OksFile is allowed to create comments.

Definition at line 277 of file file.hpp.

277{ ; }

◆ Comment() [2/3]

dunedaq::oks::oks::Comment::Comment ( const std::string & text,
const std::string & author )
private

The constructor creates new comment from text. Only OksFile is allowed to create comments.

Exceptions
Throwstd::exception in case of problems.

Definition at line 651 of file file.cpp.

651 :
653 p_author (author),
655 p_text (text)
656{
657 validate();
658}
std::string p_created_by
Definition file.hpp:309
std::string p_created_on
Definition file.hpp:311
std::string p_text
Definition file.hpp:312
std::string p_author
Definition file.hpp:310
static std::string & get_host_name()
Get hostname of given process.
Definition kernel.cpp:429
static std::string & get_user_name()
Get username of given process.
Definition kernel.cpp:468

◆ Comment() [3/3]

dunedaq::oks::oks::Comment::Comment ( const oks::Comment & src)
privatenoexcept

The copy constructor. Only OksFile is allowed to create comments.

Definition at line 660 of file file.cpp.

660 :
661 p_created_by (src.p_created_by),
662 p_author (src.p_author),
663 p_created_on (src.p_created_on),
664 p_text (src.p_text)
665{
666}

Member Function Documentation

◆ get_author()

const std::string & dunedaq::oks::Comment::get_author ( ) const
inline

The name of author created comment (as defined from user input, e.g. first and last name, email address, etc.).

Definition at line 292 of file file.hpp.

292{ return p_author; }

◆ get_created_by()

const std::string & dunedaq::oks::Comment::get_created_by ( ) const
inline

The name of user created comment (as defined by process ID).

Definition at line 289 of file file.hpp.

289{ return p_created_by; }

◆ get_created_on()

const std::string & dunedaq::oks::Comment::get_created_on ( ) const
inline

The name of host where comment was created.

Definition at line 295 of file file.hpp.

295{ return p_created_on; }

◆ get_text()

const std::string & dunedaq::oks::Comment::get_text ( ) const
inline

The comment text.

Definition at line 298 of file file.hpp.

298{ return p_text; }

◆ validate() [1/2]

void dunedaq::oks::oks::Comment::validate ( )

Validate text of the comment.

Exceptions
Throwstd::exception if it is empty.

Definition at line 644 of file file.cpp.

645{
646 if(p_text.empty()) {
647 throw std::runtime_error("text is empty");
648 }
649}

◆ validate() [2/2]

void dunedaq::oks::oks::Comment::validate ( const std::string & creation_time)

Parse creation time-stamp and validate text.

Exceptions
Throwstd::exception in case of problems.

Definition at line 631 of file file.cpp.

632{
633 // YYYYMMDDThhmmss
634 if( creation_time.size() != 15 || creation_time[8] != 'T' ) {
635 std::ostringstream msg;
636 msg << "the creation time \'" << creation_time << "\' is not an ISO-8601 date-time";
637 throw std::runtime_error(msg.str().c_str());
638 }
639
640 validate();
641}

Friends And Related Symbol Documentation

◆ OksFile

friend class OksFile
friend

Definition at line 272 of file file.hpp.

Member Data Documentation

◆ p_author

std::string dunedaq::oks::Comment::p_author
private

Definition at line 310 of file file.hpp.

◆ p_created_by

std::string dunedaq::oks::Comment::p_created_by
private

Definition at line 309 of file file.hpp.

◆ p_created_on

std::string dunedaq::oks::Comment::p_created_on
private

Definition at line 311 of file file.hpp.

◆ p_text

std::string dunedaq::oks::Comment::p_text
private

Definition at line 312 of file file.hpp.


The documentation for this class was generated from the following files: