diff options
Diffstat (limited to 'ACE/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h')
-rw-r--r-- | ACE/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ACE/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h b/ACE/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h new file mode 100644 index 00000000000..a767bd47a5b --- /dev/null +++ b/ACE/TAO/orbsvcs/DevGuideExamples/ValueTypes/Notify/Event_i.h @@ -0,0 +1,66 @@ +// $Id$ + +#ifndef EVENT_H_ +#define EVENT_H_ + +#include "EventS.h" + +#include <iostream> +#include "tao/Valuetype/ValueFactory.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class MyEvent_i + : public virtual OBV_MyEvent + , public virtual CORBA::DefaultValueRefCountBase +{ +public: + MyEvent_i(const char* n, CORBA::Long k) + { + name(n); + kind(k); + } + + virtual void dump () + { + CORBA::LongSeq& pl = payload(); + ACE_DEBUG((LM_DEBUG, "\nPayload contents.\n")); + for (CORBA::ULong i = 0; i < pl.length(); ++i) + { + ACE_DEBUG((LM_DEBUG, "%d = %d\n", i, pl[i])); + } + ACE_DEBUG((LM_DEBUG, "\n")); + } + + virtual CORBA::Long size () + { + return payload().length(); + } + + virtual void add_long (CORBA::Long n) + { + CORBA::LongSeq& pl = payload(); + CORBA::ULong idx = pl.length(); + pl.length(idx + 1); + pl[idx] = n; + } +}; + +class MyEventFactory + : public virtual CORBA::ValueFactoryBase +{ +public: + + virtual CORBA::ValueBase * create_for_unmarshal () + { + // It doesn't matter what values we construct it with + // because they will be overwritten with the demarshaled values. + return new MyEvent_i("", -1); + } +}; + + +#endif /* EVENT_H_ */ + |