File: StudyMetaDataLinkSet.h

package info (click to toggle)
connectome-workbench 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 28,968 kB
  • ctags: 23,747
  • sloc: cpp: 260,127; ansic: 3,670; sh: 308; makefile: 146
file content (101 lines) | stat: -rw-r--r-- 3,376 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101

#ifndef __STUDY_META_DATA_LINK_SET_H__
#define __STUDY_META_DATA_LINK_SET_H__

/*LICENSE_START*/
/*
 *  Copyright (C) 2014  Washington University School of Medicine
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License along
 *  with this program; if not, write to the Free Software Foundation, Inc.,
 *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
/*LICENSE_END*/

#include <vector>

#include "CaretObject.h"
#include "StudyMetaDataLink.h"
#include "XmlException.h"

namespace caret {
    class XmlWriter;
    
    /// class for accessing and storing a group of StudyMetaDataLink
    class StudyMetaDataLinkSet : public CaretObject {
    public:
        // constructor
        StudyMetaDataLinkSet();
        
        // destructor
        ~StudyMetaDataLinkSet();
        
        // add a StudyMetaDataLink
        void addStudyMetaDataLink(const StudyMetaDataLink& smdl);
        
        // remove all links
        void clear();
        
        /// get the number of study meta data links
        int getNumberOfStudyMetaDataLinks() const { return m_links.size(); }
        
        // get a StudyMetaDataLink
        StudyMetaDataLink getStudyMetaDataLink(const int indx) const;
        
        // get a pointer to a StudyMetaDataLink
        StudyMetaDataLink* getStudyMetaDataLinkPointer(const int indx);
        
        // get all linked PubMed IDs
        void getAllLinkedPubMedIDs(std::vector<AString>& pmidsOut) const;
        
        // remove a study meta data link
        void removeStudyMetaDataLink(const int indx);
        
        // set a study meta data link
        void setStudyMetaDataLink(const int indx, const StudyMetaDataLink& smdl);
        
        /// get the entire link set in an "coded" text form
        AString getLinkSetAsCodedText() const;
        
        /// set the link set from "coded" text form
        void setLinkSetFromCodedText(const AString& txt);
        
        // called to write XML
        void writeXML(XmlWriter& xmlWriter) const throw (XmlException);
        
        //
        //----- tags for reading and writing 
        //
        /// tag for reading and writing study metadata
        static const AString XML_TAG_STUDY_META_DATA_LINK_SET;
        
        /// get the link separator for when stored as a string
        static const AString encodedTextLinkSeparator;  
        
    protected:
        /// the StudyMetaDataLink
        std::vector<StudyMetaDataLink> m_links;
        
        friend class CellBase;
    };
    
#ifdef __STUDY_META_DATA_LINK_SET_MAIN__
    const AString StudyMetaDataLinkSet::XML_TAG_STUDY_META_DATA_LINK_SET = "StudyMetaDataLinkSet";
    const AString StudyMetaDataLinkSet::encodedTextLinkSeparator = ":::::"; 
#endif // __STUDY_META_DATA_LINK_SET_MAIN__
    
} // namespace 

#endif // __STUDY_META_DATA_LINK_SET_H__