LCOV - code coverage report
Current view: top level - tools - Citations.cpp (source / functions) Hit Total Coverage
Test: plumed test coverage Lines: 18 18 100.0 %
Date: 2025-11-25 13:55:50 Functions: 4 4 100.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             : #include "Citations.h"
      23             : #include "Exception.h"
      24             : #include "Tools.h"
      25             : #include <iostream>
      26             : 
      27             : namespace PLMD {
      28             : 
      29        4882 : std::string Citations::cite(const std::string & item) {
      30             :   unsigned i;
      31       12966 :   for(i=0; i<items.size(); ++i)
      32        9024 :     if(items[i]==item) {
      33             :       break;
      34             :     }
      35        4882 :   if(i==items.size()) {
      36        3942 :     items.push_back(item);
      37             :   }
      38        4882 :   plumed_assert(i<items.size());
      39             :   std::string ret;
      40        4882 :   Tools::convert(i+1,ret);
      41        9764 :   ret="["+ret+"]";
      42        4882 :   return ret;
      43             : }
      44             : 
      45        1319 : std::ostream & operator<<(std::ostream &log,const Citations&cit) {
      46        5257 :   for(unsigned i=0; i<cit.items.size(); ++i) {
      47        7876 :     log<<"  ["<<i+1<<"] "<<cit.items[i]<<"\n";
      48             :   }
      49        1319 :   return log;
      50             : }
      51             : 
      52       10666 : void Citations::clear() {
      53       10666 :   items.clear();
      54       10666 : }
      55             : 
      56       20307 : bool Citations::empty()const {
      57       20307 :   return items.empty();
      58             : }
      59             : 
      60             : }
      61             : 
      62             : 

Generated by: LCOV version 1.16