Debian Codegraph @

tools/physicalModeling/mesh2faust/vega/libraries/include/triple.h

raw symbols SCIP
1 /*************************************************************************
2 * *
3 * Vega FEM Simulation Library Version 3.1 *
4 * *
5 * "triple" include file, Copyright (C) 2007 CMU, 2009 MIT, 2016 USC *
6 * All rights reserved. *
7 * *
8 * Code author: Jernej Barbic *
9 * http://www.jernejbarbic.com/code *
10 * *
11 * Research: Jernej Barbic, Fun Shing Sin, Daniel Schroeder, *
12 * Doug L. James, Jovan Popovic *
13 * *
14 * Funding: National Science Foundation, Link Foundation, *
15 * Singapore-MIT GAMBIT Game Lab, *
16 * Zumberge Research and Innovation Fund at USC *
17 * *
18 * This library is free software; you can redistribute it and/or *
19 * modify it under the terms of the BSD-style license that is *
20 * included with this library in the file LICENSE.txt *
21 * *
22 * This library is distributed in the hope that it will be useful, *
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file *
25 * LICENSE.TXT for more details. *
26 * *
27 *************************************************************************/
28
29 #ifndef _TRIPLE_H_
30 #define _TRIPLE_H_
31
32 // "triple" template, inspired by the STL pair template
33
34 template <class A, class B, class C>
35 class triple
36 {
37 public:
38 // constructors
39 triple() : first(A()), second(B()), third(C()) {}
40 triple(const A & first_, const B & second_, const C & third_) : first(first_), second(second_), third(third_) {}
41
42 // copy constructor
43 triple(const triple & x) : first(x.first), second(x.second), third(x.third) {}
44
45 // operators
46 inline triple & operator= (const triple & x) { first = x.first; second = x.second; third = x.third; return *this; }
47 inline bool operator== (const triple & x) const { return ((first == x.first) && (second == x.second) && (third == x.third)); }
48 inline bool operator!= (const triple & x) const { return ((first != x.first) || (second != x.second) || (third != x.third)); }
49 bool operator< (const triple & x) const
50 {
51 // compare first entry:
52 if (first < x.first)
53 return true;
54 if (x.first < first)
55 return false;
56
57 // first equals x.first; must compare second entry:
58 if (second < x.second)
59 return true;
60 if (x.second < second)
61 return false;
62
63 // first equals x.first, AND second equals x.second; must compare third entry:
64 return (third < x.third);
65 }
66
67 A first;
68 B second;
69 C third;
70 };
71
72 // makes a triple
73 template <class A, class B, class C>
74 triple<A,B,C> make_triple(const A & first, const B & second, const C & third) { return triple<A,B,C>(first, second, third); }
75
76 #endif
77