Leosac  0.8.0
Open Source Access Control
Leosac::Tools Namespace Reference

Classes

class  BaseVisitor
 Base class for visitor, should not be used directly. More...
 
class  DatabaseLogSink
 A custom sink that write LogEntry object to a SQLite database. More...
 
class  ElapsedTimeCounter
 This class provide a simple to get the elapsed time since it's creation. More...
 
class  ISchedule
 
class  IVisitable
 Base class to make an object visitable. More...
 
class  LogEntry
 A log entry. More...
 
struct  LogView
 SQL view over the LogEntry table. More...
 
class  PropertyTreeExtractor
 This class is a simpler helper to extract value from a property tree. More...
 
class  RuntimeOptions
 Holds informations about runtime options, such as "is this a verbose run" or path to configurations files. More...
 
class  Schedule
 A schedule is simply a list of time frame (SingleTimeFrame) with a name. More...
 
struct  ScheduleJSONSerializer
 Serialize schedules. More...
 
struct  ScheduleJSONStringSerializer
 
struct  ScheduleMapping
 Represent one of the mapping of a schedule. More...
 
struct  ScheduleMappingJSONSerializer
 Serialize ScheduleMappings. More...
 
struct  ScheduleMappingJSONStringSerializer
 
class  ScheduleValidator
 
class  SignalHandler
 
struct  SingleTimeFrame
 This struct abstracts what we call a single time frame. More...
 
class  Stacktrace
 Store information about a stacktrace at a given point in the program execution. More...
 
class  UnixFileWatcher
 
class  UnixFs
 
class  UnixShellScript
 
class  UnixSyscall
 
class  Version
 
class  Visitor
 A Visitor object. More...
 
class  XmlNodeNameEnforcer
 This class is a simple wrapper that throws a ConfigException message formated to report the user that an invalid xml node name has been encountered. More...
 
class  XmlScheduleLoader
 Load a list of schedules from a boost::property_tree. More...
 

Typedefs

using json = nlohmann::json
 
using SchedulePtr = std::shared_ptr< Schedule >
 
using ScheduleId = unsigned long
 
using ScheduleLWPtr = odb::lazy_weak_ptr< Schedule >
 
using ISchedulePtr = std::shared_ptr< ISchedule >
 
using IScheduleCPtr = std::shared_ptr< const ISchedule >
 
using ScheduleMappingPtr = std::shared_ptr< ScheduleMapping >
 
using ScheduleMappingLPtr = odb::lazy_shared_ptr< ScheduleMapping >
 
using ScheduleMappingLWPtr = odb::lazy_weak_ptr< ScheduleMapping >
 
using ScheduleMappingId = unsigned long
 

Enumerations

enum  Signal : int {
  Signal::SigHup = SIGHUP, Signal::SigInt = SIGINT, Signal::SigQuit = SIGQUIT, Signal::SigKill = SIGKILL,
  Signal::SigSegv = SIGSEGV, Signal::SigPipe = SIGPIPE, Signal::SigTerm = SIGTERM, Signal::SigUsr1 = SIGUSR1,
  Signal::SigUsr2 = SIGUSR2, Signal::SigStop = SIGSTOP
}
 

Functions

const std::string & get_git_sha1 ()
 Retrieve the SHA1 of the HEAD commit when Leosac was built. More...
 
template<class InputIterator >
int compute_timeout (InputIterator begin, InputIterator end)
 Compute the time until the next timeout from a collection of time point. More...
 
boost::property_tree::ptree propertyTreeFromXmlFile (const std::string &path)
 Build a property tree from a xml file. More...
 
void propertyTreeToXmlFile (const boost::property_tree::ptree &tree, const std::string &path)
 Write a property tree to an xml file. More...
 
std::string propertyTreeToXml (const boost::property_tree::ptree &tree)
 Convert a property tree to an xml formatted string. More...
 
bool boost_text_archive_to_ptree (const std::string &data, boost::property_tree::ptree &tree) noexcept
 Convert a boost text archive, whose content is represented as a string (data) to a property tree. More...
 

Typedef Documentation

◆ IScheduleCPtr

using Leosac::Tools::IScheduleCPtr = typedef std::shared_ptr<const ISchedule>

Definition at line 38 of file ToolsFwd.hpp.

◆ ISchedulePtr

using Leosac::Tools::ISchedulePtr = typedef std::shared_ptr<ISchedule>

Definition at line 37 of file ToolsFwd.hpp.

◆ json

typedef nlohmann::json Leosac::Tools::json

Definition at line 31 of file ScheduleMappingSerializer.hpp.

◆ ScheduleId

using Leosac::Tools::ScheduleId = typedef unsigned long

Definition at line 33 of file ToolsFwd.hpp.

◆ ScheduleLWPtr

using Leosac::Tools::ScheduleLWPtr = typedef odb::lazy_weak_ptr<Schedule>

Definition at line 34 of file ToolsFwd.hpp.

◆ ScheduleMappingId

using Leosac::Tools::ScheduleMappingId = typedef unsigned long

Definition at line 44 of file ToolsFwd.hpp.

◆ ScheduleMappingLPtr

using Leosac::Tools::ScheduleMappingLPtr = typedef odb::lazy_shared_ptr<ScheduleMapping>

Definition at line 42 of file ToolsFwd.hpp.

◆ ScheduleMappingLWPtr

using Leosac::Tools::ScheduleMappingLWPtr = typedef odb::lazy_weak_ptr<ScheduleMapping>

Definition at line 43 of file ToolsFwd.hpp.

◆ ScheduleMappingPtr

using Leosac::Tools::ScheduleMappingPtr = typedef std::shared_ptr<ScheduleMapping>

Definition at line 41 of file ToolsFwd.hpp.

◆ SchedulePtr

using Leosac::Tools::SchedulePtr = typedef std::shared_ptr<Schedule>

Definition at line 32 of file ToolsFwd.hpp.

Enumeration Type Documentation

◆ Signal

enum Leosac::Tools::Signal : int
strong
Enumerator
SigHup 
SigInt 
SigQuit 
SigKill 
SigSegv 
SigPipe 
SigTerm 
SigUsr1 
SigUsr2 
SigStop 

Definition at line 39 of file signalhandler.hpp.

Function Documentation

◆ boost_text_archive_to_ptree()

bool Leosac::Tools::boost_text_archive_to_ptree ( const std::string &  data,
boost::property_tree::ptree &  tree 
)
noexcept

Convert a boost text archive, whose content is represented as a string (data) to a property tree.

If this failed for any reason, return false. Otherwise returns true. This function does not throw.

Definition at line 89 of file XmlPropertyTree.cpp.

◆ compute_timeout()

template<class InputIterator >
int Leosac::Tools::compute_timeout ( InputIterator  begin,
InputIterator  end 
)

Compute the time until the next timeout from a collection of time point.

This function will iterate over a collection of time point and return the number of milliseconds until the soonest timeout.

If the collection is empty or if all the time point are time_point::max() the function return -1.

Definition at line 39 of file timeout.hpp.

◆ get_git_sha1()

const std::string& Leosac::Tools::get_git_sha1 ( )

Retrieve the SHA1 of the HEAD commit when Leosac was built.

◆ propertyTreeFromXmlFile()

boost::property_tree::ptree Leosac::Tools::propertyTreeFromXmlFile ( const std::string &  path)

Build a property tree from a xml file.

Parameters
pathPath to the xml file.

Definition at line 39 of file XmlPropertyTree.cpp.

◆ propertyTreeToXml()

std::string Leosac::Tools::propertyTreeToXml ( const boost::property_tree::ptree &  tree)

Convert a property tree to an xml formatted string.

Definition at line 67 of file XmlPropertyTree.cpp.

◆ propertyTreeToXmlFile()

void Leosac::Tools::propertyTreeToXmlFile ( const boost::property_tree::ptree &  tree,
const std::string &  path 
)

Write a property tree to an xml file.

Definition at line 58 of file XmlPropertyTree.cpp.