23 #include <sys/resource.h>
33 #define DEPRECATED(func) func __attribute__ ((deprecated))
34 #elif defined(_MSC_VER)
35 #define DEPRECATED(func) __declspec(deprecated) func
37 #define DEPRECATED(func) func
42 #define DEPRECATED_METHOD(comment) __attribute__ ((deprecated))
44 #define DEPRECATED_METHOD(comment)
48 #define Assert AssertCc
51 #define UnusedVariable(x) ((void) x);
71 class Strings :
public std::vector<casacore::String> {};
81 template <
typename Container>
84 const Container & container)
86 return container.find(key) != container.end();
89 template <
typename Container>
97 return std::find(c.begin(), c.end(),
e) != c.end();
100 template <
typename F,
typename S>
101 F &
first (std::pair<F,S> & pair) {
return pair.first;}
103 template <
typename F,
typename S>
104 const F &
first (
const std::pair<F,S> & pair) {
return pair.first;}
106 template <
typename F,
typename S>
110 const F &
operator() (
const std::pair<F,S> & p) {
return p.first; }
113 template <
typename Container,
typename Element>
122 va_start (vaList, sentinel);
124 Element
e = va_arg (vaList, Element);
126 insert_iterator<Container> i = inserter (container, container.begin());
128 while (
e != sentinel){
132 e = va_arg (vaList, Element);
140 template <
typename F,
typename S>
173 bool ignoreConsecutiveSplitters =
false);
175 template <
typename Itr>
186 for (; i !=
end; i++){
187 result += delimiter + * i;
194 template <
typename T>
198 return join (strings.begin(), strings.end(), delimiter);
201 template <
typename Itr,
typename F>
213 for (; i !=
end; i++){
214 result += delimiter + f (* i);
221 template <
typename K,
typename V>
225 std::vector<K> result;
227 std::transform (aMap.begin(), aMap.end(), back_inserter (result), firstFunctor<K,V>());
237 template <
typename F,
typename S>
238 F &
second (std::pair<F,S> & pair) {
return pair.second;}
240 template <
typename F,
typename S>
241 const F &
second (
const std::pair<F,S> & pair) {
return pair.second;}
243 template <
typename F,
typename S>
249 template <
typename F,
typename S>
252 template <
typename K,
typename V>
256 std::vector<K> result (aMap.size());
258 std::transform (aMap.begin(), aMap.end(), back_inserter (result), second<K,V>);
265 long round (
double d);
267 void sleepMs (
int milliseconds);
274 template <
typename It,
typename Obj>
282 for (It i = begin; i !=
end; i++){
283 result += d + wrapper + ((* i) .* func) () + wrapper;
406 gettimeofday (& tVal, NULL);
408 double elapsed = tVal.tv_sec + tVal.tv_usec * 1
e-6;
414 #if defined (RUSAGE_THREAD)
417 int failed =
getrusage (RUSAGE_THREAD, & usage);
433 return t.tv_sec + t.tv_usec * 1
e-6;
577 template <
typename F,
typename G>
578 class ComposedFunctor :
public std::unary_function <typename G::argument_type, typename F::result_type> {
584 typename F::result_type
operator() (
typename G::argument_type x) {
return f_p (
g_p (x)); }
592 template <
typename F,
typename G>
599 template <
typename D,
typename R>
612 template <
typename D,
typename R>
ThreadTimes(double elapsed, double cpu)
casacore::String formatAverage(const casacore::String &floatFormat="%6.1f", double scale=1000.0, const casacore::String &units="ms") const
FirstFunctor< F, S > firstFunctor()
std::vector< V > mapValues(const std::map< K, V > &aMap)
DeltaThreadTimes(double elapsed, double cpu)
F & second(std::pair< F, S > &pair)
IoStatistics operator+(const IoStatistics &) const
static double toSeconds(const struct timeval &t)
UnaryFunctor< D, R > unary(R(*f)(D))
void sleepMs(int milliseconds)
casacore::String containerToString(It begin, It end, casacore::String(Obj::*func)() const, const casacore::String &delimiter=",", const casacore::String &wrapper="")
S & operator()(std::pair< F, S > &p)
IoStatistics operator-(const IoStatistics &) const
ComposedFunctor(F f, G g)
bool isEnvDefined(const casacore::String &name)
int64_t getVmInBytes() const
bool contains(const typename Container::value_type &e, const Container &c)
casacore::String join(Itr begin, Itr end, const casacore::String &delimiter)
std::vector< casacore::String > split(const casacore::String &string, const casacore::String &splitter, bool ignoreConsecutiveSplitters=false)
double getRssInMB() const
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
F::result_type operator()(typename G::argument_type x)
const_iterator end() const
IoStatistics operator*(double factor) const
const_iterator begin() const
casacore::AipsError repackageAipsError(casacore::AipsError &error, const casacore::String &message, const casacore::String &file, int line, const casacore::String &func)
ComposedFunctor< F, G > compose(F f, G g)
SecondFunctor< F, S > secondFunctor()
const Char * c_str() const
Get char array.
DeltaThreadTimes(bool doStats)
static ThreadTimes getTime()
bool containsKey(const typename Container::key_type &key, const Container &container)
template <typename Element, typename Container> bool contains (const Element & e, const Container & c...
AipsErrorTrace(const casacore::String &msg, const casacore::String &filename, casacore::uInt lineNumber, Category c=GENERAL)
double getNWrites() const
Container fillContainer(Element sentinel,...)
void throwIf(bool condition, const casacore::String &message, const casacore::String &file, int line, const casacore::String &func=casacore::String())
casacore::String getTimestamp()
casacore::String report(float scale=.001, const casacore::String &scaleTag=casacore::String("K")) const
void toStdError(const casacore::String &m, const casacore::String &prefix="*E* ")
double getBytesWritten() const
int getrusage(int, struct rusage *)
casacore::String formatStats(const casacore::String &floatFormat="%6.1f", double scale=1000.0, const casacore::String &units="ms") const
void printBacktrace(std::ostream &os, const casacore::String &prefix="")
DeltaThreadTimes operator-(const ThreadTimes &tEarlier) const
F & first(std::pair< F, S > &pair)
void throwIfError(int errorCode, const casacore::String &prefix, const casacore::String &file, int line, const casacore::String &func=casacore::String())
F & operator()(std::pair< F, S > &p)
DeltaThreadTimes & operator+=(const DeltaThreadTimes &other)
T getEnv(const casacore::String &name, const T &defaultValue)
Base class for all Casacore library errors.
const Double e
e and functions thereof:
const Double c
Fundamental physical constants (SI units):
int64_t getRssInBytes() const
double getBytesRead() const
String: the storage and methods of handling collections of characters.
void defaultValue(CStokesVector &v)
IoStatistics operator/(const IoStatistics &) const
double elapsedAvg() const
casacore::String statFile_p
std::vector< K > mapKeys(const std::map< K, V > &aMap)
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
*casacore::String formatV(const casacore::String &formatString, va_list vaList)
DEPRECATED (casacore::String format (const char * formatString,...) /* "Use casacore::String::format"...
T getenv(const char *name, const T defaultVal)
transform(a.begin(), a.end(), std::ostream_iterator< int >(cout,"\n"), compose(unary(h), compose(unary(f), unary(f))))
Global Functions.
Defines nreal time structures used by the VLA table filler.
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.