- Main Page
- Related Pages
- Modules
- Classes
- Files

- File List
- File Members

# loggers.h

Go to the documentation of this file.

    00001
    00013 #ifndef LGR_H
    00014 #define LGR_H
    00015
    00016 #include "libBM.h"
    00017
    00018 namespace bdm{
    00019 using std::string;
    00020
    00027 class memlog : public logger {
    00028
    00029 protected:
    00031         int maxlen;
    00033         int ind;
    00035         Array<mat> vectors;
    00037 public:
    00039         memlog ( int maxlen0 ) : logger(),maxlen ( maxlen0 ),ind ( 0 ),vectors ( 0 ) {}
    00041         void init() {
    00042                 int i; int n =entries.length();
    00043                 vectors.set_size ( n );
    00044                 for ( i=0;i<n;i++ ) {vectors(i).set_size (maxlen,entries(i)._dsize() );}
    00045                 ;
    00046         }
    00047         void step() {if ( ind<maxlen ) ind++; else it_error ( "memlog::ind is too high;" );}
    00048         void logit ( int id, const vec &v ) {
    00049                 it_assert_debug(id<vectors.length(),"Logger was not initialized, run init().");
    00050                 if(id>=0){ vectors ( id ).set_row ( ind,v );}
    00051         }
    00053         void itsave(const char* fname);
    00054 };
    00055
    00064 class dirfilelog : public memlog {
    00065
    00066 protected:
    00068         string dirname;
    00070         Array<string> scalarnames;
    00071 public:
    00075         dirfilelog ( std::string dirname0, int maxlen0 ) : memlog ( maxlen0 ), dirname ( dirname0 ), scalarnames ( 0 ) {}
    00077         void init();
    00078         void step();
    00079         void finalize();
    00083         void write_buffers ( int Len );
    00084 };
    00085
    00086 };
    00087 #endif // LGR_H