OGS
BaseLib::ConfigTreeTopLevel Class Referencefinal

Detailed Description

Manages a ConfigTree and the boost::property_tree it depends on.

The whole purpose of this class is making the management of said dependency easy.

Definition at line 22 of file ConfigTreeUtil.h.

#include <ConfigTreeUtil.h>

Collaboration diagram for BaseLib::ConfigTreeTopLevel:
[legend]

Public Member Functions

 ConfigTreeTopLevel (std::string const &filepath, bool const be_ruthless, ConfigTree::PTree &&ptree)
 
ConfigTree const & operator* () const
 
ConfigTree const * operator-> () const
 
void checkAndInvalidate ()
 

Private Attributes

ConfigTree::PTree const ptree_
 boost::property_tree that underlies ctree_ More...
 
ConfigTree ctree_
 ConfigTree depending on ptree_. More...
 

Constructor & Destructor Documentation

◆ ConfigTreeTopLevel()

BaseLib::ConfigTreeTopLevel::ConfigTreeTopLevel ( std::string const &  filepath,
bool const  be_ruthless,
ConfigTree::PTree &&  ptree 
)
explicit

Construct a new instance from the given data.

Parameters
filepathstored for use in error/warning messages
be_ruthlessif true, then warnings will raise errors, .i.e. lead to program abortion, else warnings will only warn
ptreethe underlying ptree of the created ConfigTree

Definition at line 28 of file ConfigTreeUtil.cpp.

31  : ptree_(std::move(ptree)),
34 {
35 }
ConfigTree ctree_
ConfigTree depending on ptree_.
ConfigTree::PTree const ptree_
boost::property_tree that underlies ctree_
static void onerror(std::string const &filename, std::string const &path, std::string const &message)
Definition: ConfigTree.cpp:225
static void onwarning(std::string const &filename, std::string const &path, std::string const &message)
Definition: ConfigTree.cpp:232

Member Function Documentation

◆ checkAndInvalidate()

void BaseLib::ConfigTreeTopLevel::checkAndInvalidate ( )

Check if the contained ConfigTree has been processed entirely.

This only checks the top level, as usual with ConfigTree instances.

Postcondition
Afterwards the contained ConfigTree instance must not be used anymore!

Definition at line 47 of file ConfigTreeUtil.cpp.

48 {
50 }
void checkAndInvalidate(ConfigTree &conf)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: ConfigTree.cpp:470

References BaseLib::checkAndInvalidate(), and ctree_.

◆ operator*()

ConfigTree const & BaseLib::ConfigTreeTopLevel::operator* ( ) const

Access the contained ConfigTree.

The non-const version of this method has not been implemented in order to prevent invalidating the ctree_ when it is passed around. In order to check and invalidate ctree_ use the provided member function.

Definition at line 37 of file ConfigTreeUtil.cpp.

38 {
39  return ctree_;
40 }

References ctree_.

◆ operator->()

ConfigTree const * BaseLib::ConfigTreeTopLevel::operator-> ( ) const

Access the contained ConfigTree.

The non-const version of this method has not been implemented in order to prevent invalidating the ctree_ when it is passed around. In order to check and invalidate ctree_ use the provided member function.

Definition at line 42 of file ConfigTreeUtil.cpp.

43 {
44  return &ctree_;
45 }

References ctree_.

Member Data Documentation

◆ ctree_

ConfigTree BaseLib::ConfigTreeTopLevel::ctree_
private

ConfigTree depending on ptree_.

Definition at line 64 of file ConfigTreeUtil.h.

Referenced by checkAndInvalidate(), operator*(), and operator->().

◆ ptree_

ConfigTree::PTree const BaseLib::ConfigTreeTopLevel::ptree_
private

boost::property_tree that underlies ctree_

Definition at line 63 of file ConfigTreeUtil.h.


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