aimsdata 6.0.0
Neuroimaging data handling
getoptProcess.h
Go to the documentation of this file.
1/* This software and supporting documentation are distributed by
2 * Institut Federatif de Recherche 49
3 * CEA/NeuroSpin, Batiment 145,
4 * 91191 Gif-sur-Yvette cedex
5 * France
6 *
7 * This software is governed by the CeCILL-B license under
8 * French law and abiding by the rules of distribution of free software.
9 * You can use, modify and/or redistribute the software under the
10 * terms of the CeCILL-B license as circulated by CEA, CNRS
11 * and INRIA at the following URL "http://www.cecill.info".
12 *
13 * As a counterpart to the access to the source code and rights to copy,
14 * modify and redistribute granted by the license, users are provided only
15 * with a limited warranty and the software's author, the holder of the
16 * economic rights, and the successive licensors have only limited
17 * liability.
18 *
19 * In this respect, the user's attention is drawn to the risks associated
20 * with loading, using, modifying and/or developing or reproducing the
21 * software by the user in light of its specific status of free software,
22 * that may mean that it is complicated to manipulate, and that also
23 * therefore means that it is reserved for developers and experienced
24 * professionals having in-depth computer knowledge. Users are therefore
25 * encouraged to load and test the software's suitability as regards their
26 * requirements in conditions enabling the security of their systems and/or
27 * data to be ensured and, more generally, to use and operate it in the
28 * same conditions as regards security.
29 *
30 * The fact that you are presently reading this means that you have had
31 * knowledge of the CeCILL-B license and that you accept its terms.
32 */
33
34/*
35 * ...
36 */
37#ifndef AIMS_GETOPT_GETOPTPROCESS_H
38#define AIMS_GETOPT_GETOPTPROCESS_H
39
40#include <aims/getopt/getopt2.h>
41#include <aims/io/process.h>
42
43
44namespace aims
45{
46
48 {
49 public:
50 ProcessInput( const Process & p ) : _proc( p ) {}
51 std::string filename;
52 const Process & process() const { return( _proc ); }
53
54 private:
55 const Process & _proc;
56 };
57
58}
59
60namespace carto
61{
62 //---------------------------------------------------------------------------
63 template <>
65 {
66 std::string inf;
67 if ( _optional )
68 inf = "[ ";
69 inf += names() + " <file name (read only): ";
70
71 const std::map<std::string, std::map<std::string,
73 procs = _value.process().processTypes();
74 std::map<std::string, std::map<std::string, aims::Process::ProcFunc> >
75 ::const_iterator ipl, epl = procs.end();
76 std::map<std::string, aims::Process::ProcFunc>::const_iterator ip, ep;
77
78 std::string ptypes;
79 unsigned count = 0;
80
81 for( ipl=procs.begin(); ipl!=epl; ++ipl )
82 for( ip=ipl->second.begin(), ep=ipl->second.end(); ip!=ep; ++ip )
83 {
84 if( count != 0 )
85 ptypes += std::string( ", " );
86 ++count;
87 ptypes += ipl->first + " of " + ip->first;
88 }
89
90 if( count > 1 )
91 inf += std::string( "{ " ) + ptypes + " }";
92 else
93 inf += ptypes;
94
95 inf += std::string( "> " ) + _info;
96 if( _optional )
97 inf += std::string( " ]" );
98 return inf;
99 }
100
101 //---------------------------------------------------------------------------
102 template <>
103 bool SingleOption< aims::ProcessInput >::feed( const std::string &value )
104 {
105 if ( _valueRead )
106 return false;
107 else
108 {
109 _value.filename = value;
110 _valueRead = true;
111 return true;
112 }
113 }
114
115}
116
117#endif
118
Link mechanism between the Finder and a process operating on arbitrary data types.
Definition process.h:200
bool(* ProcFunc)(Process &, const std::string &, Finder &)
Process function type.
Definition process.h:213
std::string info() const
virtual bool feed(const std::string &)
The class for EcatSino data write operation.
const Process & process() const
std::string filename
ProcessInput(const Process &p)