FRIBParallelanalysis  1.0
FrameworkforMPIParalleldataanalysisatFRIB
TCLCommandPackage.h
Go to the documentation of this file.
1 /*
2  This software is Copyright by the Board of Trustees of Michigan
3  State University (c) Copyright 2017.
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  Giordano Cerriza
13  NSCL
14  Michigan State University
15  East Lansing, MI 48824-1321
16 */
17 
21 // Typically this class should be overridden, but not necessarily.
22 // CTCLCommandPackage.h:
23 //
24 // This file defines the CTCLCommandPackage class.
25 //
26 // Author:
27 // Ron Fox
28 // NSCL
29 // Michigan State University
30 // East Lansing, MI 48824-1321
31 // mailto:fox@nscl.msu.edu
32 //
33 // Copyright 1999 NSCL, All Rights Reserved.
34 //
36 
37 #ifndef TCLCOMMANDPACKAGE_H //Required for current class
38 #define TCLCOMMANDPACKAGE_H
39  //Required for base classes
40 #ifndef TCLINTERPRETEROBJECT_H
41 #include "TCLInterpreterObject.h"
42 #endif
43 
44 #ifndef TCLINTERPRETER_H
45 #include "TCLInterpreter.h"
46 #endif
47  //Required for 1:M associated classes
48 #ifndef TCLPROCESSOR_H
49 #include "TCLProcessor.h"
50 #endif
51 
52 #include <libtclplusdatatypes.h>
53 
54 #include <list>
55 #include <string>
56 
57 
58 typedef std::list<CTCLProcessor*> CommandList;
59 typedef CommandList::iterator CommandListIterator;
60 
62 {
63  std::string m_sSignon; // Package signon message.
64  CommandList m_lCommands; // List of references to command objects
65  // which implement package.
66 
67 public:
68  // Constructors with parameters:
69  //
71  const std::string& rSignon=std::string("Unnamed pkg")) :
72  CTCLInterpreterObject(pInterp),
73  m_sSignon(rSignon)
74  {}
76  const char* pSignon = "Unnamed pkg") :
77  CTCLInterpreterObject(pInterp),
78  m_sSignon(pSignon)
79  {}
80  virtual ~ CTCLCommandPackage ( ) { /* Unregster(); */ } //Destructor
81 
82  //Copy constructor
83 
84  CTCLCommandPackage (const CTCLCommandPackage& aCTCLCommandPackage ) :
85  CTCLInterpreterObject (aCTCLCommandPackage),
86  m_sSignon(aCTCLCommandPackage.m_sSignon),
87  m_lCommands(aCTCLCommandPackage.m_lCommands)
88  {}
89 
90  //Operator= Assignment Operator
91 
92  CTCLCommandPackage& operator= (const CTCLCommandPackage& aCTCLCommandPackage)
93  {
94  if (this == &aCTCLCommandPackage) return *this;
95  CTCLInterpreterObject::operator= (aCTCLCommandPackage);
96  m_sSignon = aCTCLCommandPackage.m_sSignon;
97  m_lCommands = aCTCLCommandPackage.m_lCommands;
98 
99  return *this;
100  }
101 
102  //Operator== Equality Operator
103 
104  int operator== (const CTCLCommandPackage& aCTCLCommandPackage)
105  { return (
106  (CTCLInterpreterObject::operator== (aCTCLCommandPackage)) &&
107  (m_sSignon == aCTCLCommandPackage.m_sSignon) &&
108  (m_lCommands == aCTCLCommandPackage.m_lCommands)
109  );
110  }
111  // Selectors:
112 
113 public:
114  std::string getSignon() const
115  {
116  return m_sSignon;
117  }
118  CommandList getCommandList() const
119  {
120  return m_lCommands;
121  }
122  // Mutators:
123 
124 protected:
125  void setSignon (std::string am_sSignon)
126  {
127  m_sSignon = am_sSignon;
128  }
129  void setCommandList(CommandList& rList)
130  {
131  m_lCommands = rList;
132  }
133  // Operations:
134 
135 public:
136  void Register () ;
137  void Unregister () ;
138 
139  // inline functions:
140 
141  void AddProcessor (CTCLProcessor* pProcessor) {
142  m_lCommands.push_back(pProcessor);
143  }
144  void AddProcessors(CommandList& rList)
145  {
146  m_lCommands.insert(end(), rList.begin(), rList.end());
147  }
148  CommandListIterator begin () {
149  return m_lCommands.begin();
150  }
151  CommandListIterator end () {
152  return m_lCommands.end();
153  }
154 
155 };
156 
157 #endif
Definition: TCLInterpreterObject.h:46
Definition: TCLInterpreter.h:59
Definition: TCLProcessor.h:46
Definition: TCLCommandPackage.h:61