Tim.cpp

00001 #include <config/ConfigObject.h>
00002 #include <config/Change.h>
00003 #include "Tim.h"
00004 
00005 namespace SCTDAL {
00006   const std::string Tim::s_class_name("Tim");
00007 
00008     // the constructor
00009 
00010   Tim::Tim(::Configuration& db, ::ConfigObject& o) :
00011     DalObject(db, o)  {
00012   }
00013 
00014 
00015   void Tim::print(unsigned int indent, bool print_header, std::ostream& s) const
00016   {
00017     std::string str(indent, ' ');
00018 
00019     if(print_header) {
00020       s
00021         << str << "SCTDAL Tim object:\n"
00022         << str << "  id: \'" << UID() << "\', class name: \'" << class_name() << "\'\n";
00023     }
00024 
00025 
00026       // print direct attributes
00027 
00028     s << str << "  triggerFrequency: " << triggerFrequency() << std::endl;
00029     s << str << "  resetFrequency: " << resetFrequency() << std::endl;
00030   }
00031 
00032 
00033   std::ostream&
00034   operator<<(std::ostream& s, const Tim * obj)
00035   {
00036     s << '\'';
00037 
00038     if(obj == 0) {
00039       s << "(null)";
00040     }
00041     else {
00042       obj->config_object().print_ptr(s);
00043     }
00044     s << '\'';
00045 
00046     return s;
00047   }
00048 
00049 
00050   std::ostream&
00051   operator<<(std::ostream& s, const Tim & obj)
00052   {
00053     if(&obj == 0) {
00054       s << "(null)";
00055     }
00056     else {
00057       obj.print(0, true, s);
00058     }
00059 
00060     return s;
00061   }
00062 
00063 
00064   void Tim::update(::Configuration& conf, const ::ConfigurationChange * change)
00065   {
00066     conf.update<Tim>(change->get_modified_objs(), change->get_removed_objs());
00067   }
00068 
00069 
00070   void Tim::reset(::Configuration& conf, bool re_initialise_obj)
00071   {
00072     conf.reset_objects<Tim>(re_initialise_obj);
00073   }
00074 
00075 
00076   void Tim::init(bool /* init_children */)
00077   {
00078     p_was_read = true;
00079     increment_read();
00080     static const char * env = ::getenv("TDAQ_REPORT_DAL_OBJECT_READ");
00081     if(env) { std::cout << "DEBUG: read object " << this << std::endl; }
00082 
00083     if(!p_obj.get("triggerFrequency",m_triggerFrequency)) {
00084       std::cerr << "ERROR: could not find attribute 'triggerFrequency'\n";
00085     }
00086     else {
00087       p_db.convert(m_triggerFrequency, p_obj, "triggerFrequency");
00088     }
00089 
00090     if(!p_obj.get("resetFrequency",m_resetFrequency)) {
00091       std::cerr << "ERROR: could not find attribute 'resetFrequency'\n";
00092     }
00093     else {
00094       p_db.convert(m_resetFrequency, p_obj, "resetFrequency");
00095     }
00096 
00097     p_obj.clear(); // clear resources used by implementation
00098   }
00099 
00100   Tim::~Tim()
00101   {
00102   }
00103 
00104 }

Generated on Mon Feb 6 14:01:35 2006 for SCT DAQ/DCS Software - C++ by  doxygen 1.4.6