Commit 09701e53 authored by Davis King's avatar Davis King

Changed the config_reader object so you don't have to say config_reader::kernel_1a

anymore to declare it.  Now you just say config_reader.

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%404226
parent 694f73ef
...@@ -9,40 +9,23 @@ ...@@ -9,40 +9,23 @@
#include "algs.h" #include "algs.h"
#ifndef DLIB_ISO_CPP_ONLY
#include "config_reader/config_reader_thread_safe_1.h"
#endif
namespace dlib namespace dlib
{ {
typedef config_reader_kernel_1<
map<std::string,std::string>::kernel_1b,
map<std::string,void*>::kernel_1b,
tokenizer::kernel_1a
> config_reader;
class config_reader
{
config_reader() {}
public:
//----------- kernels ---------------
// kernel_1a
typedef config_reader_kernel_1<
map<std::string,std::string>::kernel_1b,
map<std::string,void*>::kernel_1b,
tokenizer::kernel_1a
> kernel_1a;
#ifndef DLIB_ISO_CPP_ONLY #ifndef DLIB_ISO_CPP_ONLY
// thread_safe_1a typedef config_reader_thread_safe_1<
typedef config_reader_thread_safe_1< config_reader,
kernel_1a, map<std::string,void*>::kernel_1b
map<std::string,void*>::kernel_1b > config_reader_thread_safe;
> thread_safe_1a;
#endif // DLIB_ISO_CPP_ONLY #endif // DLIB_ISO_CPP_ONLY
};
} }
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
#include "../algs.h" #include "../algs.h"
#include "../stl_checked/std_vector_c.h" #include "../stl_checked/std_vector_c.h"
#ifndef DLIB_ISO_CPP_ONLY
#include "config_reader_thread_safe_1.h"
#endif
namespace dlib namespace dlib
{ {
...@@ -42,6 +46,16 @@ namespace dlib ...@@ -42,6 +46,16 @@ namespace dlib
public: public:
// These two typedefs are defined for backwards compatibility with older versions of dlib.
typedef config_reader_kernel_1 kernel_1a;
#ifndef DLIB_ISO_CPP_ONLY
typedef config_reader_thread_safe_1<
config_reader_kernel_1,
map_string_void
> thread_safe_1a;
#endif // DLIB_ISO_CPP_ONLY
config_reader_kernel_1(); config_reader_kernel_1();
class config_reader_error : public dlib::error class config_reader_error : public dlib::error
......
...@@ -11,16 +11,10 @@ ...@@ -11,16 +11,10 @@
namespace dlib namespace dlib
{ {
template <
typename config_reader_base
>
class config_reader_thread_safe class config_reader_thread_safe
{ {
/*! /*!
REQUIREMENTS ON config_reader_base
is an implementation of config_reader/config_reader_kernel_abstract.h
WHAT THIS EXTENSION DOES FOR config_reader WHAT THIS EXTENSION DOES FOR config_reader
This object extends a normal config_reader by simply wrapping all This object extends a normal config_reader by simply wrapping all
its member functions inside mutex locks to make it safe to use its member functions inside mutex locks to make it safe to use
......
...@@ -410,13 +410,13 @@ namespace ...@@ -410,13 +410,13 @@ namespace
void perform_test ( void perform_test (
) )
{ {
dlog << LINFO << "testing kernel_1a"; dlog << LINFO << "testing config_reader";
print_spinner(); print_spinner();
config_reader_test<config_reader::kernel_1a>(); config_reader_test<config_reader>();
dlog << LINFO << "testing thread_safe_1a"; dlog << LINFO << "testing config_reader_thread_safe";
print_spinner(); print_spinner();
config_reader_test<config_reader::thread_safe_1a>(); config_reader_test<config_reader_thread_safe>();
} }
} a; } a;
......
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