ClockWork DB CoreAPI 1.0.48
Abstract Time Series and Storage/Management Library
Loading...
Searching...
No Matches
provider.hpp
1#ifndef HAVE_TOM_TSDB_PROVIDER_HPP
2#define HAVE_TOM_TSDB_PROVIDER_HPP
3
4#include <tom-util/scalar.hpp>
5#include <tom-util/xml_config.hpp>
6#include <ostream>
7#include <tom-tsdb/smart_pointers.hpp>
8
9namespace tom {
10
11 class dynamic_library;
12
13 namespace tsdb {
14
15 class provider;
16 class session;
17
18 }
19
20}
21
22// mod_<provider> backend structures/typdefs/macros
23extern "C" {
24
25 /*
26 * This is the prototype for the method to produce a session w/in a module!
27 */
28 typedef tom::tsdb::session_sptr (*factory_method)( const tom::tsdb::provider &, const tom::String & );
29 typedef bool (*init_method)( void );
30 typedef void (*fini_method)( void );
31
32 /*
33 * This is the struct that contains info about a backend provider
34 */
35 typedef struct TOM_UTIL_API tom_tsdb_provider_
36 {
37 const char * tsdb_library_version; // use macro below for this...
38 const char * module_version; // use mod pkg version string
39 const char * description; // short description about the provider
40 const char * bug_report; // email where bug reports can be sent
41
42 factory_method factory; // fctn ptr to create a session!
43 init_method init; // init the module ...can be null
44 fini_method finish; // finish the module...can be null
45 const char * xml_template; // sample xml config
46 } tom_tsdb_provider;
47
48#define TSDB_LIBRARY_VERSION "1.0.43"
49
50}
51
52namespace tom {
53
54 namespace tsdb {
55
56
57 class TOM_UTIL_API provider
58 {
59 public:
60 provider( );
62 virtual ~provider();
63
64 const char *
65 name() const;
66
67 const char *
68 description() const;
69
70 const char *
71 bug_report() const;
72
73 const char *
74 version() const;
75
76 const char *
77 tsdb_version() const;
78
79 const char *
80 xml_config_template() const;
81
82 session_sptr
83 get_session( const tom::String &repo );
84
85 virtual
86 std::ostream &
87 describe( std::ostream & ) const;
88
89 protected:
90 void
91 check_for_correct_version();
92
93 private:
94 tom::dynamic_library * m_library;
95 tom::string m_name;
96 tom_tsdb_provider * m_provider;
97 init_method m_init;
98 fini_method m_finish;
99 factory_method m_factory;
100 };
101
102 TOM_UTIL_API
103 inline
104 std::ostream &
105 operator<<( std::ostream &os, const tom::tsdb::provider &p )
106 {
107 return p.describe( os );
108 }
109
110 } // end tsdb namespace
111
112} // end tom namespace
113
114#endif
Definition string.hpp:15
Definition module_loader.hpp:16
Definition provider.hpp:58
Definition value_types.hpp:96
Definition provider.hpp:36