Open the file and emit a row with the names of all enabled keys.
| 165 | |
| 166 | /// Open the file and emit a row with the names of all enabled keys. |
| 167 | virtual bool init( const char* fileName ) |
| 168 | { |
| 169 | if( !mStream.open( fileName, Torque::FS::File::Write ) ) |
| 170 | { |
| 171 | Con::errorf( "CSVSamplerBackend::init -- could not open '%s' for writing", fileName ); |
| 172 | return false; |
| 173 | } |
| 174 | |
| 175 | Con::printf( "CSVSamplerBackend::init -- writing samples to '%s'", fileName ); |
| 176 | |
| 177 | bool first = true; |
| 178 | for( U32 i = 0; i < gSampleKeys.size(); ++ i ) |
| 179 | { |
| 180 | SampleKey& key = gSampleKeys[ i ]; |
| 181 | if( key.mEnabled ) |
| 182 | { |
| 183 | if( !first ) |
| 184 | mStream.write( 1, "," ); |
| 185 | |
| 186 | mRecords.push_back( SampleRecord( i + 1 ) ); |
| 187 | mStream.write( dStrlen( key.mName ), key.mName ); |
| 188 | first = false; |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | newline(); |
| 193 | return true; |
| 194 | } |
| 195 | |
| 196 | virtual void beginFrame() |
| 197 | { |