Libbarrett  1.2.4
include/barrett/log/writer.h
Go to the documentation of this file.
00001 
00033 #ifndef BARRETT_LOG_WRITER_H_
00034 #define BARRETT_LOG_WRITER_H_
00035 
00036 
00037 #include <fstream>
00038 
00039 #include <barrett/detail/ca_macro.h>
00040 #include <barrett/log/traits.h>
00041 
00042 
00043 namespace barrett {
00044 namespace log {
00045 
00046 
00047 template<typename T, typename Traits = Traits<T> >
00048 class Writer {
00049 public:
00050         typedef typename Traits::parameter_type parameter_type;
00051 
00052         explicit Writer(const char* fileName);
00053         ~Writer();
00054 
00055         void putRecord(parameter_type data);
00056         void close();
00057 
00058 protected:
00059         std::ofstream file;
00060         size_t recordLength;
00061         char* buffer;
00062 
00063 private:
00064         DISALLOW_COPY_AND_ASSIGN(Writer);
00065 };
00066 
00067 
00068 }
00069 }
00070 
00071 
00072 // include template definitions
00073 #include <barrett/log/detail/writer-inl.h>
00074 
00075 
00076 #endif /* BARRETT_LOG_WRITER_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Defines