28 JFormat(std::ostream& out,
int width,
int precision) :
29 std::ostream(out.rdbuf())
32 this->precision = precision;
39 typedef std::ostream& (*io_manip) (std::ostream&);
50 static_cast<std::ostream&
>(*this) << manip;
65 static_cast<std::ostream&
>(*this) << value;
79 static_cast<std::ostream&
>(*this) << std::fixed << std::setw(width) << std::setprecision(precision) << value;
91 template<
unsigned int N>
92 JFormat& operator<<(const JMultiKey<N, const double>& value)
94 return *
this << value.first <<
' ' << value.second;
104 JFormat& operator<<(const JMultiKey<1, const double>& value)
106 return *
this << value.first;
121 int main(
int argc,
char **argv)
129 JParser<> zap(
"Example program to test multi-dimensional map.");
135 catch(
const exception &error) {
136 FATAL(error.what() << endl);
142 const double xmin = -1.0;
143 const double xmax = +1.0;
148 JMap>::maplist JMaplist_t;
154 for (
double x = xmin; x <= xmax; x += (xmax - xmin)/(nx - 1)) {
155 for (
double y = xmin; y <= xmax; y += (xmax - xmin)/(nx - 1)) {
156 for (
double z = xmin; z <= xmax; z += (xmax - xmin)/(nx - 1)) {
157 buffer[x][y][z] = x*100 + y*10 + z;
162 JFormat out(cout, 6, 1);
164 cout <<
"i->[second]*->(first|second)" << endl;
166 for (JMultimap_t::super_const_iterator i = buffer.super_begin(); i != buffer.super_end(); ++i) {
167 out << i->first <<
' '
168 << i->second->first <<
' '
169 << i->second->second->first <<
' '
170 << i->second->second->second << endl;
173 cout <<
"i.getKey() i.getValue()" << endl;
175 for (JMultimap_t::super_const_iterator i = buffer.super_begin(); i != buffer.super_end(); ++i) {
176 out << i.getKey() <<
' ' << i.getValue() << endl;
Utility class to parse command line options.
JMultiMap is a general purpose multidimensional map based on a type list of maps. ...
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
do set_variable OUTPUT_DIRECTORY $WORKDIR T
General purpose messaging.
Utility class to parse command line options.
int main(int argc, char *argv[])