Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JCSV.hh
Go to the documentation of this file.
1#ifndef __JLANG__JCSV__
2#define __JLANG__JCSV__
3
4#include <iterator>
5
6#include "JLang/JClass.hh"
7#include "JLang/JSTDTypes.hh"
9
10
11/**
12 * \file
13 *
14 * Utility method to assign multiple values to STD container.
15 *
16 * \code{.cpp}
17 #include <set>
18
19 #include "JLang/JCSV.hh"
20
21 using namespace std;
22 using namespace JLANG;
23
24 set<double> buffer;
25
26 assign(buffer) = 1.1, 9.9, 8.8, 7.7;
27 \endcode
28 * \author mdejong
29*/
30
31namespace JLANG {}
32namespace JPP { using namespace JLANG; }
33
34namespace JLANG {
35
36 /**
37 * Auxiliary class to assign a sequence of Comma Separated Values (CSV).
38 */
39 template<class T>
41 public JSTDObjectWriter<T>
42 {
43 protected:
44
46
47
48 /**
49 * Auxiliary class to assign the remainder of a sequence of Comma Separated Values.
50 */
51 struct JCSV :
52 public JSTDObjectWriter<T>
53 {
54 /**
55 * Constructor
56 *
57 * \param out output iterator
58 */
60 JSTDObjectWriter<T>(out)
61 {}
62
63
64 /**
65 * Iterator assignment.
66 *
67 * \param value value
68 * \return value parser
69 */
71 {
72 this->put(value);
73
74 return *this;
75 }
76 };
77
78 public:
79 /**
80 * Constructor
81 *
82 * \param out output iterator
83 */
87
88
89 /**
90 * Assignment operator.
91 *
92 * This operator assigns the first of a sequence of Comma Separated Values and
93 * returns the corresponding object to assign the remainder of this sequence.
94 *
95 * \param value value
96 * \return value parser
97 */
99 {
100 this->put(value);
101
102 return JCSV(*this);
103 }
104 };
105
106
107 /**
108 * Helper method to assign sequence of Comma Separated Values to output iterator.
109 *
110 * \param out output iterator
111 * \return value assigner
112 */
113 template<class JOutputIterator_t>
115 {
116 typedef typename JOutputIterator_t::container_type::value_type value_type;
117
119 }
120
121
122 /**
123 * Helper method to assign sequence of Comma Separated Values to output container.
124 *
125 * \param out output container
126 * \return value assigner
127 */
128 template<class JContainer_t>
130 {
131 typedef typename JContainer_t::value_type value_type;
132
134 }
135
136
137 /**
138 * Helper method to assign sequence of Comma Separated Values to output iterator.
139 *
140 * \param out output iterator
141 * \return value assigner
142 */
143 template<class JOutputIterator_t>
145 {
146 return iter_assign(out);
147 }
148}
149
150#endif
Forward declarations of STD containers.
Auxiliary class to assign a sequence of Comma Separated Values (CSV).
Definition JCSV.hh:42
JAssignSequence(const JSTDObjectWriter< T > &out)
Constructor.
Definition JCSV.hh:84
JCSV operator=(argument_type value)
Assignment operator.
Definition JCSV.hh:98
JClass< T >::argument_type argument_type
Definition JCSV.hh:45
virtual bool put(const T &object)=0
Object output.
Implementation of object output for STD compatible output iterator.
Implementation of object output from STD container.
Auxiliary classes and methods for language specific functionality.
JAssignSequence< typename JOutputIterator_t::container_type::value_type > iter_assign(const JOutputIterator_t &out)
Helper method to assign sequence of Comma Separated Values to output iterator.
Definition JCSV.hh:114
JAssignSequence< typename JContainer_t::value_type > assign(JContainer_t &out)
Helper method to assign sequence of Comma Separated Values to output container.
Definition JCSV.hh:129
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary class to assign the remainder of a sequence of Comma Separated Values.
Definition JCSV.hh:53
JCSV & operator,(argument_type value)
Iterator assignment.
Definition JCSV.hh:70
JCSV(const JSTDObjectWriter< T > &out)
Constructor.
Definition JCSV.hh:59
JArgument< T >::argument_type argument_type
Definition JClass.hh:82