Synch_Options.cpp

Go to the documentation of this file.
00001 #include "ace/Synch_Options.h"
00002 
00003 #include "ace/Global_Macros.h"
00004 #include "ace/config-all.h"
00005 
00006 ACE_RCSID (ace,
00007            Synch_Options,
00008            "Synch_Options.cpp,v 4.13 2005/10/28 16:14:56 ossama Exp")
00009 
00010 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 ACE_ALLOC_HOOK_DEFINE (ACE_Synch_Options)
00013 
00014 void
00015 ACE_Synch_Options::dump (void) const
00016 {
00017 #if defined (ACE_HAS_DUMP)
00018   ACE_TRACE ("ACE_Synch_Options::dump");
00019 #endif /* ACE_HAS_DUMP */
00020 }
00021 
00022 // Static initialization.
00023 // Note: these three objects require static construction and destruction.
00024 
00025 /* static */
00026 ACE_Synch_Options ACE_Synch_Options::defaults;
00027 
00028 /* static */
00029 ACE_Synch_Options ACE_Synch_Options::synch;
00030 
00031 /* static */
00032 ACE_Synch_Options ACE_Synch_Options::asynch (ACE_Synch_Options::USE_REACTOR);
00033 
00034 ACE_Synch_Options::ACE_Synch_Options (unsigned long options,
00035                                       const ACE_Time_Value &timeout,
00036                                       const void *arg)
00037 {
00038   // ACE_TRACE ("ACE_Synch_Options::ACE_Synch_Options");
00039   this->set (options, timeout, arg);
00040 }
00041 
00042 void
00043 ACE_Synch_Options::set (unsigned long options,
00044                         const ACE_Time_Value &timeout,
00045                         const void *arg)
00046 {
00047   // ACE_TRACE ("ACE_Synch_Options::set");
00048   this->options_ = options;
00049   this->timeout_ = (ACE_Time_Value &) timeout;
00050 
00051   // Whoa, possible dependence on static initialization here.  This
00052   // function is called during initialization of the statics above.
00053   // But, ACE_Time_Value::zero is a static object.  Very fortunately,
00054   // its bits have a value of 0.
00055   if (this->timeout_ != ACE_Time_Value::zero)
00056     ACE_SET_BITS (this->options_, ACE_Synch_Options::USE_TIMEOUT);
00057 
00058   this->arg_ = arg;
00059 }
00060 
00061 int
00062 ACE_Synch_Options::operator[] (unsigned long option) const
00063 {
00064   ACE_TRACE ("ACE_Synch_Options::operator[]");
00065   return (this->options_ & option) != 0;
00066 }
00067 
00068 void
00069 ACE_Synch_Options::operator= (unsigned long option)
00070 {
00071   ACE_TRACE ("ACE_Synch_Options::operator=");
00072   this->options_ |= option;
00073 }
00074 
00075 const ACE_Time_Value &
00076 ACE_Synch_Options::timeout (void) const
00077 {
00078   ACE_TRACE ("ACE_Synch_Options::timeout");
00079   return this->timeout_;
00080 }
00081 
00082 void
00083 ACE_Synch_Options::timeout (const ACE_Time_Value &tv)
00084 {
00085   ACE_TRACE ("ACE_Synch_Options::timeout");
00086   this->timeout_ = tv;
00087 }
00088 
00089 const ACE_Time_Value *
00090 ACE_Synch_Options::time_value (void) const
00091 {
00092   ACE_TRACE ("ACE_Synch_Options::time_value");
00093   return (*this)[USE_TIMEOUT] ? &this->timeout_ : 0;
00094 }
00095 
00096 const void *
00097 ACE_Synch_Options::arg (void) const
00098 {
00099   ACE_TRACE ("ACE_Synch_Options::arg");
00100   return this->arg_;
00101 }
00102 
00103 void
00104 ACE_Synch_Options::arg (const void *a)
00105 {
00106   ACE_TRACE ("ACE_Synch_Options::arg");
00107   this->arg_ = a;
00108 }
00109 
00110 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 09:42:06 2006 for ACE by doxygen 1.3.6