FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
TCLList.h
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2014.
4 
5  You may use this software under the terms of the GNU public license
6  (GPL). The terms of this license are described at:
7 
8  http://www.gnu.org/licenses/gpl.txt
9 
10  Authors:
11  Ron Fox
12  Jeromy Tompkins
13  NSCL
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
18 // CTCLList.h:
19 //
20 // This file defines the CTCLList class.
21 //
22 // Author:
23 // Ron Fox
24 // NSCL
25 // Michigan State University
26 // East Lansing, MI 48824-1321
27 // mailto:fox@nscl.msu.edu
28 //
29 // Copyright 1999 NSCL, All Rights Reserved.
30 //
32 #ifndef TCLLIST_H //Required for current class
33 #define TCLLIST_H
34  //Required for base classes
35 #ifndef TCLINTERPRETEROBJECT_H
36 #include "TCLInterpreterObject.h"
37 #endif
38 
39 #include <string>
40 #include <vector>
41 
42 typedef std::vector<std::string> StringArray;
43 typedef StringArray::iterator StringArrayIterator;
44 
46 {
47  char* m_pList; // Pointer to list storage, dynamically allocated
48 
49 public:
50  //Default constructor
51 
52  CTCLList (CTCLInterpreter* pInterp) :
53  CTCLInterpreterObject(pInterp),
54  m_pList(0)
55  { }
56  ~CTCLList() { delete []m_pList; }; //Destructor
57 
58  //Constructors with arguments
59 
60  CTCLList (CTCLInterpreter* pInterp, const char* am_pList );
61  CTCLList (CTCLInterpreter* pInterp, const std::string& rList);
62 
63  //Copy constructor
64 
65  CTCLList (const CTCLList& aCTCLList ) {
66  DoAssign(aCTCLList);
67  }
68 
69 
70  //Operator= Assignment Operator
71  //Update to access 1:M part class attributes
72  //Update to access 1:1 associated class attributes
73  //Update to access 1:M associated class attributes
74  CTCLList& operator= (const CTCLList& aCTCLList) {
75  if(this != &aCTCLList) {
76  // CTCLList::operator=(aCTCLList);
77  DoAssign(aCTCLList);
78  }
79  return *this;
80  }
81 
82  //Operator== Equality Operator
83  //Update to access 1:M part class attributes
84  //Update to access 1:1 associated class attributes
85  //Update to access 1:M associated class attributes
86  int operator== (const CTCLList& aCTCLList);
87  int operator!= (const CTCLList& aCTCLList) {
88  return !(operator==(aCTCLList));
89  }
90 
91  // Selectors:
92 
93 public:
94  const char* getList() const
95  {
96  return m_pList;
97  }
98  // Mutators:
99 
100 public:
101  void setList (const char* am_pList);
102 
103  // Operations:
104  //
105 public:
106  // Operations which reflect the Tcl_xxx operations on lists.
107 
108  int Split (StringArray& rElements) ;
109  int Split (int& argc, char*** argv);
110 
111  const char* Merge (const StringArray& rElements) ;
112  const char* Merge(int argc, char** argv);
113  //
114  // protected utilities:
115  //
116 protected:
117  void DoAssign(const CTCLList& rRhs);
118 
119 };
120 
121 #endif
Definition: TCLInterpreterObject.h:46
Definition: TCLInterpreter.h:59
Definition: TCLList.h:45