Move all under modules/libcom

This commit is contained in:
Ralph Lange
2018-06-19 11:24:03 +02:00
parent 49f42945b9
commit 833648c977
607 changed files with 0 additions and 101 deletions

View File

@@ -0,0 +1,13 @@
#*************************************************************************
# Copyright (c) 2010 UChicago Argonne LLC, as Operator of Argonne
# National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************
# This is a Makefile fragment, see src/libCom/Makefile.
SRC_DIRS += $(LIBCOM)/cppStd
INC += epicsAlgorithm.h
INC += epicsExcept.h

View File

@@ -0,0 +1,79 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
// epicsAlgorithm.h
// Authors: Jeff Hill & Andrew Johnson
#ifndef __EPICS_ALGORITHM_H__
#define __EPICS_ALGORITHM_H__
#include "epicsMath.h"
// The C++ standard only requires types to be less-than comparable, so
// the epicsMin and epicsMax templates only use operator <
// epicsMin
template <class T>
inline const T& epicsMin (const T& a, const T& b)
{
return (b < a) ? b : a;
}
// If b is a NaN the above template returns a, but should return NaN.
// These specializations ensure that epicsMin(x,NaN) == NaN
template <>
inline const float& epicsMin (const float& a, const float& b)
{
return (b < a) || isnan(b) ? b : a;
}
template <>
inline const double& epicsMin (const double& a, const double& b)
{
return (b < a) || isnan(b) ? b : a;
}
// epicsMax
template <class T>
inline const T& epicsMax (const T& a, const T& b)
{
return (a < b) ? b : a;
}
// If b is a NaN the above template returns a, but should return NaN.
// These specializations ensure that epicsMax(x,NaN) == NaN
template <>
inline const float& epicsMax (const float& a, const float& b)
{
return (a < b) || isnan(b) ? b : a;
}
template <>
inline const double& epicsMax (const double& a, const double& b)
{
return (a < b) || isnan(b) ? b : a;
}
// epicsSwap
template <class T>
inline void epicsSwap(T& a, T& b)
{
T temp = a;
a = b;
b = temp;
}
#endif // __EPICS_ALGORITHM_H__

View File

@@ -0,0 +1,71 @@
/*************************************************************************\
* Copyright (c) 2002 The University of Chicago, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE Versions 3.13.7
* and higher are distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
// Author: Andrew Johnson & Jeff Hill
// Date: December 2000
#ifndef __EPICS_EXCEPT_H__
#define __EPICS_EXCEPT_H__
#define epicsThrowHere(exc) \
throw locationException(exc, __FILE__, __LINE__)
class sourceLocation {
public: // Functions
sourceLocation(const char *fileName, int lineNumber);
// sourceLocation(const sourceLocation&); Copy constructable
// sourceLocation& operator=(const sourceLocation&); Assignable
const char *fileName() const;
int lineNumber() const;
private: // Hide compiler-generated member functions
sourceLocation(); // default constructor
private: // Data
const char *file;
int line;
};
template <class T>
class locationException : public T, public sourceLocation {
public:
locationException(const T& exc, const char *fileName, int lineNumber);
};
/* Example:
* if (status) epicsThrowHere(std::logic_error("operation failed!"));
* try { ... } catch(sourceLocation& where) { ... }
*/
// END OF DECLARATIONS
// INLINE FUNCTIONS
// sourceFileLocation
inline sourceLocation::sourceLocation (const char *fileName, int lineNumber) :
file(fileName), line(lineNumber) {}
inline const char* sourceLocation::fileName () const {
return this->file;
}
inline int sourceLocation::lineNumber () const {
return this->line;
}
// locationException<T>
template <class T>
inline locationException<T>::locationException
(const char *fileName, int lineNumber, const E& exc) :
T(exc), sourceLocation(fileName, lineNumber) {}
#endif // __EPICS_EXCEPT_H__