00001 /* 00002 * Copyright (c) 2009 Yahoo! Inc. All rights reserved. The copyrights 00003 * embodied in the content of this file are licensed under the BSD 00004 * (revised) open source license. 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * Written (W) 2011 Shashwat Lal Das 00012 * Adaptation of Vowpal Wabbit v5.1. 00013 * Copyright (C) 2011 Berlin Institute of Technology and Max-Planck-Society. 00014 */ 00015 00016 #ifndef _VW_CACHEWRITE_H__ 00017 #define _VW_CACHEWRITE_H__ 00018 00019 #include <shogun/base/SGObject.h> 00020 #include <shogun/lib/common.h> 00021 #include <shogun/io/IOBuffer.h> 00022 #include <shogun/classifier/vw/vw_common.h> 00023 #include <shogun/classifier/vw/cache/VwCacheReader.h> 00024 00025 namespace shogun 00026 { 00027 00035 class CVwCacheWriter: public CSGObject 00036 { 00037 public: 00038 00042 CVwCacheWriter(); 00043 00050 CVwCacheWriter(char * fname, CVwEnvironment* env_to_use); 00051 00058 CVwCacheWriter(int32_t f, CVwEnvironment* env_to_use); 00059 00063 virtual ~CVwCacheWriter(); 00064 00070 virtual void set_file(int32_t f); 00071 00077 virtual void set_env(CVwEnvironment* env_to_use); 00078 00084 virtual CVwEnvironment* get_env(); 00085 00091 virtual void cache_example(VwExample* &ex) = 0; 00092 00093 protected: 00094 00096 int32_t fd; 00097 00099 CVwEnvironment* env; 00100 }; 00101 00102 } 00103 #endif