sjef
Classes | Typedefs | Enumerations | Functions
sjef Namespace Reference

Classes

class  Locker
 A thread-safe class for an inter-thread/inter-process lock. The lock mechanism is based on a locked file in the file system. The locked file is a file that may or may not already exist; if it doesn't, it is created. The file contents are not altered, and the file is not deleted. If the specified file is a directory, the lock is instead made on a file in that directory. All threads in the same process using the locker must do so through the same Locker object. More...
 
class  Logger
 
class  Project
 
class  runtime_error
 

Typedefs

using mapstringstring_t = std::map< std::string, std::string >
 

Enumerations

enum  status : int {
  unknown = 0, running = 1, waiting = 2, completed = 3,
  unevaluated = 4, killed = 5
}
 

Functions

template<typename Arg >
std::ostream & operator<< (const Logger &l, Arg arg)
 
bool check_backends (const std::string &suffix)
 Check whether a backend specification file is valid. Only the top-level structure of the file is checked, to the point where it could be opened and used in a Project. More...
 
std::filesystem::path expand_path (const std::filesystem::path &path, const std::string &suffix="")
 Edit a file path name. More...
 
std::string xmlRepair (const std::string &source, const mapstringstring_t &injections={})
 Repair an xml dataset by completing any open tags. More...
 
std::string version () noexcept
 Report the software version. More...
 

Typedef Documentation

◆ mapstringstring_t

using sjef::mapstringstring_t = typedef std::map<std::string, std::string>

Enumeration Type Documentation

◆ status

enum sjef::status : int
Enumerator
unknown 
running 
waiting 
completed 
unevaluated 
killed 

Function Documentation

◆ check_backends()

bool sjef::check_backends ( const std::string &  suffix)

Check whether a backend specification file is valid. Only the top-level structure of the file is checked, to the point where it could be opened and used in a Project.

Parameters
suffix/usr/local/etc/sjef/suffix/backends.xml and ~/.sjef/suffix/backends.xml will be checked
Returns

◆ expand_path()

std::filesystem::path sjef::expand_path ( const std::filesystem::path &  path,
const std::string &  suffix = "" 
)

Edit a file path name.

  • expand environment variables
  • expand ~ as the user home directory
  • map unix-specific environment variables HOME, TMPDIR to native counterparts
  • force all path separators (/,) to native form
  • resolve a relative input path to its fully-resolved form using the current working directory
  • if the file name does not end with a supplied suffix, append it
    Parameters
    path
    suffixIf given and not empty, if path does not end with this file suffix, append it
    Returns
    the expanded and sanitised path

◆ operator<<()

template<typename Arg >
std::ostream& sjef::operator<< ( const Logger l,
Arg  arg 
)

◆ version()

std::string sjef::version ( )
noexcept

Report the software version.

Returns

◆ xmlRepair()

std::string sjef::xmlRepair ( const std::string &  source,
const mapstringstring_t injections = {} 
)

Repair an xml dataset by completing any open tags.

Parameters
sourceThe initial xml
injectionsxml nodes for which additional place-holder xml should be injected if the node has to be completed. The key is the node name, and the value the xml to be injected
Returns
The repaired xml