SHOGUN
v3.2.0
|
00001 /* 00002 * This program is free software; you can redistribute it and/or modify 00003 * it under the terms of the GNU General Public License as published by 00004 * the Free Software Foundation; either version 3 of the License, or 00005 * (at your option) any later version. 00006 * 00007 * Written (W) 2012 Fernando José Iglesias García 00008 * Written (W) 2010,2012 Soeren Sonnenburg 00009 * Written (W) 2012 Jacob Walker 00010 * Copyright (C) 2010 Berlin Institute of Technology 00011 * Copyright (C) 2012 Soeren Sonnenburg 00012 */ 00013 #ifndef __SGSTRING_H__ 00014 #define __SGSTRING_H__ 00015 00016 #include <shogun/lib/config.h> 00017 #include <shogun/lib/DataType.h> 00018 00019 namespace shogun 00020 { 00021 00022 template<class T> class SGVector; 00023 class CFile; 00024 00026 template<class T> class SGString 00027 { 00028 public: 00030 SGString(); 00031 00033 SGString(T* s, index_t l, bool free_s=false); 00034 00036 SGString(SGVector<T> v); 00037 00039 SGString(index_t len, bool free_s=false); 00040 00042 SGString(const SGString &orig); 00043 00045 bool operator==(const SGString & other) const; 00046 00048 void free_string(); 00049 00051 void destroy_string(); 00052 00058 inline SGString<T> get() 00059 { 00060 return *this; 00061 } 00062 00067 void load(CFile* loader); 00068 00073 void save(CFile* saver); 00074 00075 public: 00077 T* string; 00079 index_t slen; 00081 bool do_free; 00082 }; 00083 } 00084 #endif // __SGSTRING_H__