LCOV - code coverage report
Current view: top level - tools - Citations.h (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 1 1 100.0 %
Date: 2024-10-18 14:00:25 Functions: 0 0 -

          Line data    Source code
       1             : /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       2             :    Copyright (c) 2012-2023 The plumed team
       3             :    (see the PEOPLE file at the root of the distribution for a list of names)
       4             : 
       5             :    See http://www.plumed.org for more information.
       6             : 
       7             :    This file is part of plumed, version 2.
       8             : 
       9             :    plumed is free software: you can redistribute it and/or modify
      10             :    it under the terms of the GNU Lesser General Public License as published by
      11             :    the Free Software Foundation, either version 3 of the License, or
      12             :    (at your option) any later version.
      13             : 
      14             :    plumed is distributed in the hope that it will be useful,
      15             :    but WITHOUT ANY WARRANTY; without even the implied warranty of
      16             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      17             :    GNU Lesser General Public License for more details.
      18             : 
      19             :    You should have received a copy of the GNU Lesser General Public License
      20             :    along with plumed.  If not, see <http://www.gnu.org/licenses/>.
      21             : +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
      22             : #ifndef __PLUMED_tools_Citations_h
      23             : #define __PLUMED_tools_Citations_h
      24             : 
      25             : #include <vector>
      26             : #include <string>
      27             : #include <iosfwd>
      28             : 
      29             : namespace PLMD {
      30             : 
      31             : /**
      32             : \ingroup TOOLBOX
      33             : Class taking care of bibliography.
      34             : 
      35             : This class contains a vector of citations. To add a new citations, use cite(). To print
      36             : the entire bibliography, just dump on a ostream. Everytime cite is used, a string
      37             : containing the number of the citation is returned. If the same citation is added twice,
      38             : the same string is returned, so that this example will produce only two bibliographic items:
      39             : \verbatim
      40             : #include "Citations.h"
      41             : #include <iostream>
      42             : int main(int argc,char**argv){
      43             :   PLMD::Citations citations;
      44             :   std::cout << citations.cite("Pinco e Pallino, Il Piccolo 33, 444 (2012)") << "\n";
      45             :   std::cout << citations.cite("Other cite") << "\n";
      46             :   std::cout << citations.cite("Pinco e Pallino, Il Piccolo 33, 444 (2012)") << "\n";
      47             : 
      48             :   std::cout << "Bibliography\n"<< citations;
      49             :   return 0;
      50             : }
      51             : \endverbatim
      52             : */
      53             : 
      54      806698 : class Citations {
      55             :   std::vector<std::string> items;
      56             : public:
      57             : /// Add a citation.
      58             : /// It returns a string containing the reference number, something like "[10]"
      59             :   std::string cite(const std::string &);
      60             : /// Dumps the bibliography.
      61             : /// It writes on the ostream the list of all the bibliographic items
      62             : /// prefixed with their reference number
      63             :   friend std::ostream &operator<<(std::ostream &,const Citations&);
      64             : /// Delete all references
      65             :   void clear();
      66             : /// Check if bibliography is empty
      67             :   bool empty()const;
      68             : };
      69             : 
      70             : std::ostream & operator<<(std::ostream &,const Citations&);
      71             : 
      72             : }
      73             : 
      74             : #endif

Generated by: LCOV version 1.16