Am Mon, 25 Jul 2011 14:56:24 +0900 schrieb ChunEon Park:

Thanks for this hint. I'll change it next time I touch the file. I'm
sure that there're more asserts in eflxx. I've to search them all and
find correct error handling or replace by log output.

> really good to use assert instead of eina_log?
> ------------------------------------
> Let's run together for the best moment!
>  -Regards, Hermet-
>  
> -----Original Message-----
> From: "Vincent Torri"<vto...@univ-evry.fr> 
> To: enlightenment-devel@lists.sourceforge.net
> Cc: 
> Sent: 11-07-23(토) 15:14:55
> Subject: Re: [E-devel] E SVN: andreas IN trunk/BINDINGS/cxx/ecorexx:
> include/ecorexx src On Fri, 22 Jul 2011, Enlightenment SVN wrote:
> > Log:
> > Ecorexx::Timer design changed to have a factory and provide destroy
> > function to wrap C interface better than before also used sigc++
> > slots as callback provider
> what about using shared_ptr for your factory ?
> Vincent
> >
> > Author: andreas
> > Date: 2011-07-22 15:39:05 -0700 (Fri, 22 Jul 2011)
> > New Revision: 61598
> > Trac: http://trac.enlightenment.org/e/changeset/61598
> >
> > Modified:
> > trunk/BINDINGS/cxx/ecorexx/include/ecorexx/Timer.h
> > trunk/BINDINGS/cxx/ecorexx/src/Timer.cpp
> >
> > Modified: trunk/BINDINGS/cxx/ecorexx/include/ecorexx/Timer.h
> > ===================================================================
> > --- trunk/BINDINGS/cxx/ecorexx/include/ecorexx/Timer.h 2011-07-22
> > 18:58:25 UTC (rev 61597) +++
> > trunk/BINDINGS/cxx/ecorexx/include/ecorexx/Timer.h 2011-07-22
> > 22:39:05 UTC (rev 61598) @@ -9,24 +9,13 @@
> >
> > namespace Ecorexx {
> >
> > -// TODO: maybe change signal architecture back to callback
> > architecture. Think about it! -
> > class Timer
> > {
> > - typedef sigc::signal Signal;
> > - typedef sigc::signal Loop;
> > - //typedef sigc::slot1 Slot;
> > -
> > public:
> > - Timer( double seconds, bool singleshot = false );
> > - virtual ~Timer();
> > + static Timer *factory (double seconds, sigc::slot task, bool loop
> > = false);
> >
> > - //virtual void tick();
> > -
> > -// static Timer* singleShot( double seconds, const
> > Timer::Slot& ); // TODO: CountedPtr
> > + void destroy ();
> >
> > - void del ();
> > -
> > void setInterval (double interval);
> >
> > double getInterval ();
> > @@ -43,16 +32,18 @@
> >
> > static void setPrecision (double precision);
> >
> > -
> > -public: /* signals */
> > - Timer::Signal timeout;
> > - Timer::Loop loop;
> > -
> > + static void dump ();
> > +
> > private:
> > - Ecore_Timer* _et;
> > - bool _ss;
> > + Ecore_Timer *mETimer;
> > + sigc::slot mTask;
> >
> > - static Eina_Bool __dispatcher( void* data );
> > + static Eina_Bool dispatcherFunc (void *data);
> > +
> > + Timer (); // allow no construction
> > + Timer (const Timer&); // forbid copy constructor
> > + Timer (double seconds, sigc::slot task, bool loop); // private
> > construction -> use factory ()
> > + virtual ~Timer (); // forbid direct delete -> use destroy()
> > };
> >
> > } // end namespace Ecorexx
> >
> > Modified: trunk/BINDINGS/cxx/ecorexx/src/Timer.cpp
> > ===================================================================
> > --- trunk/BINDINGS/cxx/ecorexx/src/Timer.cpp 2011-07-22 18:58:25
> > UTC (rev 61597) +++ trunk/BINDINGS/cxx/ecorexx/src/Timer.cpp
> > 2011-07-22 22:39:05 UTC (rev 61598) @@ -9,60 +9,67 @@
> >
> > namespace Ecorexx {
> >
> > -Timer::Timer( double seconds, bool singleshot )
> > - :_ss( singleshot )
> > +Timer::Timer (double seconds, sigc::slot task, bool loop) :
> > + mETimer (NULL),
> > + mTask (task)
> > {
> > - Dout( dc::notice, "Timer::Timer() - current frequency is "
> > << seconds );
> > - _et = ecore_timer_add( seconds, &Timer::__dispatcher, this );
> > -
> > - // TODO: find out why to use this function and the difference
> > between ecore_time_get() and ecore_loop_time_get()
> > - //ecore_timer_loop_add (double in, int (*func) (void *data),
> > const void *data);
> > + if (!loop)
> > + {
> > + mETimer = ecore_timer_add (seconds, Timer::dispatcherFunc, this);
> > + }
> > + else
> > + {
> > + mETimer = ecore_timer_loop_add (seconds, Timer::dispatcherFunc,
> > this);
> > + }
> > }
> >
> > +Timer *Timer::factory (double seconds, sigc::slot task, bool loop)
> > +{
> > + return new Timer (seconds, task, loop);
> > +}
> > +
> > Timer::~Timer()
> > {
> > - ecore_timer_del( _et );
> > }
> >
> > -/*Timer* Timer::singleShot( double seconds, const Timer::Slot&
> > slot ) +void Timer::destroy ()
> > {
> > - Timer* ecoretimer = new Timer( seconds, true );
> > - ecoretimer->timeout.connect( slot );
> > -}*/
> > + assert (ecore_timer_del (mETimer));
> >
> > -void Timer::del ()
> > -{
> > - assert (ecore_timer_del (_et));
> > + // !!!ATTENTION!!!
> > + // suicide for a C++ object is dangerous, but allowed
> > + // the simple rule is that no member functions or member
> > variables are allowed to access after this point!
> > + delete (this);
> > }
> >
> > void Timer::setInterval (double seconds)
> > {
> > - ecore_timer_interval_set (_et, seconds);
> > + ecore_timer_interval_set (mETimer, seconds);
> > }
> >
> > double Timer::getInterval ()
> > {
> > - return ecore_timer_interval_get (_et);
> > + return ecore_timer_interval_get (mETimer);
> > }
> >
> > void Timer::freeze ()
> > {
> > - ecore_timer_freeze (_et);
> > + ecore_timer_freeze (mETimer);
> > }
> >
> > void Timer::thaw ()
> > {
> > - ecore_timer_thaw (_et);
> > + ecore_timer_thaw (mETimer);
> > }
> >
> > void Timer::delay (double add)
> > {
> > - ecore_timer_delay (_et, add);
> > + ecore_timer_delay (mETimer, add);
> > }
> >
> > double Timer::getPending ()
> > {
> > - return ecore_timer_pending_get (_et);
> > + return ecore_timer_pending_get (mETimer);
> > }
> >
> > double Timer::getPrecision ()
> > @@ -75,21 +82,27 @@
> > ecore_timer_precision_set (precision);
> > }
> >
> > -/*void Timer::tick()
> > +void Timer::dump ()
> > {
> > - Dout( dc::notice, "Timer[ " << this << " ]::tick()" );
> > -}*/
> > + ecore_timer_dump ();
> > +}
> >
> > -Eina_Bool Timer::__dispatcher( void* data )
> > +Eina_Bool Timer::dispatcherFunc (void *data)
> > {
> > - Timer* object = reinterpret_cast( data );
> > - assert( object );
> > - object->timeout.emit( );
> > - //object->tick();
> > - /*bool singleshot = object->_ss;
> > - if ( singleshot ) delete object;
> > - return singleshot? 0:1;*/
> > - return ECORE_CALLBACK_RENEW;
> > + Timer* eTimer = static_cast ( data );
> > + assert (eTimer);
> > +
> > + bool ret = eTimer->mTask (*eTimer);
> > +
> > + if (!ret)
> > + {
> > + // do a suicide as the delete operator isn't public available
> > + // the reason is that the C design below is a suicide design :-(
> > + delete eTimer;
> > + return false;
> > + }
> > +
> > + return ret;
> > }
> >
> > } // end namespace Ecorexx
> >
> >
> > ------------------------------------------------------------------------------
> > 10 Tips for Better Web Security
> > Learn 10 ways to better secure your business today. Topics covered
> > include: Web security, SSL, hacker attacks & Denial of Service
> > (DoS), private keys, security Microsoft Exchange, secure Instant
> > Messaging, and much more.
> > http://www.accelacomm.com/jaw/sfnl/114/51426210/
> > _______________________________________________ enlightenment-svn
> > mailing list enlightenment-...@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
> >
> >
> ------------------------------------------------------------------------------
> Storage Efficiency Calculator
> This modeling tool is based on patent-pending intellectual property
> that has been used successfully in hundreds of IBM storage
> optimization engage- ments, worldwide. Store less, Store more with
> what you own, Move data to the right place. Try It Now!
> http://www.accelacomm.com/jaw/sfnl/114/51427378/
> _______________________________________________ enlightenment-devel
> mailing list enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
> ------------------------------------------------------------------------------
> Storage Efficiency Calculator
> This modeling tool is based on patent-pending intellectual property
> that has been used successfully in hundreds of IBM storage
> optimization engage- ments, worldwide.  Store less, Store more with
> what you own, Move data to the right place. Try It Now!
> http://www.accelacomm.com/jaw/sfnl/114/51427378/
> _______________________________________________ enlightenment-devel
> mailing list enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel


-- 
Technical Blog <http://andreasvolz.wordpress.com/>

------------------------------------------------------------------------------
Storage Efficiency Calculator
This modeling tool is based on patent-pending intellectual property that
has been used successfully in hundreds of IBM storage optimization engage-
ments, worldwide.  Store less, Store more with what you own, Move data to 
the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to