SignalBase.cpp

Go to the documentation of this file.
00001 /*
00002 
00003 $Header$
00004 
00005 */
00006 
00007 #include "Error.h"
00008 
00009 #include "SignalBase.h"
00010 
00011 // Public methods.
00012 
00013 SignalBase::SignalBase(const String &className, const String &signalName) : Object(),
00014   _orphanSlotObject(NULL),
00015   _orphanSlotMethod(NULL),
00016   _slots(),
00017   _className(className),
00018   _name(signalName)
00019 {
00020 };
00021 
00022 SignalBase::~SignalBase()
00023 {
00024 };
00025 
00026 String SignalBase::name() const
00027 {
00028   return _className + "::" + _name;
00029 };
00030 
00031 String SignalBase::ownerClassName() const
00032 {
00033   return _className;
00034 };
00035 
00036 int SignalBase::listSlots(String &text)
00037 {
00038   String line;
00039   unsigned int n = 1;
00040 
00041   line.sprintf("%s%6s\t%6s\t%10s\t%-32s%s", String::eol(), "#", "NUMBER", "OBJID", "CLASS", String::eol());
00042   text = SIGNAL_COLOR_TITLE(line);
00043 
00044   if (_orphanSlotObject) {
00045     line.sprintf("%6u\t%6u\t%10llu\t%-32s%s", n, 1, _orphanSlotObject->id(), CSTRING(_orphanSlotObject->className()), String::eol());
00046     text += line;
00047   } else
00048       if (!_slots.empty()) {
00049         SlotMap::const_iterator i = _slots.begin();
00050         SlotMap::const_iterator e = _slots.end();
00051 
00052         while (i != e) {
00053           line.sprintf("%6u\t%6u\t%10llu\t%-32s%s", n, i->second.size(), i->first->id(), CSTRING(i->first->className()), String::eol());
00054           text += line;
00055           ++n;
00056           ++i;
00057         }
00058       }
00059   return OK;
00060 }
00061 
00062 // Protected methods.
00063 
00064 int SignalBase::bind(Object *obj)
00065 {
00066   if (!obj)
00067     return ERROR(MSG_NULL_POINTER);
00068 
00069   int res;
00070 
00071   if (FAILED(res = obj->bindSignal(this)))
00072     return ERROR_BACKTRACE(res);
00073 
00074   return OK;
00075 }
00076 
00077 int SignalBase::unbind(Object *obj)
00078 {
00079   if (!obj)
00080     return ERROR(MSG_NULL_POINTER);
00081 
00082   int res;
00083 
00084   if (FAILED(res = obj->unbindSignal(this)))
00085     return ERROR_BACKTRACE(res);
00086 
00087   return OK;
00088 }

Generated on Thu Sep 6 20:11:25 2007 for Pylon Application Platform by  doxygen 1.5.1