Changeset 676 for library/bdm/bdmroot.h
- Timestamp:
- 10/22/09 01:13:47 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/bdm/bdmroot.h
r673 r676 1 1 2 /*! 2 3 \file … … 24 25 25 26 namespace bdm { 26 27 28 //forward declaration 29 class logger; 30 31 //! information about connection to a logger 32 class log_record { 33 public: 34 //!remember which logger is registered 35 logger &L; 36 //! vector of log IDs - one element for each entry 37 ivec ids; 38 39 //!default constructor 40 log_record(logger &L0): L(L0),ids(0){} 41 }; 42 27 43 //! Root class of BDM objects 28 44 class root { 29 45 protected: 30 //! level of details that will be logged to logger 46 //! record of connections to the logger 47 log_record* logrec; 48 //! level of details that will be logged to a logger 31 49 int log_level; 32 //! vector of log IDs - one element for each entry 33 ivec log_ids; 50 34 51 public: 52 //!default constructor 53 root() : logrec(NULL),log_level(0) {}; 54 35 55 //! make sure this is a virtual object 36 56 virtual ~root() { 57 if (logrec) delete logrec; 37 58 } 38 59 39 //! This method returns a basicinfo about the current instance60 //! Returns a basic textual info about the current instance 40 61 virtual string to_string() const { 41 62 return ""; 42 63 } 64 //! Register itself in a logger, i.e. allocate space for data from this class 65 //! The level of details (parameter \c level ) is individual for each class. 66 virtual void log_register(logger &L, const string &prefix){ 67 logrec = new log_record(L); 68 } 69 70 //! Write current information into the given logger 71 virtual void log_write() const { 72 } 73 //! set level of details to be logged - needs to be called before log_register! 74 virtual void set_log_level(int level) {log_level = level;} 43 75 44 //! This method arrangeinstance properties according the data stored in the Setting structure76 //! Read instance properties according the data stored in the Setting structure 45 77 virtual void from_setting ( const Setting &set ) { 46 78 } 47 79 48 //! This method save all the instance properties into the Setting structure80 //! Save all the instance properties into the Setting structure 49 81 virtual void to_setting ( Setting &set ) const { 50 82 } 51 83 52 //! This method checks that all internal structures has been correctly set-up, always call at the ned of from_setting84 //! Check that all internal structures has been correctly set-up. Called at the end of from_setting. 53 85 virtual void validate() { 54 86 } 87 55 88 }; 56 89