torc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Commentable.cpp
Go to the documentation of this file.
1 // Torc - Copyright 2011-2013 University of Southern California. All Rights Reserved.
2 // $HeadURL$
3 // $Id$
4 
5 // This program is free software: you can redistribute it and/or modify it under the terms of the
6 // GNU General Public License as published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10 // without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
11 // the GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License along with this program. If
14 // not, see <http://www.gnu.org/licenses/>.
15 
16 #ifndef HAVE_CONFIG_H
17 #include "torc/generic/config.h"
18 #endif
19 
20 #ifdef GENOM_SERIALIZATION
21 #include <boost/archive/binary_iarchive.hpp>
22 #include <boost/archive/binary_oarchive.hpp>
23 #include <boost/serialization/string.hpp>
24 #include <boost/serialization/vector.hpp>
25 #endif //GENOM_SERIALIZATION
27 
28 namespace torc {
29 namespace generic {
30 
31 /**
32  * Add a comment to the object
33  *
34  * @param[in] comment The comment to add to an existing list of comments
35  */
36 void Commentable::addComment(const std::string& comment) {
37  mComments.push_back(comment);
38 }
39 
40 /**
41  * Get the list of all comments
42  *
43  * @param[in] inSource A list of all comments to be set on this object
44  */
45 void Commentable::setComments(const std::vector<std::string>& inSource) {
46  mComments.insert(mComments.end(), inSource.begin(), inSource.end());
47 }
48 
49 Commentable::Commentable() : mComments() {}
50 
52 
53 #ifdef GENOM_SERIALIZATION
54 template <class Archive> void Commentable::serialize(Archive& ar, unsigned int) {
55  ar & mComments;
56 }
57 
58 //TO SATISFY THE LINKER
59 template void
60 Commentable::serialize<boost::archive::binary_iarchive>(boost::archive::binary_iarchive& ar,
61  const unsigned int);
62 
63 template void
64 Commentable::serialize<boost::archive::binary_oarchive>(boost::archive::binary_oarchive& ar,
65  const unsigned int);
66 
67 #endif //GENOM_SERIALIZATION
68 
69 } // namespace generic
70 } // namespace torc
void addComment(const std::string &comment)
Definition: Commentable.cpp:36
std::string string
void setComments(const std::vector< std::string > &inSource)
Definition: Commentable.cpp:45
std::vector< std::string > mComments
Definition: Commentable.hpp:77