Fleet  0.0.9
Inference in the LOT
Macros | Functions | Variables
IO.h File Reference
#include <thread>
#include <mutex>
#include <iostream>
#include <fstream>
#include <string>
#include "OrderedLock.h"
#include "Strings.h"
#include "Dependencies/CL11.hpp"
Include dependency graph for IO.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define TAB   <<"\t"<<
 
#define NL   <<"\n"<<
 
#define ENDL   <<std::endl;
 
#define ENDLL   <<"\n"<<std::endl;
 
#define CERR   std::cerr<<
 
#define COUT   std::cout<<
 
#define COUTT   std::cout<<"\t"<<
 
#define COUTTT   std::cout<<"\t\t"<<
 

Functions

template<typename FIRST , typename... ARGS>
void OUTPUTN (std::ostream &o, FIRST f, ARGS... args)
 This assumes o has been appropriately locked. More...
 
template<typename FIRST , typename... ARGS>
void print (FIRST f, ARGS... args)
 Lock output_lcok and print to std:cout. More...
 
template<typename FIRST , typename... ARGS>
void ERRN (FIRST f, ARGS... args)
 Lock err_lock and print to std:cerr. More...
 
template<typename FIRST , typename... ARGS>
void DEBUG (FIRST f, ARGS... args)
 Print to std:ccout with debugging info. More...
 
template<typename T >
void save (std::string filename, T &hypotheses)
 Simple saving of a vector of hypotheses. More...
 
template<typename HYP >
std::vector< HYP > load (std::string filename)
 Simple loading for a vector of hypotheses. More...
 
std::string gulp (std::string filename)
 Read this entire file as a string Skipping comment # lines. More...
 
template<size_t N>
std::vector< std::array< std::string, N > > read_csv (const std::string path, bool skipheader, const char delimiter='\t')
 Load data – divides in columns at the delimiter. NOTE: we are required to say whether we skip a header (first line) or not. Checks tha tthere are exactly N on each line. So we can use like: for(auto [b1, b2, b3, b4, c] : read_csv<5>(FleetArgs::input_path, true)) { .... }. More...
 

Variables

const std::string OUTPUT_SEP = "\t"
 
OrderedLock output_lock
 
OrderedLock err_lock
 

Macro Definition Documentation

◆ CERR

#define CERR   std::cerr<<

◆ COUT

#define COUT   std::cout<<

◆ COUTT

#define COUTT   std::cout<<"\t"<<

◆ COUTTT

#define COUTTT   std::cout<<"\t\t"<<

◆ ENDL

#define ENDL   <<std::endl;

◆ ENDLL

#define ENDLL   <<"\n"<<std::endl;

◆ NL

#define NL   <<"\n"<<

◆ TAB

#define TAB   <<"\t"<<

Function Documentation

◆ DEBUG()

template<typename FIRST , typename... ARGS>
void DEBUG ( FIRST  f,
ARGS...  args 
)

Print to std:ccout with debugging info.

Parameters
f

◆ ERRN()

template<typename FIRST , typename... ARGS>
void ERRN ( FIRST  f,
ARGS...  args 
)

Lock err_lock and print to std:cerr.

Parameters
f

◆ gulp()

std::string gulp ( std::string  filename)

Read this entire file as a string Skipping comment # lines.

Parameters
filename
Returns

◆ load()

template<typename HYP >
std::vector<HYP> load ( std::string  filename)

Simple loading for a vector of hypotheses.

Parameters
filename
g
Returns

◆ OUTPUTN()

template<typename FIRST , typename... ARGS>
void OUTPUTN ( std::ostream &  o,
FIRST  f,
ARGS...  args 
)

This assumes o has been appropriately locked.

Parameters
o
f

◆ print()

template<typename FIRST , typename... ARGS>
void print ( FIRST  f,
ARGS...  args 
)

Lock output_lcok and print to std:cout.

Parameters
f

◆ read_csv()

template<size_t N>
std::vector< std::vector< std::string > > read_csv ( const std::string  path,
bool  skipheader,
const char  delimiter = '\t' 
)

Load data – divides in columns at the delimiter. NOTE: we are required to say whether we skip a header (first line) or not. Checks tha tthere are exactly N on each line. So we can use like: for(auto [b1, b2, b3, b4, c] : read_csv<5>(FleetArgs::input_path, true)) { .... }.

Parameters
filename
g
Returns

◆ save()

template<typename T >
void save ( std::string  filename,
T &  hypotheses 
)

Simple saving of a vector of hypotheses.

Parameters
filename
hypotheses

Variable Documentation

◆ err_lock

OrderedLock err_lock

◆ output_lock

OrderedLock output_lock

◆ OUTPUT_SEP

const std::string OUTPUT_SEP = "\t"