Cambridge SMT System
global_funcs.hpp File Reference

General functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ucam::util::HashEqVec< VecT >
 
class  ucam::util::HashFVec< VecT >
 

Namespaces

 ucam
 
 ucam::util
 

Typedefs

typedef HashEqVec< std::basic_string< unsigned > > ucam::util::hasheqvecuint
 
typedef HashFVec< std::basic_string< unsigned > > ucam::util::hashfvecuint
 
typedef HashEqVec< std::vector< long long > > ucam::util::hasheqvecint64
 
typedef HashFVec< std::vector< long long > > ucam::util::hashfvecint64
 

Functions

template<typename T >
std::string ucam::util::toString (const T &x, uint pr=2)
 Converts an arbitrary type to string Converts to string integers, floats, doubles Quits execution if conversion has failed. More...
 
template<typename T >
void ucam::util::toString (const T &x, std::string &ss, uint pr=2)
 Converts an arbitrary type to string Converts to string integers, floats, doubles Quits execution if conversion has failed. More...
 
template<typename T >
ucam::util::toNumber (const std::string &x)
 Converts a string to an arbitrary number Converts strings to a number. Quits execution if conversion has failed. More...
 
bool ucam::util::exists (const std::string &source, const std::string &needle)
 Convenience function to find out whether a needle exists in a text. More...
 
void ucam::util::find_and_replace (std::string &haystack, const std::string &needle, const std::string &replace)
 
bool ucam::util::ends_with (std::string const &haystack, std::string const &needle)
 
uint ucam::util::count_needles (const std::string &haystack, const char needle, std::size_t start, std::size_t end)
 Convenience function that counts the number of times a needle appears. More...
 
void ucam::util::trim_spaces (const std::string &input, std::string *output)
 Trims spaces at the edges (no spaces) and also between words (only one space) More...
 
void ucam::util::trim_trailing_zeros (std::string &snumber)
 
bool ucam::util::validate_source_sentence (const std::string &s)
 Checks whether the sentence is in format ^\d+( \d+)*$. More...
 
std::string ucam::util::getTimestamp (void)
 Generates time stamp. More...
 
bool ucam::util::DirName (std::string &dirname, const std::string &filename)
 
bool ucam::util::fileExists (const std::string &fileName)
 
float ucam::util::dotproduct (std::vector< float > &v1, std::vector< float > &v2)
 Implements dot product. More...
 
template<typename T , template< typename ElemT, typename AllocT=std::allocator< ElemT > > class Container>
std::ostream & ucam::util::operator<< (std::ostream &o, Container< T > const &container)
 
template<typename T , template< typename ElemT, typename AllocT=std::allocator< ElemT > > class Container>
std::string ucam::util::printout (Container< T > const &container)
 
std::ostream & ucam::util::operator<< (std::ostream &o, std::basic_string< unsigned > const &container)
 

Detailed Description

General functions.

Date
8-8-2012
Author
Gonzalo Iglesias

General convenience functions and classes

Definition in file global_funcs.hpp.