27 #include "utilities.h" 29 #if (defined __GNUC__) 30 #define BTL_ALWAYS_INLINE __attribute__((always_inline)) inline 32 #define BTL_ALWAYS_INLINE inline 35 #if (defined __GNUC__) 36 #define BTL_DONT_INLINE __attribute__((noinline)) 38 #define BTL_DONT_INLINE 41 #if (defined __GNUC__) 42 #define BTL_ASM_COMMENT(X) asm("#" X) 44 #define BTL_ASM_COMMENT(X) 48 #include "xmmintrin.h" 50 #define BTL_DISABLE_SSE_EXCEPTIONS() { _mm_setcsr(_mm_getcsr() | 0x8040); } 52 #define BTL_DISABLE_SSE_EXCEPTIONS() 65 operator const char* ()
const {
return c_str(); }
69 int lspaces, rspaces,
len = length(),
i;
70 lspaces = rspaces = 0;
73 for (
i=0;
i<len && (at(
i)==
' '||at(
i)==
'\t'||at(
i)==
'\r'||at(
i)==
'\n'); ++lspaces,++
i);
75 if (
right && lspaces < len )
76 for(
i=len-1;
i>=0 && (at(
i)==
' '||at(
i)==
'\t'||at(
i)==
'\r'||at(
i)==
'\n'); rspaces++,
i--);
78 *
this = substr(lspaces, len-lspaces-rspaces);
83 std::vector<BtlString>
ret;
84 unsigned int numSplits = 0;
89 pos = find_first_of(delims, start);
96 ret.push_back( substr(start) );
99 ret.push_back( substr(start, pos - start) );
104 }
while (pos != npos);
110 if(str.size()>this->
size())
112 return this->substr(this->
size()-str.size(),str.size()) == str;
116 return this->find(str)<this->
size();
120 if(str.size()>this->
size())
122 return this->substr(0,str.size()) == str;
152 std::vector<BtlString> elements = this->
split(
"/\\");
154 filename = elements.back();
156 if (this->at(0)==
'/')
158 for (
unsigned int i=0 ;
i<elements.size() ; ++
i)
159 path += elements[
i] +
"/";
167 : overwriteResults(false), checkResults(true), realclock(false), tries(
DEFAULT_NB_TRIES)
170 _config = getenv (
"BTL_CONFIG");
173 std::vector<BtlString> config =
BtlString(_config).split(
" \t\n");
174 for (
unsigned int i = 0;
i<config.size();
i++)
178 if (
i+1==config.size())
180 std::cerr <<
"error processing option: " << config[
i] <<
"\n";
183 Instance.m_selectedActionNames = config[
i+1].split(
":");
189 if (
i+1==config.size())
191 std::cerr <<
"error processing option: " << config[
i] <<
"\n";
194 Instance.tries = atoi(config[
i+1].
c_str());
200 Instance.overwriteResults =
true;
204 Instance.checkResults =
false;
208 Instance.realclock =
true;
218 if (Instance.m_selectedActionNames.empty())
222 for (
unsigned int i=0;
i<Instance.m_selectedActionNames.size(); ++
i)
223 if (name.
contains(Instance.m_selectedActionNames[
i]))
240 BtlConfig BtlConfig::Instance bool contains(const BtlString &str) const
BtlString(const std::string &str)
void decomposePathAndFile(BtlString &path, BtlString &filename) const
bool endsWith(const BtlString &str) const
std::vector< BtlString > split(const BtlString &delims="\ ") const
bool beginsWith(const BtlString &str) const
const char * c_str(Args &&...args)
void trim(bool left=true, bool right=true)
EIGEN_DONT_INLINE void transform(const Transformation &t, Data &data)
static BTL_DONT_INLINE bool skipAction(const std::string &_name)
BtlString(const char *str)
static EIGEN_DEPRECATED const end_t end
std::vector< BtlString > m_selectedActionNames
bool isEquiv(const BtlString &str) const
BtlString toLowerCase(void)
BtlString(const BtlString &str)
#define BTL_DISABLE_SSE_EXCEPTIONS()
size_t len(handle h)
Get the length of a Python object.
static BtlConfig Instance
BtlString toUpperCase(void)