COIN-OR::LEMON - Graph Library

Changeset 1713:49d22d34d95f in lemon-0.x for doc/named-param.dox


Ignore:
Timestamp:
10/06/05 12:28:45 (19 years ago)
Author:
Alpar Juttner
Branch:
default
Phase:
public
Convert:
svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2240
Message:

Doc improvments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/named-param.dox

    r1709 r1713  
    2222
    2323\code
    24 class named_fn
     24class namedFn
    2525{
    2626  int _id;
     
    2929 
    3030  public:
    31   named_fn() : _id(0), _val(1), _dim(2) {}
    32   named_fn& id(int p)     { _id  = p ; return *this; }
    33   named_fn& val(double p) { _val = p ; return *this; }
    34   named_fn& dim(int p)    { _dim = p ; return *this; }
     31  namedFn() : _id(0), _val(1), _dim(2) {}
     32  namedFn& id(int p)     { _id  = p ; return *this; }
     33  namedFn& val(double p) { _val = p ; return *this; }
     34  namedFn& dim(int p)    { _dim = p ; return *this; }
    3535
    3636  run() {
     
    4343The usage is the following.
    4444
    45 We have to define a class, let's call it \c named_fn.  Let us assume that
    46 we would like to use a parameter, called \c X. In the \c named_fn class we
     45We have to define a class, let's call it \c namedFn.  Let us assume that
     46we would like to use a parameter, called \c X. In the \c namedFn class we
    4747have to define an \c _X attribute, and a function \c X. The function
    4848expects a parameter with the type of \c _X, and sets the value of
     
    5656attributes (originally the parameters), initially. If we call function
    5757\c X, we get a class with the modified parameter value of
    58 \c X. Therefore we can modify any parameter-value, independent from the
     58\c X. Therefore we can modify any parameter-value, independently from the
    5959order. To run the algorithm we have to call the <tt>run()</tt> function at the
    6060end of the row.
     
    6262Example:
    6363\code
    64 named_fn().id(3).val(2).run();
     64namedFn().id(3).val(2).run();
    6565\endcode
     66
     67\note Although it is a class, namedFn is used pretty much like as it were
     68a function. That it why it is called namedFn and not \c NamedFn.
     69
     70\note In fact, the final <tt>.run()</tt> could be made unnecessary if the
     71actual function code were put in the destructor instead. This however would make
     72hard to implement functions with return values, and would also make the
     73implementation of \ref named-templ-func-param "named template parameters"
     74very problematic. Therefore, by convention, <tt>.run()</tt> is used
     75to explicitly execute function having named parameters in Lemon.
     76
    6677
    6778\section traits-classes Traits Classes
Note: See TracChangeset for help on using the changeset viewer.