![]() |
|
|||
File indexing completed on 2025-04-19 09:13:41
0001 // This file contains boilerplate code for static reader functions in all 0002 // classes inheriting from Reader. These methods just forward to the methods on 0003 // the Reader base class, but code duplication can't be avoided without a 0004 // preprocessor hack like this, AFAIK. 0005 0006 /// @name Reading multiple analysis objects into arbitrary collections. 0007 //@{ 0008 0009 // template <typename RANGE> 0010 // static typename std::enable_if<CIterable<RANGE>::value>::type 0011 // read(std::ostream& stream, const RANGE& aos) { 0012 // create().write(stream, std::begin(aos), std::end(aos)); 0013 // } 0014 0015 // template <typename RANGE> 0016 // static typename std::enable_if<CIterable<RANGE>::value>::type 0017 // write(const std::string& filename, const RANGE& aos) { 0018 // create().write(filename, std::begin(aos), std::end(aos)); 0019 // } 0020 0021 0022 0023 /// @brief Read in a collection of objects @a objs from output stream @a stream. 0024 /// 0025 /// This version fills (actually, appends to) a variable supplied container 0026 /// Note: SFINAE is used to check for a void push_back(const AnalysisObject*) method 0027 template<typename CONT> 0028 static typename std::enable_if<YODA::Pushable<CONT,AnalysisObject*>::value>::type 0029 read(std::istream& stream, CONT& aos, const std::string& match = "", const std::string& unmatch = "") { 0030 create().read(stream, aos, match, unmatch); 0031 } 0032 0033 // /// @brief Read in a collection of objects @a objs from output stream @a stream. 0034 // /// 0035 // /// This version fills (actually, appends to) a supplied vector, avoiding copying, 0036 // /// and is hence CPU efficient. 0037 // /// 0038 // static void read(std::istream& stream, std::vector<AnalysisObject*>& aos) { 0039 // create().read(stream, aos); 0040 // } 0041 0042 /// @brief Read in a collection of objects from output stream @a stream. 0043 /// 0044 /// This version returns a vector by value, involving copying, and is hence less 0045 /// CPU efficient than the alternative version where a vector is filled by reference. 0046 static std::vector<AnalysisObject*> read(std::istream& stream, const std::string& match = "", 0047 const std::string& unmatch = "") { 0048 return create().read(stream, match, unmatch); 0049 } 0050 0051 0052 /// @brief Read in a collection of objects @a objs from file @a filename. 0053 /// 0054 /// 0055 /// This version fills (actually, appends to) a variable supplied container 0056 /// Note: SFINAE is used to check for a void push_back(const AnalysisObject*) method 0057 template<typename CONT> 0058 static typename std::enable_if<YODA::Pushable<CONT,AnalysisObject*>::value>::type 0059 read(const std::string& filename, CONT& aos, const std::string& match = "", const std::string& unmatch = "") { 0060 return create().read(filename, aos, match, unmatch); 0061 } 0062 0063 // /// @brief Read in a collection of objects @a objs from file @a filename. 0064 // /// 0065 // /// This version fills (actually, appends to) a supplied vector, avoiding copying, 0066 // /// and is hence CPU efficient. 0067 // /// 0068 // static void read(const std::string& filename, std::vector<AnalysisObject*>& aos) { 0069 // return create().read(filename, aos); 0070 // } 0071 0072 /// @brief Read in a collection of objects from output stream @a stream. 0073 /// 0074 /// This version returns a vector by value, involving copying, and is hence less 0075 /// CPU efficient than the alternative version where a vector is filled by reference. 0076 static std::vector<AnalysisObject*> read(const std::string& filename, const std::string& match = "", 0077 const std::string& unmatch = "") { 0078 return create().read(filename, match, unmatch); 0079 } 0080 0081 //@}
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |