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