41 #ifndef _EVENT_EMITTING_COMPONENT_H_
42 #define _EVENT_EMITTING_COMPONENT_H_
44 #include "component_base.h"
52 const char * initiatorName,
54 const char * data = NULL) :
55 ObjectEvent(initiator, name, data)
57 _initiatorName = initiatorName;
60 const char * InitiatorName()
62 return _initiatorName.c_str();
65 void InitiatorName(
const char * name)
67 _initiatorName = name;
70 bool Matches(
const char * initiatorName,
const char * eventName)
72 if (strcmp(this->InitiatorName(), initiatorName) == 0 &&
73 strcmp(this->EventName(), eventName) == 0 )
82 std::string _initiatorName;
92 _eventAtt =
new char[1];
100 if (_eventAtt != NULL)
delete [] _eventAtt;
108 static AttributeName MetaEventAttribute(
"InjectedEventHandler");
113 ComponentBase::SetAvailableAttributes(availableAttributes);
117 CallbackMethodCallerTemplate<InjectedEventHandlerComponent> updateEventAttrCb(
118 (void_method_void)&disti::InjectedEventHandlerComponent::UpdateEventAttr
121 Attributes().Add(
new DistiAttributeString(&updateEventAttrCb,MetaEventAttribute, &_eventAtt));
127 void UpdateEventAttr()
130 std::string eventAtt(_eventAtt);
132 std::string::size_type split = eventAtt.find_first_of(
"|", 0);
135 std::string originator = eventAtt.substr(0, ((split >= eventAtt.size())?eventAtt.size()-1:split) );
138 std::string tempStr = (( (split+1) >= eventAtt.size() || split >= eventAtt.size() )?
"":eventAtt.substr(split+1));
139 split = tempStr.find_first_of(
"|", 0);
142 std::string name = tempStr.substr(0, ((split >= tempStr.size())?tempStr.size()-1:split) );
143 std::string data = (( (split+1) >= tempStr.size() || split >= tempStr.size() )?
"":tempStr.substr(split+1));
145 printf(
"we got an updated eventAttr value\n originator: [%s]\n name: [%s]\n data: [%s]\n\n", originator.c_str(), name.c_str(), data.c_str());
163 #endif // _EVENT_EMITTING_COMPONENT_H_
Definition: InjectedEventHandlerComponent.h:85
virtual void HandleInjectedEvent(InjectedObjectEvent *ev)=0
Definition: InjectedEventHandlerComponent.h:48
virtual void SetAvailableAttributes(unsigned int availableAttributes)
Definition: InjectedEventHandlerComponent.h:106
~InjectedEventHandlerComponent()
Definition: InjectedEventHandlerComponent.h:98
Definition: AttributeChangedEmitter.h:46
InjectedEventHandlerComponent(int generateInstance=FALSE)
Definition: InjectedEventHandlerComponent.h:90