Typedefs | Functions
for_each_group_with_left_t.cc File Reference
#include "canvas/Persistency/Common/Assns.h"
#include "canvas/Persistency/Common/AssnsAlgorithms.h"
#include "canvas/Persistency/Common/Ptr.h"
#include "canvas/Utilities/Exception.h"
#include <iostream>
#include <string>
#include <vector>

Go to the source code of this file.

Typedefs

using intvec_t = std::vector< int >
 
using shortvec_t = std::vector< short >
 
using strvec_t = std::vector< std::string >
 
using floatvec_t = std::vector< float >
 
using assns_ab_t = art::Assns< int, float >
 
using assns_abd_t = art::Assns< int, float, short >
 
using ci_t = assns_abd_t::const_iterator
 

Functions

int main ()
 

Typedef Documentation

using assns_ab_t = art::Assns<int, float>

Definition at line 14 of file for_each_group_with_left_t.cc.

using assns_abd_t = art::Assns<int, float, short>

Definition at line 15 of file for_each_group_with_left_t.cc.

Definition at line 16 of file for_each_group_with_left_t.cc.

using floatvec_t = std::vector<float>

Definition at line 13 of file for_each_group_with_left_t.cc.

using intvec_t = std::vector<int>

Definition at line 10 of file for_each_group_with_left_t.cc.

using shortvec_t = std::vector<short>

Definition at line 11 of file for_each_group_with_left_t.cc.

Definition at line 12 of file for_each_group_with_left_t.cc.

Function Documentation

int main ( void  )

Definition at line 19 of file for_each_group_with_left_t.cc.

20 {
21 
22  // initialization stuff
23  art::ProductID const viid{2};
24  art::ProductID const vfid{3};
25  intvec_t const vi{1, 2, 3};
26  floatvec_t const vf{1.0, 1.1, 2.0, 2.1, 3.0, 3.1};
27  shortvec_t const vs{10, 11, 20, 21, 30, 31};
28  floatvec_t const vtest{2.0, 2.1, 4.0, 4.1, 6.0, 6.1};
29 
30  int k{};
31 
32  assns_abd_t assns;
33  assns_ab_t a1;
34 
35  for (long unsigned int i = 0; i < 3; ++i) {
36  auto p1 = art::Ptr<int>(viid, &vi[i], i);
37  for (long unsigned int j = 0; j < 2; ++j) {
38  auto p2 = art::Ptr<float>(vfid, &vf[k], k);
39  assns.addSingle(p1, p2, vs[k]);
40  a1.addSingle(p1, p2);
41  ++k;
42  }
43  }
44 
45  // use of art::for_each_group_with_left
46 
47  floatvec_t fvec;
48  auto floats = [&fvec](auto const& l, auto rs) {
49  for (auto f = begin(rs); f != end(rs); ++f) {
50  // std::cout << l;
51  fvec.push_back((**f) + l);
52  }
53  };
54 
56  // floats should be same as vf
57  for (auto i = 0; i < 6; ++i) {
58  std::cout << fvec[i] << "\n";
59  if (fvec[i] != vtest[i]) {
61  << "Float #" << i << "expected to be '" << vtest[i] << "', got '"
62  << fvec[i] << "' instead!\n";
63  }
64  }
65  return 0;
66 }
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
std::vector< short > shortvec_t
static QStrList * l
Definition: config.cpp:1044
std::vector< int > intvec_t
void for_each_group_with_left(art::Assns< A, B, D > const &assns, F func)
std::vector< float > floatvec_t
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
void addSingle(Ptr< left_t > const &left, Ptr< right_t > const &right, data_t const &data)
Definition: Assns.h:546
decltype(auto) constexpr begin(T &&obj)
ADL-aware version of std::begin.
Definition: StdUtils.h:72
Definition: fwd.h:31
#define a1