diff options
| author | Marc Jeanmougin <marc.jeanmougin@telecom-paristech.fr> | 2018-04-29 14:25:32 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marc.jeanmougin@telecom-paristech.fr> | 2018-04-29 14:25:32 +0000 |
| commit | ab5f8ff5869021958f4ae8b838c3d707a2e85eaa (patch) | |
| tree | 4907675828a5401d013b7587538cc8541edd2764 /src/libcola/commondefs.h | |
| parent | moved libcroco, libuemf, libdepixelize to 3rdparty folder (diff) | |
| download | inkscape-ab5f8ff5869021958f4ae8b838c3d707a2e85eaa.tar.gz inkscape-ab5f8ff5869021958f4ae8b838c3d707a2e85eaa.zip | |
Put adaptagrams into its own folder
Diffstat (limited to 'src/libcola/commondefs.h')
| -rw-r--r-- | src/libcola/commondefs.h | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/libcola/commondefs.h b/src/libcola/commondefs.h deleted file mode 100644 index 591fde57f..000000000 --- a/src/libcola/commondefs.h +++ /dev/null @@ -1,103 +0,0 @@ -/* - * vim: ts=4 sw=4 et tw=0 wm=0 - * - * libcola - A library providing force-directed network layout using the - * stress-majorization method subject to separation constraints. - * - * Copyright (C) 2006-2008 Monash University - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * See the file LICENSE.LGPL distributed with the library. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * -*/ - -#ifndef _COMMONDEFS_H -#define _COMMONDEFS_H - -/* Notes to compilation using MSVC. - - Compiler options: - /Zc:forScope -*/ -#if defined(_MSC_VER) -// Microsoft Visual C++ (MS VC) specific code goes here -#include <float.h> -#include <malloc.h> // Contains _alloca -namespace std { -inline bool isnan(double const &x) { return _isnan(x) != 0; } -inline bool isinf(double const &x) { return !(_finite(x) || _isnan(x)); } -} // end std - -#endif - -#include "libvpsc/assertions.h" -#include <valarray> - -namespace cola { - -/* - * resolve overlaps: - * None: not at all - * Horizontal: only horizontally - * Both: resolve in either Horizontal or Vertical direction - * depending on which leads to less displacement - */ -enum NonOverlapConstraintsMode { None, Horizontal, Both }; - -class FixedList { -public: - FixedList(const unsigned n) : array(std::valarray<bool>(n)),allFixed(false) - { - array=false; - } - void set(const unsigned i, const bool value=true) { - COLA_ASSERT(i<array.size()); - array[i]=value; - } - bool check(const unsigned i) const { - if(allFixed||i>=array.size()) { - return false; - } - return array[i]; - } - void unsetAll() { - array=false; - } - void fixAll(bool val) { - allFixed=val; - } -private: - std::valarray<bool> array; - bool allFixed; -}; - -/* - * templated delete functor for use in for_each loop over vector - */ -struct delete_object -{ - template <typename T> - void operator()(T *ptr){ delete ptr;} -}; -/* - * Sum over the results of calling operation for each member in the - * iterator. Handier than std::accumulate because we can use with - * mem_fun to pass in a getter method. - */ -template <class InputIterator, class T, class Operation > -T sum_over(InputIterator beg, InputIterator end, T init, Operation op) -{ - for ( ; beg != end; ++beg) - init = init + op(*beg); - return init; -} -} // namespace cola - -#endif |
