/usr/include/magics/magics.h is in libmagics++-dev 3.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | /*
* (C) Copyright 1996-2016 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation nor
* does it submit to any jurisdiction.
*/
/*! \file magics.h
\brief This file contains all global definition for the MagPlus library.
\author Meteorological Visualisation Section, ECMWF
\license Apache License 2.0
Started: January 2004
Changes:
*/
#ifndef magicsplusplus_H
#define magicsplusplus_H
//#define BOOST_VERSION 104700
#include <magics_config.h>
#if defined(MAGICS_AIX_XLC)
#include <unistd.h> // for AIX
#endif
#include <climits>
// do the export restriction only if NOT for Metview
#ifndef HAVE_METVIEW
#ifdef WIN32
#define MAGICS_IMPORT __declspec(dllimport)
#define MAGICS_EXPORT __declspec(dllexport)
#define MAGICS_DLLLOCAL
#define MAGICS_DLLPUBLIC
#endif
#if (__GNUC__ - 0 > 3) || (__GNUC__ - 0 == 3 && __GNUC_MINOR__ - 0 > 2)
#define MAGICS_GCC 4
#define MAGICS_NO_EXPORT __attribute__ ((visibility("hidden")))
#define MAGICS_EXPORT __attribute__ ((visibility("default")))
#define MAGICS_IMPORT __attribute__ ((visibility("default")))
#define MAGICS_DLLLOCAL __attribute__ ((visibility("hidden")))
#define MAGICS_DLLPUBLIC __attribute__ ((visibility("default")))
#else
#define MAGICS_GCC 3
#define MAGICS_NO_EXPORT
#define MAGICS_IMPORT
#define MAGICS_EXPORT
#define MAGICS_DLLLOCAL
#define MAGICS_DLLPUBLIC
#endif
#else
#define MAGICS_GCC 3
#define MAGICS_NO_EXPORT
#define MAGICS_IMPORT
#define MAGICS_EXPORT
#define MAGICS_DLLLOCAL
#define MAGICS_DLLPUBLIC
#endif
#ifdef __GNUC__
#define MAGICS_DEPRECATED __attribute__((deprecated))
#else
#define MAGICS_DEPRECATED
#endif
#include <cstdlib>
#include <iostream>
#include <cstring>
#include <string>
#include <sstream>
//#include <fstream>
using std::string;
using std::ostream;
using std::endl;
using std::ends;
using std::cout;
using std::cerr;
using std::ostringstream;
using std::ofstream;
using std::ifstream;
//#include <list>
#include <vector>
//#include <stack>
#include <memory>
#include <map>
#include <set>
//#include <iterator>
#include <numeric>
//#include <cfloat>
//#include <algorithm>
using std::allocator;
using std::vector;
using std::pair;
//using std::list;
using std::map;
using std::set;
// using std::auto_ptr;
#include <exception>
using std::exception;
#include <cassert>
#include <cmath>
/*! \namespace magics
The <I>magics</I> namespace encapsulates all elements of Magics++.
The namespace prevents confusions with other libraries or
older versions of Magics.
You can use this namespace by simple prefix all Magics elements
by <I>magics::</I> or by typing <I>using namespace magics;</I>
before any calls in your program.
*/
namespace magics {
//const double double_MIN = DBL_MIN;
template <class P>
class magvector : public std::vector<P>
{
public:
magvector() {}
magvector(const std::vector<P>& list) : std::vector<P>(list) {}
virtual ~magvector() {}
virtual MAGICS_NO_EXPORT void print(ostream& out) const
{
if ( this->size() < 10 ) {
out << "Vector[";
string sep = "";
const unsigned int si = this->size();
for (unsigned int i = 0; i < si; i++) {
out << sep << (*this)[i];
sep = ", ";
}
out << "]";
}
else {
unsigned int nb = this->size();
out << "Vector[" << (*this)[0] << ", " << (*this)[1] << ", " << (*this)[2];
out << "...." << (*this)[nb-3] << ", " << (*this)[nb-2] << ", " << (*this)[nb-1];
out << "(" << nb << " elements)]";
}
}
// -- Friends
friend MAGICS_NO_EXPORT ostream& operator<<(ostream& s,const magvector<P>& p)
{ p.print(s); return s; }
};
typedef magvector<string> stringarray;
typedef magvector<int> intarray;
typedef magvector<long int> longintarray;
typedef magvector<double> doublearray;
typedef magvector<double> floatarray;
enum LineStyle { M_SOLID , M_DASH , M_DOT , M_CHAIN_DASH , M_CHAIN_DOT };
enum Hemisphere { NORTH , SOUTH };
enum Justification { MLEFT, MCENTRE, MRIGHT };
enum Position { M_AUTOMATIC, M_TOP , M_BOTTOM , M_LEFT, M_RIGHT};
enum VerticalAlign { MNORMAL, MTOP, MCAP, MHALF, MBASE, MBOTTOM };
//enum VerticalAlign { MBASE, MTOP, MHALF, MBOTTOM }; // if change you need to change also share/magics/PostScriptMacros2.dat
enum Shading { M_SH_NONE, M_SH_SOLID, M_SH_HATCH, M_SH_DOT };
enum ArrowPosition { M_TAIL, M_CENTRE, M_HEAD_ONLY};
enum DisplayType { ABSOLUTE, INLINE, BLOCK, NONE, HIDDEN };
enum ListPolicy { M_LASTONE, M_CYCLE };
enum GraphicsFormat {PS, EPS, PDF, SVG, KML, PNG, X, CPS, CSVG, GIF, AGIF, JPG, QT, GEOJSON};
enum AxisAutomaticSetting {m_off, m_both, m_min_only, m_max_only};
/*
inline MAGICS_NO_EXPORT string getOutputString()
{
const string outputs = MAGICS_OUTPUTS;
return outputs;
}
*/
static double EPSILON = 1.25e-10;
template<class T>
inline MAGICS_NO_EXPORT T abs(const T a) { return (a < 0) ? -a : a; }
#ifndef PI
const double PI = atan(1.)*4.;
#endif
inline MAGICS_NO_EXPORT double RAD(const double r) { return r*PI/180.;}
inline MAGICS_NO_EXPORT double DEG(const double d) { return d*180./PI;}
inline MAGICS_NO_EXPORT bool zero(const double v) { return abs(v) < EPSILON; }
inline MAGICS_NO_EXPORT bool same(const double a, const double b) { return zero(a-b); }
inline MAGICS_NO_EXPORT bool zero(const double v, double epsilon) { return abs(v) < epsilon; }
inline MAGICS_NO_EXPORT bool same(const double a, const double b, double epsilon) { return zero(a-b, epsilon); }
//! Global function to read env variables
inline MAGICS_NO_EXPORT string getEnvVariable(const string var)
{
const char* va = var.c_str();
const char* ww = getenv(va);
if(ww) return string(ww);
if(!strcmp(va,"MAGPLUS_HOME")) return string(MAGICS_INSTALL_PATH);
return "";
}
//! Global function to return the Magics++ version for ID line
/*! comes from magics_config.h !!! */
inline string getMagicsVersionString()
{
const string magics = MAGICS_NAME;
string version = MAGICS_VERSION_STR;
if ( sizeof(long)==8)
version += string(" (64 bit)");
return magics + string(" ") + version;
}
// inline MAGICS_NO_EXPORT int upper_case(const int c) { return toupper(c);}
inline MAGICS_NO_EXPORT char lower_case(const char c) { return tolower(c);}
//! Make an lowercase copy of s:
inline MAGICS_NO_EXPORT string lowerCase(const string& s)
{
std::string out;
std::string::const_iterator se = s.end();
for ( string::const_iterator l = s.begin(); l != se; ++l)
{
char ii = tolower(*l);
out.push_back(ii);
}
return out;
}
/*!
\brief compares two strings
*/
inline MAGICS_NO_EXPORT bool magCompare(const string &s1, const string &s2)
{
if(s1.size() != s2.size()) return false;
#ifndef MAGICS_WINDOWS_CYGWIN
return !( strcasecmp(s1.c_str(),s2.c_str()) );
#endif
}
inline MAGICS_NO_EXPORT std::string replacePathWithHome(const string & path)
{
const std::string home_path = getEnvVariable("HOME");
std::string filename = path.substr(path.find_last_of("/\\"));
return home_path + filename;
}
/*!
\brief returns the biggest integer inside a double
*/
inline double maground(double x)
{
return floor(x + 0.5);
}
inline double tonumber(const string& str)
{
double r;
std::stringstream ss(str);
ss >> r;
return r;
}
template <class T>
inline string tostring(const T& in)
{
std::ostringstream out;
out << in;
return out.str();
}
/*!
\brief checks if file readable or not
*/
/*
inline MAGICS_NO_EXPORT bool fileReadable(const string &strFile)
{
FILE *fp = fopen (strFile.c_str(), "r");
if (fp != NULL)
{
fclose (fp);
return true;
}
else
{
return false;
}
}
*/
#define MAGPLUS_PATH_TO_SHARE_ "/share/magics/"
#define MAGPLUS_LINK_ "http://software.ecmwf.int/magics"
#define MAGPLUS_PATH_TO_PS_FONTS_ POSTSCRIPT_FONT_PATH;
}
#endif
|