Skip to content

Commit

Permalink
Improvements in StreamingStringFeatures and reindentation of ParseBuf…
Browse files Browse the repository at this point in the history
…fer.
  • Loading branch information
frx committed Aug 26, 2011
1 parent 4a4d755 commit 66c4ffd
Show file tree
Hide file tree
Showing 3 changed files with 304 additions and 288 deletions.
12 changes: 10 additions & 2 deletions src/shogun/features/StreamingStringFeatures.h
Expand Up @@ -69,7 +69,7 @@ template <class T> class CStreamingStringFeatures : public CStreamingFeatures
~CStreamingStringFeatures()
{
parser.end_parser();
SG_FREE(current_string);
SG_UNREF(alphabet);
}

/**
Expand Down Expand Up @@ -102,6 +102,9 @@ template <class T> class CStreamingStringFeatures : public CStreamingFeatures
*/
void use_alphabet(EAlphabet alpha)
{
if (alphabet)
SG_UNREF(alphabet);

alphabet=new CAlphabet(alpha);
SG_REF(alphabet);
num_symbols=alphabet->get_num_symbols();
Expand All @@ -115,6 +118,9 @@ template <class T> class CStreamingStringFeatures : public CStreamingFeatures
*/
void use_alphabet(CAlphabet* alpha)
{
if (alphabet)
SG_UNREF(alphabet);

alphabet=new CAlphabet(alpha);
SG_REF(alphabet);
num_symbols=alphabet->get_num_symbols();
Expand Down Expand Up @@ -375,7 +381,7 @@ void CStreamingStringFeatures<T>::init()
{
working_file=NULL;
alphabet=new CAlphabet();

current_string=NULL;
current_length=-1;
current_sgstring.string=current_string;
Expand All @@ -391,6 +397,8 @@ void CStreamingStringFeatures<T>::init(CStreamingFile* file,
has_labels=is_labelled;
working_file=file;
parser.init(file, is_labelled, size);
parser.set_free_vector_after_release(false);
parser.set_free_vectors_on_destruct(false);
}

template <class T>
Expand Down

0 comments on commit 66c4ffd

Please sign in to comment.