diff options
Diffstat (limited to 'TAO/CIAO/tools/Config_Handlers/Utils/Functors.h')
-rw-r--r-- | TAO/CIAO/tools/Config_Handlers/Utils/Functors.h | 88 |
1 files changed, 17 insertions, 71 deletions
diff --git a/TAO/CIAO/tools/Config_Handlers/Utils/Functors.h b/TAO/CIAO/tools/Config_Handlers/Utils/Functors.h index 34702cd60d0..19f6a5c9ea4 100644 --- a/TAO/CIAO/tools/Config_Handlers/Utils/Functors.h +++ b/TAO/CIAO/tools/Config_Handlers/Utils/Functors.h @@ -17,80 +17,10 @@ namespace CIAO { namespace Config_Handlers { - template <typename Seq_Type, typename T> - class Sequence_Iterator : - public std::iterator <std::forward_iterator_tag, //iterator type - T, // Type pointed to by the iterator - CORBA::ULong> // Distance type - { - public: - Sequence_Iterator (void) - : pos_ (0), - seq_ (0) - { - } - - Sequence_Iterator (const Seq_Type &seq, CORBA::ULong pos = 0) - : pos_ (pos), - seq_ (&seq) - { - } - - Sequence_Iterator (const Sequence_Iterator &s) - { - *this = s; - } - - Sequence_Iterator& operator= (const Sequence_Iterator &s) - { - this->seq_ = s.seq_; - this->pos_ = s.pos_; - return *this; - } - - bool operator== (Sequence_Iterator &s) - { - return (this->seq_ == s.seq_) && (this->pos_ == s.pos_); - } - - bool operator!= (Sequence_Iterator &s) - { - return !(*this == s); - } - - T& operator* (void) - { - return (*seq_)[pos_]; - } - - T& operator-> (void) - { - return *(*this); - } - - // Prefix operator - Sequence_Iterator& operator++ () - { - ++pos_; - return *this; - } - - Sequence_Iterator& operator++ (int) - { - Sequence_Iterator ans (*this); - ++(*this); - return ans; - } - - private: - CORBA::ULong pos_; - Seq_Type *seq_; - }; - template <typename Source, typename Dest, typename Dest_Type, - void (*Func)(const Source &, Dest_Type &)> + void (&Func)(const Source &, Dest_Type &)> struct Sequence_Handler { Sequence_Handler (Dest &dest, CORBA::ULong pos = 0) @@ -109,6 +39,22 @@ namespace CIAO CORBA::ULong pos_; }; + /* + * This is a workaround for a GCC bug that for some reason causes + * functions that appear ONLY in a Sequence_Handler typedef to not + * be present in the compiled object file. + * This bug was first observed in GCC 4.02. + * + * W: The function we want to be defined + * X: First argument to the function + * Y: Second argument to the function + */ +#define SEQ_HAND_GCC_BUG_WORKAROUND(W, X, Y) \ + while(0) { \ + W (*X, Y[0]); \ + } + + template <typename Dest, typename Dest_Type> struct String_Seq_Handler { |