/usr/include/rheolef/branch.h is in librheolef-dev 6.7-1+b4.
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 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 | #ifndef _RHEO_BRANCH_H
#define _RHEO_BRANCH_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef 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. See the
/// GNU General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// =========================================================================
#include "rheolef/field.h"
namespace rheolef {
template <class T, class M> class __obranch;
template <class T, class M> class __iobranch;
template <class T, class M> class __branch_header;
template <class T, class M> class __const_branch_header;
template <class T, class M> class __const_branch_finalize;
/*Class:branch
@cindex animation
@cindex continuation methods
@cindex time-dependent problems
@clindex field
NAME: @code{branch} - a parameter-dependent sequence of field
DESCRIPTION:
Stores a @code{field} sequence together with its associated parameter
value: a @code{branch} variable represents a pair @code{(t,uh(t))} for
a specific value of the parameter t.
Applications concern time-dependent problems and continuation methods.
This class is convenient for file inputs/outputs
and building graphical animations.
EXAMPLES:
Coming soon...
LIMITATIONS:
This class is under development.
The @code{branch} class store pointers on @code{field} class
without reference counting. Thus, @code{branch} automatic
variables cannot be returned by functions. @code{branch}
variable are limited to local variables.
AUTHOR:
LMC-IMAG, 38041 Grenoble cedex 9, France.
@url{mailto:Pierre.Saramito@imag.fr}
END:
*/
// =============================================================================
// class definition
// =============================================================================
//<branch:
template <class T, class M = rheo_default_memory_model>
class branch_basic : public std::vector<std::pair<std::string,field_basic<T,M> > > {
public :
// typedefs:
typedef std::vector<std::pair<std::string,field_basic<T,M> > > base;
typedef typename base::size_type size_type;
// allocators:
branch_basic ();
~branch_basic();
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <typename... Args>
branch_basic(const std::string& parameter, Args... names);
#else // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
branch_basic (const std::string& parameter_name, const std::string& u0);
branch_basic (const std::string& parameter_name, const std::string& u0,
const std::string& u1);
branch_basic (const std::string& parameter_name, const std::string& u0,
const std::string& u1,
const std::string& u2);
#endif // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
// accessors:
const T& parameter () const;
const std::string& parameter_name () const;
size_type n_value () const;
size_type n_field () const;
// modifiers:
void set_parameter_name (const std::string& name);
void set_parameter (const T& value);
void set_range (const std::pair<T,T>& u_range);
// input/output:
// get/set current value
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <typename... Args>
__obranch<T,M> operator() (const T& t, const field_basic<T,M>& u0, Args... uk);
template <typename... Args>
__iobranch<T,M> operator() (T& t, field_basic<T,M>& u0, Args&... uk);
#else // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
__obranch<T,M> operator() (const T& t, const field_basic<T,M>& u0);
__obranch<T,M> operator() (const T& t, const field_basic<T,M>& u0,
const field_basic<T,M>& u1);
__obranch<T,M> operator() (const T& t, const field_basic<T,M>& u0,
const field_basic<T,M>& u1,
const field_basic<T,M>& u2);
__iobranch<T,M> operator() (T& t, field_basic<T,M>& u0);
__iobranch<T,M> operator() (T& t, field_basic<T,M>& u0,
field_basic<T,M>& u1);
__iobranch<T,M> operator() (T& t, field_basic<T,M>& u0,
field_basic<T,M>& u1,
field_basic<T,M>& u2);
#endif // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
__branch_header<T,M> header ();
__const_branch_header<T,M> header () const;
__const_branch_finalize<T,M> finalize () const;
//>branch:
// implementation
public:
void get (idiststream&);
void put_header (odiststream&) const;
void get_header (idiststream&);
void put_finalize (odiststream&) const;
template <class T1, class M1> friend class __obranch;
template <class T1, class M1> friend class __iobranch;
// file formats
void put_header_rheolef (odiststream&) const;
void put_event_rheolef (odiststream&) const;
template <class T1> friend void put_header (odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_event (odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_finalize(odiststream&, const branch_basic<T1,sequential>&);
#ifdef _RHEOLEF_HAVE_MPI
template <class T1> friend void put_header (odiststream&, const branch_basic<T1,distributed>&);
template <class T1> friend void put_event (odiststream&, const branch_basic<T1,distributed>&);
template <class T1> friend void put_finalize(odiststream&, const branch_basic<T1,distributed>&);
#endif // _RHEOLEF_HAVE_MPI
template <class T1> friend void put_header_gnuplot (odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_event_gnuplot (odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_finalize_gnuplot(odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_header_paraview (odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_event_paraview (odiststream&, const branch_basic<T1,sequential>&);
template <class T1> friend void put_finalize_paraview(odiststream&, const branch_basic<T1,sequential>&);
void put_header_vtk (odiststream&) const;
void put_geometry_vtk (odiststream&) const;
void put_event_vtk (odiststream&) const;
void put_finalize_vtk (odiststream&) const;
void put_header_paraview (odiststream&) const;
void put_event_paraview (odiststream&) const;
void put_finalize_paraview (odiststream&) const;
private:
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <typename... Args>
void fill_field_names (const std::string &field_name, Args... others);
void fill_field_names () {}
template <typename... Args>
void fill_field_values (std::size_t i, const field_basic<T,M>& ui, Args... uk);
void fill_field_values (std::size_t i) {}
#endif // _RHEOLEF_HAVE_VARIADIC_TEMPLATE
// data:
protected:
std::string _parameter_name;
T _parameter_value;
size_type _n_value;
mutable size_type _count_value;
mutable std::ostream* _p_data_out;
mutable std::ostream* _p_ctrl_out;
mutable bool _header_in_done;
mutable bool _header_out_done;
mutable bool _finalize_out_done;
mutable std::string _to_clean;
mutable std::pair<T,T> _u_range;
mutable std::pair<bool,bool> _have_u_range;
};
template <class T, class M> idiststream& operator>> (idiststream&, branch_basic<T,M>&);
template <class T, class M> odiststream& operator<< (odiststream&, const branch_basic<T,M>&);
template <class T, class M>
idiststream& operator>> (idiststream&, branch_basic<T,M>&);
template <class T, class M>
odiststream& operator<< (odiststream&, const branch_basic<T,M>&);
typedef branch_basic<Float> branch;
// =============================================================================
// inlined
// =============================================================================
template <class T, class M>
inline
branch_basic<T,M>::branch_basic ()
: std::vector<std::pair<std::string,field_basic<T,M> > >(0),
_parameter_name ("*unamed*"),
_parameter_value(std::numeric_limits<T>::max()),
_n_value (std::numeric_limits<size_type>::max()),
_count_value (std::numeric_limits<size_type>::max()),
_p_data_out (0),
_p_ctrl_out (0),
_header_in_done (false),
_header_out_done (false),
_finalize_out_done (false),
_to_clean(),
_u_range(std::pair<T,T>( std::numeric_limits<T>::max(),
-std::numeric_limits<T>::max())),
_have_u_range(std::pair<bool,bool>(false,false))
{
}
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T, class M>
template <typename... Args>
inline branch_basic<T,M>::branch_basic(const std::string& parameter_name, Args... field_names)
: std::vector<std::pair<std::string,field_basic<T,M> > >(0),
_parameter_name (parameter_name),
_parameter_value(std::numeric_limits<Float>::max()),
_n_value (std::numeric_limits<size_type>::max()),
_count_value (std::numeric_limits<size_type>::max()),
_p_data_out (0),
_p_ctrl_out (0),
_header_in_done (false),
_header_out_done (false),
_finalize_out_done (false),
_to_clean(),
_u_range(std::pair<T,T>( std::numeric_limits<T>::max(),
-std::numeric_limits<T>::max())),
_have_u_range(std::pair<bool,bool>(false,false))
{
check_macro (parameter_name.length() != 0, "empty parameter name not allowed");
fill_field_names (field_names...);
}
template <class T, class M>
template <typename... Args>
inline void branch_basic<T,M>::fill_field_names (const std::string& field_name, Args... others) {
check_macro (field_name.length() != 0, "empty field name not allowed");
base::push_back (std::make_pair(field_name, field_basic<T,M>()));
fill_field_names (others...);
}
#else // !_RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T, class M>
inline
branch_basic<T,M>::branch_basic (const std::string& parameter_name, const std::string& u0)
: std::vector<std::pair<std::string,field_basic<T,M> > >(1),
_parameter_name (parameter_name),
_parameter_value(std::numeric_limits<T>::max()),
_n_value (std::numeric_limits<size_type>::max()),
_count_value (std::numeric_limits<size_type>::max()),
_p_data_out (0),
_p_ctrl_out (0),
_header_in_done (false),
_header_out_done (false),
_finalize_out_done (false),
_to_clean(),
_u_range(std::pair<T,T>( std::numeric_limits<T>::max(),
-std::numeric_limits<T>::max())),
_have_u_range(std::pair<bool,bool>(false,false))
{
check_macro(parameter_name.length() != 0, "empty parameter name not allowed");
check_macro(u0.length() != 0, "empty field name not allowed");
base::operator[](0).first = u0;
}
template <class T, class M>
inline
branch_basic<T,M>::branch_basic (const std::string& parameter_name, const std::string& u0,
const std::string& u1)
: std::vector<std::pair<std::string,field_basic<T,M> > >(2),
_parameter_name (parameter_name),
_parameter_value(std::numeric_limits<T>::max()),
_n_value (std::numeric_limits<size_type>::max()),
_count_value (std::numeric_limits<size_type>::max()),
_p_data_out (0),
_p_ctrl_out (0),
_header_in_done (false),
_header_out_done (false),
_finalize_out_done (false),
_to_clean(),
_u_range(std::pair<T,T>( std::numeric_limits<T>::max(),
-std::numeric_limits<T>::max())),
_have_u_range(std::pair<bool,bool>(false,false))
{
check_macro(parameter_name.length() != 0, "empty parameter name not allowed");
check_macro(u0.length() != 0, "empty #1 field name not allowed");
check_macro(u1.length() != 0, "empty #2 field name not allowed");
base::operator[](0).first = u0;
base::operator[](1).first = u1;
}
template <class T, class M>
inline
branch_basic<T,M>::branch_basic (const std::string& parameter_name, const std::string& u0,
const std::string& u1,
const std::string& u2)
: std::vector<std::pair<std::string,field_basic<T,M> > >(3),
_parameter_name (parameter_name),
_parameter_value(std::numeric_limits<T>::max()),
_n_value (std::numeric_limits<size_type>::max()),
_count_value (std::numeric_limits<size_type>::max()),
_p_data_out (0),
_p_ctrl_out (0),
_header_in_done (false),
_header_out_done (false),
_finalize_out_done (false),
_to_clean(),
_u_range(std::pair<T,T>( std::numeric_limits<T>::max(),
-std::numeric_limits<T>::max())),
_have_u_range(std::pair<bool,bool>(false,false))
{
check_macro(parameter_name.length() != 0, "empty parameter name not allowed");
check_macro(u0.length() != 0, "empty #1 field name not allowed");
check_macro(u1.length() != 0, "empty #2 field name not allowed");
check_macro(u2.length() != 0, "empty #3 field name not allowed");
base::operator[](0).first = u0;
base::operator[](1).first = u1;
base::operator[](2).first = u2;
}
#endif // !_RHEOLEF_HAVE_VARIADIC_TEMPLATE
// -----------------------------------------------------------------------------
// accessors
// -----------------------------------------------------------------------------
template <class T, class M>
inline
const T&
branch_basic<T,M>::parameter () const
{
return _parameter_value;
}
template <class T, class M>
inline
const std::string&
branch_basic<T,M>::parameter_name () const
{
return _parameter_name;
}
template <class T, class M>
inline
typename branch_basic<T,M>::size_type
branch_basic<T,M>::n_value () const
{
return _n_value;
}
template <class T, class M>
inline
typename branch_basic<T,M>::size_type
branch_basic<T,M>::n_field () const
{
return base::size();
}
// -----------------------------------------------------------------------------
// modifiers
// -----------------------------------------------------------------------------
template <class T, class M>
inline
void
branch_basic<T,M>::set_parameter_name (const std::string& name)
{
_parameter_name = name;
}
template <class T, class M>
inline
void
branch_basic<T,M>::set_parameter (const T& x)
{
_parameter_value = x;
}
template <class T, class M>
inline
void
branch_basic<T,M>::set_range (const std::pair<T,T>& u_range)
{
_u_range = u_range;
_have_u_range = std::pair<bool,bool>(false,false);
}
// -----------------------------------------------------------------------------
// io header wrapper
// -----------------------------------------------------------------------------
template <class T, class M>
class __branch_header {
public:
__branch_header (branch_basic<T,M>& b) : _b(b) {}
friend idiststream& operator>> (idiststream& in, __branch_header<T,M> h) {
h._b.get_header(in); return in; }
friend odiststream& operator<< (odiststream& out, __branch_header<T,M> h) {
h._b.put_header(out); return out; }
protected:
branch_basic<T,M>& _b;
template <class T1, class M1> friend class __const_branch_header;
};
template <class T, class M>
class __const_branch_header {
public:
__const_branch_header (const branch_basic<T,M>& b) : _b(b) {}
__const_branch_header (__branch_header<T,M> h) : _b(h._b) {}
friend odiststream& operator<< (odiststream& out, __const_branch_header<T,M> h) {
h._b.put_header(out); return out; }
protected:
const branch_basic<T,M>& _b;
};
template <class T, class M>
inline
__branch_header<T,M>
branch_basic<T,M>::header ()
{
return *this;
}
template <class T, class M>
inline
__const_branch_header<T,M>
branch_basic<T,M>::header () const
{
return *this;
}
// -----------------------------------------------------------------------------
// o finalize wrapper
// -----------------------------------------------------------------------------
template <class T, class M>
class __const_branch_finalize {
public:
__const_branch_finalize (const branch_basic<T,M>& b) : _b(b) {}
friend odiststream& operator<< (odiststream& out, __const_branch_finalize<T,M> h) {
h._b.put_finalize(out); return out; }
protected:
const branch_basic<T,M>& _b;
};
template <class T, class M>
inline
__const_branch_finalize<T,M>
branch_basic<T,M>::finalize () const
{
return *this;
}
// -----------------------------------------------------------------------------
// io value wrapper
// -----------------------------------------------------------------------------
template <class T, class M>
class __obranch {
public:
__obranch (odiststream& (*put)(odiststream&, const branch_basic<T,M>&), const branch_basic<T,M>& x)
: _put(put), _x(x) {}
friend odiststream& operator<< (odiststream& os, __obranch<T,M> m)
{ m._put (os, m._x); return os; }
private:
odiststream& (*_put) (odiststream&, const branch_basic<T,M>&);
const branch_basic<T,M>& _x;
};
template <class T, class M>
class __iobranch {
public:
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <typename... Args>
__iobranch (odiststream& (*put)(odiststream&, const branch_basic<T,M>&),
idiststream& (*get)(idiststream&, branch_basic<T,M>&),
branch_basic<T,M>& x,
T& t,
field_basic<T,M>& u0,
Args&... uk)
: _put(put), _get(get), _px(&x), _pt(&t), _pu()
{
std::size_t n = sizeof...(Args)+1;
_pu.resize(n);
_pu[0] = &u0;
fill_field_references (1, uk...);
}
template <typename... Args>
void fill_field_references (std::size_t i, field_basic<T,M>& ui, Args&... uk) {
_pu [i] = &ui;
fill_field_references (i+1, uk...);
}
void fill_field_references (std::size_t i) {}
#else // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
__iobranch (odiststream& (*put)(odiststream&, const branch_basic<T,M>&),
idiststream& (*get)(idiststream&, branch_basic<T,M>&),
branch_basic<T,M>& x,
T* pt = 0,
field_basic<T,M>* pu0 = 0,
field_basic<T,M>* pu1 = 0,
field_basic<T,M>* pu2 = 0)
: _put(put), _get(get), _px(&x), _pt(pt), _pu0(pu0), _pu1(pu1), _pu2(pu2) {}
#endif // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T1, class M1>
friend odiststream& operator<< (odiststream& os, __iobranch<T1,M1> m);
template <class T1, class M1>
friend idiststream& operator>> (idiststream& is, __iobranch<T1,M1> m);
private:
odiststream& (*_put) (odiststream&, const branch_basic<T,M>&);
idiststream& (*_get) (idiststream&, branch_basic<T,M>&);
branch_basic<T,M> *_px;
T *_pt;
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
std::vector<field_basic<T,M>*> _pu;
#else // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
field_basic<T,M> *_pu0;
field_basic<T,M> *_pu1;
field_basic<T,M> *_pu2;
#endif // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
};
template <class T, class M>
inline
odiststream& operator<< (odiststream& os, __iobranch<T,M> m) {
m._put (os, *m._px);
return os;
}
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T, class M>
inline
idiststream& operator>> (idiststream& is, __iobranch<T,M> m) {
m._get (is, *m._px);
if (m._pt) { *m._pt = (*m._px).parameter(); }
for (std::size_t i = 0, n = (*m._px).size(); i < n; ++i) {
*(m._pu[i]) = (*m._px)[i].second;
}
return is;
}
#else // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T, class M>
inline
idiststream& operator>> (idiststream& is, __iobranch<T,M> m) {
m._get (is, *m._px);
if (m._pt) { *m._pt = (*m._px).parameter(); }
if (m._pu0) { *m._pu0 = (*m._px)[0].second; }
if (m._pu1) { *m._pu1 = (*m._px)[1].second; }
if (m._pu2) { *m._pu2 = (*m._px)[2].second; }
return is;
}
#endif // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
#ifdef _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T, class M>
template <typename... Args>
inline
__obranch<T,M>
branch_basic<T,M>::operator() (const T& t, const field_basic<T,M>& u0, Args... uk) {
check_macro (base::size() >= sizeof...(Args)+1, "attempt to output a " << (sizeof...(Args)+1) <<"-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
fill_field_values (1, uk...);
return __obranch<T,M> (operator<<, *this);
}
template <class T, class M>
template <typename... Args>
inline
__iobranch<T,M>
branch_basic<T,M>::operator() (T& t, field_basic<T,M>& u0, Args&... uk) {
check_macro (base::size() >= sizeof...(Args)+1, "attempt to output a " << (sizeof...(Args)+1) <<"-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
fill_field_values (1, uk...);
return __iobranch<T,M> (operator<<, operator>>, *this, t, u0, uk...);
}
template <class T, class M>
template <typename... Args>
inline
void branch_basic<T,M>::fill_field_values(std::size_t id, const field_basic<T,M>& u_id, Args... uk) {
base::operator[](id++).second = u_id;
fill_field_values(id, uk...);
}
#else // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
template <class T, class M>
inline
__obranch<T,M>
branch_basic<T,M>::operator() (const T& t, const field_basic<T,M>& u0)
{
check_macro (base::size() >= 1, "attempt to output a 1-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
return __obranch<T,M> (operator<<, *this);
}
template <class T, class M>
inline
__iobranch<T,M>
branch_basic<T,M>::operator() (T& t, field_basic<T,M>& u0)
{
check_macro (base::size() >= 1, "attempt to input/output a 1-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
return __iobranch<T,M> (operator<<, operator>>, *this, &t, &u0);
}
template <class T, class M>
inline
__obranch<T,M>
branch_basic<T,M>::operator() (const T& t, const field_basic<T,M>& u0,
const field_basic<T,M>& u1)
{
check_macro (base::size() >= 2, "attempt to output a 2-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
base::operator[](1).second = u1;
return __obranch<T,M> (operator<<, *this);
}
template <class T, class M>
inline
__iobranch<T,M>
branch_basic<T,M>::operator() (T& t, field_basic<T,M>& u0,
field_basic<T,M>& u1)
{
check_macro (base::size() >= 2, "attempt to output a 2-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
base::operator[](1).second = u1;
return __iobranch<T,M> (operator<<, operator>>, *this, &t, &u0, &u1);
}
template <class T, class M>
inline
__obranch<T,M>
branch_basic<T,M>::operator() (const T& t, const field_basic<T,M>& u0,
const field_basic<T,M>& u1,
const field_basic<T,M>& u2)
{
check_macro (base::size() >= 3, "attempt to output a 3-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
base::operator[](1).second = u1;
base::operator[](2).second = u2;
return __obranch<T,M> (operator<<, *this);
}
template <class T, class M>
inline
__iobranch<T,M>
branch_basic<T,M>::operator() (T& t, field_basic<T,M>& u0,
field_basic<T,M>& u1,
field_basic<T,M>& u2)
{
check_macro (base::size() >= 3, "attempt to output a 3-field branch when a "
<< base::size() << "-field one was supplied");
_parameter_value = t;
base::operator[](0).second = u0;
base::operator[](1).second = u1;
base::operator[](2).second = u2;
return __iobranch<T,M> (operator<<, operator>>, *this, &t, &u0, &u1, &u2);
}
#endif // ! _RHEOLEF_HAVE_VARIADIC_TEMPLATE
}// namespace rheolef
#endif // define_RHEO_BRANCH_H
|