Commit afd1b681 authored by Davis King's avatar Davis King

Added wrappers for the new overloads which take std::string.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%404087
parent b233e3ee
...@@ -49,6 +49,10 @@ namespace dlib ...@@ -49,6 +49,10 @@ namespace dlib
std::istream& in std::istream& in
); );
config_reader_thread_safe_1(
const std::string& config_file
);
virtual ~config_reader_thread_safe_1( virtual ~config_reader_thread_safe_1(
); );
...@@ -59,6 +63,10 @@ namespace dlib ...@@ -59,6 +63,10 @@ namespace dlib
std::istream& in std::istream& in
); );
void load_from (
const std::string& config_file
);
bool is_key_defined ( bool is_key_defined (
const std::string& key const std::string& key
) const; ) const;
...@@ -193,6 +201,22 @@ namespace dlib ...@@ -193,6 +201,22 @@ namespace dlib
fill_block_table(); fill_block_table();
} }
// ----------------------------------------------------------------------------------------
template <
typename config_reader_base,
typename map_string_void
>
void config_reader_thread_safe_1<config_reader_base,map_string_void>::
load_from(
const std::string& config_file
)
{
auto_mutex M(*m);
cr->load_from(config_file);
fill_block_table();
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
...@@ -221,6 +245,34 @@ namespace dlib ...@@ -221,6 +245,34 @@ namespace dlib
} }
} }
// ----------------------------------------------------------------------------------------
template <
typename config_reader_base,
typename map_string_void
>
config_reader_thread_safe_1<config_reader_base,map_string_void>::
config_reader_thread_safe_1(
const std::string& config_file
) :
m(0),
cr(0),
own_pointers(true)
{
try
{
m = new rmutex;
cr = new config_reader_base(config_file);
fill_block_table();
}
catch (...)
{
if (m) delete m;
if (cr) delete cr;
throw;
}
}
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
template < template <
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment