Main Page   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

STLhelp.h

Go to the documentation of this file.
00001 /*
00002  * STLhelp.h
00003  *
00004  * Copyright 2003, MobileSpear Inc. (www.mobilespear.com). All rights reserved.
00005  * Copyright 2003, David Resnick. All rights reserved.
00006  *
00007  * See the file doc\license.txt for the terms of usage and distribution.
00008  */
00009 
00010 #ifndef _BOGOTEL_STLHELP_H
00011 #define _BOGOTEL_STLHELP_H
00012 
00013 namespace bogotel {
00014 
00015     // Class that enables passing parameter to thread function.
00016     class thread_adapter
00017     {
00018     public:
00019         thread_adapter(void (*func)(void*), void* param) : _func(func), _param(param) { }
00020         void operator()() const { _func(_param); }
00021     private:
00022         void (*_func)(void*);
00023         void* _param;
00024     };
00025 
00026     template<typename CONT>
00027     class ContainerNotEmpty {
00028 
00029     public:
00030         ContainerNotEmpty(CONT& cont) :
00031           _cont(cont)
00032         {}
00033 
00034         bool operator() ()
00035         {
00036             return ! _cont.empty();
00037         }
00038 
00039     private:
00040         CONT& _cont;
00041     };
00042 
00043     struct cond_predicate
00044     {
00045         cond_predicate(bool& var, bool val) : _var(var), _val(val) { }
00046 
00047         bool operator()() { return _var == _val; }
00048 
00049         bool& _var;
00050         bool _val;
00051     };
00052 
00053 }
00054 
00055 #endif // ! _BOGOTEL_STLHELP_H
00056 

Generated on Tue Aug 12 12:41:30 2003 for bogotel by doxygen 1.3. Hosted by SourceForge.net Logo