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 * Copyright (C) 2010 Berlin Institute of Technology 00010 * Copyright (C) 2012 Soeren Sonnenburg 00011 */ 00012 #ifndef __SGSTRINGLIST_H__ 00013 #define __SGSTRINGLIST_H__ 00014 00015 #include <shogun/lib/config.h> 00016 #include <shogun/lib/common.h> 00017 #include <shogun/lib/DataType.h> 00018 #include <shogun/lib/SGReferencedData.h> 00019 #include <shogun/lib/SGString.h> 00020 00021 namespace shogun 00022 { 00023 00025 template <class T> class SGStringList : public SGReferencedData 00026 { 00027 public: 00029 SGStringList(); 00030 00032 SGStringList(SGString<T>* s, index_t num_s, index_t max_length, 00033 bool ref_counting=true); 00034 00036 SGStringList(index_t num_s, index_t max_length, bool ref_counting=true); 00037 00039 SGStringList(const SGStringList &orig); 00040 00042 virtual ~SGStringList(); 00043 00049 inline SGStringList<T> get() 00050 { 00051 return *this; 00052 } 00053 00058 void load(CFile* loader); 00059 00064 void save(CFile* saver); 00065 00066 00067 protected: 00068 00070 virtual void copy_data(const SGReferencedData &orig); 00071 00073 virtual void init_data(); 00074 00076 void free_data(); 00077 00078 public: 00080 index_t num_strings; 00081 00083 index_t max_string_length; 00084 00086 SGString<T>* strings; 00087 }; 00088 } 00089 #endif // __SGSTRINGLIST_H__