Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) 00002 // 00003 // This file is part of Olena. 00004 // 00005 // Olena is free software: you can redistribute it and/or modify it under 00006 // the terms of the GNU General Public License as published by the Free 00007 // Software Foundation, version 2 of the License. 00008 // 00009 // Olena is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software project without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to produce 00021 // an executable, this file does not by itself cause the resulting 00022 // executable to be covered by the GNU General Public License. This 00023 // exception does not however invalidate any other reasons why the 00024 // executable file might be covered by the GNU General Public License. 00025 00026 #include <iostream> 00027 00028 #include <mln/value/builtin/integers.hh> 00029 00030 #include <mln/accu/tuple.hh> 00031 00032 #include <mln/accu/math/count.hh> 00033 #include <mln/accu/stat/max.hh> 00034 #include <mln/accu/stat/min.hh> 00035 #include <mln/accu/stat/mean.hh> 00036 00037 00038 int main() 00039 { 00040 using namespace mln; 00041 00042 typedef accu::tuple<int, 4, accu::math::count<int>, accu::stat::max<int>, accu::stat::min<int>, accu::stat::mean<int> > teratuple; 00043 00044 teratuple tuple1; 00045 teratuple tuple2; 00046 00047 int i1 = 7; 00048 int i2 = 1; 00049 int i3 = 12; 00050 int i4 = -5; 00051 int i5 = -7; 00052 int i6 = 14; 00053 00054 tuple1.take_as_init(i1); 00055 tuple1.take(i2); 00056 tuple1.take(i3); 00057 tuple1.take(i4); 00058 00059 tuple2.take_as_init(i5); 00060 tuple2.take(i6); 00061 00062 tuple1.take(tuple2); 00063 boost::tuple<unsigned, int, int, float> res1 = tuple1.to_result(); 00064 00065 mln_assertion(6 == res1.get<0>()); 00066 mln_assertion(14 == res1.get<1>()); 00067 mln_assertion(-7 == res1.get<2>()); 00068 mln_assertion(res1.get<3>() - 3.66 < 0.1); 00069 }