Skip to content

Commit

Permalink
Wrap kmc_tools to a namespace to fix linking conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jnalanko committed Sep 17, 2023
1 parent 034bca0 commit ae56588
Show file tree
Hide file tree
Showing 47 changed files with 149 additions and 10 deletions.
5 changes: 5 additions & 0 deletions kmc_tools/bundle.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@

#ifndef _BUNDLE_H
#define _BUNDLE_H

#include "config.h"
#include "defs.h"
#include "kmer.h"

namespace kmc_tools{

//************************************************************************************************************
// CBundle and CInput are CORE classes of this application. CInputs are nodes of binary tree which
// represent operations. Leafs of this tree are kmc database (1 or 2) inputs (sets of k-mers).
Expand Down Expand Up @@ -332,6 +335,8 @@ template<unsigned SIZE> inline bool CBundle<SIZE>::Finished()
return false;
}

} // namespace

#endif


Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/check_kmer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "../kmc_api/mmer.h"
#include <string>

namespace kmc_tools{

template<unsigned SIZE>
class CKmerCheck
{
Expand Down Expand Up @@ -402,4 +404,6 @@ class CKmerCheckKFF
}
};

} // namespace

#endif
4 changes: 4 additions & 0 deletions kmc_tools/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "kmer_file_header.h"
#include "percent_progress.h"

namespace kmc_tools{

enum class CounterOpType { MIN, MAX, SUM, DIFF, FROM_DB1, FROM_DB2, NONE };
enum class OutputType { KMC1, KFF1 };
enum class KmerDBOpenMode { sequential, sorted, counters_only };
Expand Down Expand Up @@ -497,6 +499,8 @@ class CUsageDisplayerFactory
}
};

} // namespace

#endif


Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/db_reader_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "kmc2_db_reader.h"
#include "kff_db_reader.h"

namespace kmc_tools{

template<unsigned SIZE>
CInput<SIZE>* db_reader_factory(const CKmerFileHeader& header, const CInputDesc& input_desc, KmerDBOpenMode kmer_db_open_mode)
{
Expand All @@ -26,6 +28,8 @@ CInput<SIZE>* db_reader_factory(const CKmerFileHeader& header, const CInputDesc&
}
}

} // namespace

#endif // !_DB_READER_FACTORY_H


Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/db_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Date : 2023-03-10
#define _DB_WRITER_H
#include "bundle.h"

namespace kmc_tools{

template<unsigned SIZE>
class CDbWriter
{
Expand All @@ -23,4 +25,6 @@ class CDbWriter
virtual void MultiOptputFinish() = 0;
virtual ~CDbWriter() = default;
};

} // namespace
#endif
4 changes: 3 additions & 1 deletion kmc_tools/db_writer_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "kmc1_db_writer.h"
#include "kff_db_writer.h"

namespace kmc_tools{

template<unsigned SIZE>
CDbWriter<SIZE>* db_writer_factory(COutputDesc& output_desc, CBundle<SIZE>* bundle = nullptr)
{
Expand All @@ -21,5 +23,5 @@ CDbWriter<SIZE>* db_writer_factory(COutputDesc& output_desc, CBundle<SIZE>* bund
}
}


} // namespace
#endif
4 changes: 4 additions & 0 deletions kmc_tools/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include <cinttypes>

namespace kmc_tools{

using uint32 = uint32_t;
using uint64 = uint64_t;
using int32 = int32_t;
Expand Down Expand Up @@ -108,6 +110,8 @@ using uchar = unsigned char;
val = (val<<24) | ((val<<8) & 0x00ff0000) | ((val >> 8) & 0x0000ff00) | (val >> 24);
#endif

} // namespace

#endif


Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/develop.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "defs.h"
#include "timer.h"

namespace kmc_tools{

#ifdef ENABLE_LOGGER


Expand Down Expand Up @@ -62,5 +64,7 @@ class CLoger
};
#endif

} // namespace


#endif
4 changes: 4 additions & 0 deletions kmc_tools/dump_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "config.h"
#include <fstream>

namespace kmc_tools{


//wrapper to simplify interface

Expand Down Expand Up @@ -249,4 +251,6 @@ class CDumpWriterForTransform : public CDumpWriterBase<SIZE>
}
};

} // namespace

#endif
4 changes: 4 additions & 0 deletions kmc_tools/expression_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include <memory>
#include "db_reader_factory.h"

namespace kmc_tools{

//************************************************************************************************************
// CExpressionNode - Base abstract class representing expression node. In first stage of algorithm from
// user input there is created binary tree. Node type represents operation. This tree is only for generating
Expand Down Expand Up @@ -215,6 +217,8 @@ template<unsigned SIZE> class CInputNode : public CExpressionNode<SIZE>
#endif
};

} // namespace


#endif

Expand Down
1 change: 1 addition & 0 deletions kmc_tools/fastq_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Date : 2023-03-10
#include "fastq_filter.h"
#include <numeric>

using namespace kmc_tools;
using namespace std;

/*****************************************************************************************************************************/
Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/fastq_filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Date : 2023-03-10

#include "kff_random_access.h"

namespace kmc_tools{

//************************************************************************************************************
// CFastqFilter - filter of reads
//************************************************************************************************************
Expand Down Expand Up @@ -100,6 +102,8 @@ class CWFastqFilter
void operator()();
};

} // namespace


#endif

Expand Down
2 changes: 2 additions & 0 deletions kmc_tools/fastq_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include "defs.h"
#include "fastq_reader.h"

using namespace kmc_tools;

//************************************************************************************************************
// CFastqReader - reader class
//************************************************************************************************************
Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/fastq_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

#include "../3rd_party/cloudflare/zlib.h"

namespace kmc_tools{

using namespace std;


Expand Down Expand Up @@ -87,6 +89,8 @@ class CWFastqReaderKMCTools { // Jarno Alanko 12.5.2022: Appended KMCTools to na
void operator()();
};

} // namespace

#endif

// ***** EOF
3 changes: 3 additions & 0 deletions kmc_tools/fastq_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

#include "fastq_writer.h"
#include <iostream>

using namespace kmc_tools;

using namespace std;


Expand Down
4 changes: 4 additions & 0 deletions kmc_tools/fastq_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "queues.h"
#include <string>

namespace kmc_tools{

//************************************************************************************************************
// CFastqWriter - Writer of fastq/fasta file
//************************************************************************************************************
Expand All @@ -40,5 +42,7 @@ class CWFastqWriter
void operator()();
};

} // namespace

#endif

3 changes: 3 additions & 0 deletions kmc_tools/histogram_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <vector>
#include <fstream>

namespace kmc_tools{

class CHistogramWriterBase
{
Expand Down Expand Up @@ -106,4 +107,6 @@ class CHistogramWriterForTransform : public CHistogramWriterBase
}
};

} // namespace

#endif
4 changes: 4 additions & 0 deletions kmc_tools/kff_db_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#include <memory>
#include <algorithm>

namespace kmc_tools{

//TODO KFF: consider minimizers sections

//Forward declaration
Expand Down Expand Up @@ -1491,4 +1493,6 @@ class CKFFDbReaderSeq
}
};

} // namespace

#endif
3 changes: 3 additions & 0 deletions kmc_tools/kff_db_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Date : 2023-03-10
#include "../kmc_core/kff_writer.h"
#include "defs.h"

namespace kmc_tools{

template<unsigned SIZE> class CKFFDbWriter : public CDbWriter<SIZE>
{
Expand Down Expand Up @@ -148,4 +149,6 @@ template<unsigned SIZE> class CKFFDbWriter : public CDbWriter<SIZE>
}
};

} // namespace

#endif
2 changes: 2 additions & 0 deletions kmc_tools/kff_info_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <algorithm>
#include <cstring>

using namespace kmc_tools;

std::string CKFFInfoReader::ReadVarName()
{
std::string res;
Expand Down
3 changes: 3 additions & 0 deletions kmc_tools/kff_info_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>
#include <map>

namespace kmc_tools{

template<typename T>
void LoadBigEndian(const uint8_t* buff, T& data)
Expand Down Expand Up @@ -85,3 +86,5 @@ class CKFFInfoReader

~CKFFInfoReader();
};

} // namespace
4 changes: 4 additions & 0 deletions kmc_tools/kff_kmc2_reader_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Date : 2023-03-10
#include <mutex>
#include <thread>

namespace kmc_tools{

//************************************************************************************************************
// CParentSubthreadSynchronizer - Synchronize subthreads created by CMergerParent
//************************************************************************************************************
Expand Down Expand Up @@ -115,4 +117,6 @@ class CParentSubthreadDescQueue
}
};

} // namespace

#endif
4 changes: 4 additions & 0 deletions kmc_tools/kff_random_access.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "db_reader_factory.h"
#include "../kmc_api/kmc_file.h"

namespace kmc_tools{

class CKffAndKMCRandomAccess : protected CKMCFile
{
uint32_t suffix_bits;
Expand Down Expand Up @@ -168,6 +170,8 @@ class CKffAndKMCRandomAccess : protected CKMCFile
}
};

} // namespace

#endif //_KFF_RANDOM_ACCESS_H


4 changes: 3 additions & 1 deletion kmc_tools/kmc1_db_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Date : 2023-03-10
#include <thread>
#include <tuple>

namespace kmc_tools{

//I'm going to read a little after buffer, this will be always correctly ignored, but reading itself is illegal
//using 16 because 8 of Ckmer, and possibly 8 for counter
#define SUFFIX_BUFF_EXTRA_BYTES 16
Expand Down Expand Up @@ -716,7 +718,7 @@ template<unsigned SIZE> bool CKMC1DbReader<SIZE>::fill_bundle()
return false;
}


} // namespace
#endif

// ***** EOF
Loading

0 comments on commit ae56588

Please sign in to comment.