Vector.h

Go to the documentation of this file.
00001 /*
00002  * $Id: Vector.h 562 2007-12-02 08:04:16Z mindstorm2600 $
00003  *
00004  * X-VR2 
00005  * 
00006  * Copyright (C) Juan V. Guerrero 2007
00007  * 
00008  * Juan V. Guerrero <mindstorm2600@users.sourceforge.net>
00009  * 
00010  * This program is free software, distributed under the terms of
00011  * the GNU General Public License Version 2. See the LICENSE file
00012  * at the top of the source tree.
00013  */
00014 #ifndef __XVR2_VECTOR_H__
00015 #define __XVR2_VECTOR_H__
00016 #include<xvr2/Mutex.h>
00017 #include<xvr2/String.h>
00018 #include<vector>
00019 
00020 namespace xvr2 {
00021 
00029         template<typename _Tp, typename _Alloc=std::allocator<_Tp> >
00030         class Vector : public xvr2::Object, public std::vector<_Tp, _Alloc> {
00031                 protected:
00032                         Mutex mv;
00033                 public:
00035                         template<typename _InputIterator> 
00036                         Vector (_InputIterator __first, 
00037                                                 _InputIterator __last, 
00038                                                 const _Alloc &__a = _Alloc()
00039                                         ) : std::vector<_InputIterator>(__first, __last, __a){ }
00041                         Vector (const Vector &__x) : std::vector<_Tp, _Alloc>(__x){ }
00043                         Vector (size_t __n,     const _Tp &__value = _Tp(), 
00044                                         const _Alloc &__a = _Alloc()
00045                                         ) : 
00046                                         std::vector<_Tp, _Alloc>(__n, __value, __a){ }
00048                         Vector (const _Alloc &__a = _Alloc()) : 
00049                                         std::vector<_Tp, _Alloc>(__a){ }
00050                         
00052                         std::string toString(){
00053                                 std::string ret;
00054                                 ret = "{ ";
00055                                 /*for(size_t i = 0; i < this->size(); i++){
00056                                         String item;
00057                                         item = this->at(i);
00058                                         if(i > 0){
00059                                                 ret.append(",");
00060                                         }
00061                                         ret.append(item);
00062                                 }*/
00063                                 ret.append(" }");
00064                                 return std::string(ret);
00065                         }
00073                         void lock(){
00074                                 mv.lock();
00075                         }
00079                         void unlock(){
00080                                 mv.unlock();
00081                         }
00082         };
00083         
00084 }
00085 
00086 #endif

Generated on Fri Jun 20 22:55:47 2008 for X-VR2 SDK by  doxygen 1.5.5